generated from cybozu-go/neco-template
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: make SubNamespace compatible with kstatus
- Loading branch information
Showing
6 changed files
with
397 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Package v2alpha1 contains API Schema definitions for the accurate v2alpha1 API group | ||
// +kubebuilder:object:generate=true | ||
// +groupName=accurate.cybozu.com | ||
package v2alpha1 | ||
|
||
import ( | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
"sigs.k8s.io/controller-runtime/pkg/scheme" | ||
) | ||
|
||
var ( | ||
// GroupVersion is group version used to register these objects | ||
GroupVersion = schema.GroupVersion{Group: "accurate.cybozu.com", Version: "v2alpha1"} | ||
|
||
// SchemeBuilder is used to add go types to the GroupVersionKind scheme | ||
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} | ||
|
||
// AddToScheme adds the types in this group-version to the given scheme. | ||
AddToScheme = SchemeBuilder.AddToScheme | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package v2alpha1 | ||
|
||
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"` | ||
} | ||
|
||
// Keeping this version un-served for now | ||
//+kubebuilder:unservedversion | ||
//+kubebuilder:object:root=true | ||
//+kubebuilder:subresource:status | ||
|
||
// 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{}) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.