Skip to content

Commit

Permalink
Merge pull request #131 from erikgb/add-unserved-v2
Browse files Browse the repository at this point in the history
chore: add unserved v2 API based on v2alpha1
  • Loading branch information
zoetrope authored Jun 4, 2024
2 parents ba1a6a6 + 411b169 commit 0d762dc
Show file tree
Hide file tree
Showing 10 changed files with 729 additions and 1 deletion.
3 changes: 3 additions & 0 deletions api/accurate/v2/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// +kubebuilder:object:generate=true
// +groupName=accurate.cybozu.com
package v2
18 changes: 18 additions & 0 deletions api/accurate/v2/groupversion_info.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Package v2 contains API Schema definitions for the accurate v2 API group
package v2

import (
"k8s.io/apimachinery/pkg/runtime/schema"
"sigs.k8s.io/controller-runtime/pkg/scheme"
)

var (
// SchemeGroupVersion is group version used to register these objects
SchemeGroupVersion = schema.GroupVersion{Group: "accurate.cybozu.com", Version: "v2"}

// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion}

// AddToScheme adds the types in this group-version to the given scheme.
AddToScheme = SchemeBuilder.AddToScheme
)
68 changes: 68 additions & 0 deletions api/accurate/v2/subnamespace_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package v2

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

// SubNamespaceStatus defines the observed state of SubNamespace
type SubNamespaceStatus struct {
// The generation observed by the object controller.
// +optional
ObservedGeneration int64 `json:"observedGeneration,omitempty"`

// Conditions represent the latest available observations of an object's state
// +listType=map
// +listMapKey=type
// +optional
Conditions []metav1.Condition `json:"conditions,omitempty"`
}

// SubNamespaceSpec defines the desired state of SubNamespace
type SubNamespaceSpec struct {
// Labels are the labels to be propagated to the sub-namespace
// +optional
Labels map[string]string `json:"labels,omitempty"`

// Annotations are the annotations to be propagated to the sub-namespace.
// +optional
Annotations map[string]string `json:"annotations,omitempty"`
}

//+kubebuilder:object:root=true
//+kubebuilder:unservedversion
//+kubebuilder:subresource:status
//+genclient

// SubNamespace is the Schema for the subnamespaces API
type SubNamespace struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

// Spec is the spec of SubNamespace.
// +optional
Spec SubNamespaceSpec `json:"spec,omitempty"`

// Status is the status of SubNamespace.
// +optional
Status SubNamespaceStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true

// SubNamespaceList contains a list of SubNamespace
type SubNamespaceList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []SubNamespace `json:"items"`
}

func init() {
SchemeBuilder.Register(&SubNamespace{}, &SubNamespaceList{})
}

const (
SubNamespaceConflict string = "Conflict"
)
120 changes: 120 additions & 0 deletions api/accurate/v2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

109 changes: 109 additions & 0 deletions charts/accurate/templates/generated/crds.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0d762dc

Please sign in to comment.