diff --git a/incubator/hnc/api/v1alpha1/hierarchical_namespace.go b/incubator/hnc/api/v1alpha1/hierarchical_namespace.go new file mode 100644 index 000000000..c6e125827 --- /dev/null +++ b/incubator/hnc/api/v1alpha1/hierarchical_namespace.go @@ -0,0 +1,67 @@ +/* + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// HNSStatus describes the status of a hierarchical namespace. The status could be +// "missing", "ok" or "conflict". The definitions will be described below. +type HNSStatus string + +const ( + // Missing means the child namespace has not been created yet. This should be the default + // status when the HNS is just created. + Missing HNSStatus = "missing" + + // Ok means the child namespace exists. + Ok HNSStatus = "ok" + + // Conflict means a namespace of the same name already exists. + Conflict HNSStatus = "conflict" +) + +// HierarchicalNamespaceStatus defines the observed state of HierarchicalNamespace. +type HierarchicalNamespaceStatus struct { + // API version of the kind defined below. This is used to unambiguously identifies the kind. + Status HNSStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:path=hierarchicalnamespaces,scope=Namespaced + +// HierarchicalNamespace is the Schema for the self-service namespace API. +// See details at http://bit.ly/hnc-self-serve-ux. +type HierarchicalNamespace struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Status HierarchicalNamespaceStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// HierarchicalNamespaceList contains a list of HierarchicalNamespace. +type HierarchicalNamespaceList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []HierarchicalNamespace `json:"items"` +} + +func init() { + SchemeBuilder.Register(&HierarchicalNamespace{}, &HierarchicalNamespaceList{}) +} diff --git a/incubator/hnc/api/v1alpha1/zz_generated.deepcopy.go b/incubator/hnc/api/v1alpha1/zz_generated.deepcopy.go index 80273d8af..f759f5889 100644 --- a/incubator/hnc/api/v1alpha1/zz_generated.deepcopy.go +++ b/incubator/hnc/api/v1alpha1/zz_generated.deepcopy.go @@ -159,6 +159,79 @@ func (in *HNCConfigurationStatus) DeepCopy() *HNCConfigurationStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HierarchicalNamespace) DeepCopyInto(out *HierarchicalNamespace) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Status = in.Status +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HierarchicalNamespace. +func (in *HierarchicalNamespace) DeepCopy() *HierarchicalNamespace { + if in == nil { + return nil + } + out := new(HierarchicalNamespace) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *HierarchicalNamespace) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HierarchicalNamespaceList) DeepCopyInto(out *HierarchicalNamespaceList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]HierarchicalNamespace, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HierarchicalNamespaceList. +func (in *HierarchicalNamespaceList) DeepCopy() *HierarchicalNamespaceList { + if in == nil { + return nil + } + out := new(HierarchicalNamespaceList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *HierarchicalNamespaceList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HierarchicalNamespaceStatus) DeepCopyInto(out *HierarchicalNamespaceStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HierarchicalNamespaceStatus. +func (in *HierarchicalNamespaceStatus) DeepCopy() *HierarchicalNamespaceStatus { + if in == nil { + return nil + } + out := new(HierarchicalNamespaceStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *HierarchyConfiguration) DeepCopyInto(out *HierarchyConfiguration) { *out = *in diff --git a/incubator/hnc/config/crd/bases/hnc.x-k8s.io_hierarchicalnamespaces.yaml b/incubator/hnc/config/crd/bases/hnc.x-k8s.io_hierarchicalnamespaces.yaml new file mode 100644 index 000000000..90735ffe9 --- /dev/null +++ b/incubator/hnc/config/crd/bases/hnc.x-k8s.io_hierarchicalnamespaces.yaml @@ -0,0 +1,52 @@ + +--- +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + creationTimestamp: null + name: hierarchicalnamespaces.hnc.x-k8s.io +spec: + group: hnc.x-k8s.io + names: + kind: HierarchicalNamespace + listKind: HierarchicalNamespaceList + plural: hierarchicalnamespaces + singular: hierarchicalnamespace + scope: Namespaced + validation: + openAPIV3Schema: + description: HierarchicalNamespace is the Schema for the self-service namespace + API. See details at http://bit.ly/hnc-self-serve-ux. + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds' + type: string + metadata: + type: object + status: + description: HierarchicalNamespaceStatus defines the observed state of HierarchicalNamespace. + properties: + status: + description: API version of the kind defined below. This is used to + unambiguously identifies the kind. + type: string + type: object + type: object + version: v1alpha1 + versions: + - name: v1alpha1 + served: true + storage: true +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/incubator/hnc/config/crd/bases/hnc.x-k8s.io_hierarchyconfigurations.yaml b/incubator/hnc/config/crd/bases/hnc.x-k8s.io_hierarchyconfigurations.yaml index 7a3c6a8b3..d917363a5 100644 --- a/incubator/hnc/config/crd/bases/hnc.x-k8s.io_hierarchyconfigurations.yaml +++ b/incubator/hnc/config/crd/bases/hnc.x-k8s.io_hierarchyconfigurations.yaml @@ -3,8 +3,6 @@ apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.2.4 creationTimestamp: null name: hierarchyconfigurations.hnc.x-k8s.io spec: @@ -14,7 +12,7 @@ spec: listKind: HierarchyConfigurationList plural: hierarchyconfigurations singular: hierarchyconfiguration - scope: Namespaced + scope: "" validation: openAPIV3Schema: description: Hierarchy is the Schema for the hierarchies API diff --git a/incubator/hnc/config/crd/bases/hnc.x-k8s.io_hncconfigurations.yaml b/incubator/hnc/config/crd/bases/hnc.x-k8s.io_hncconfigurations.yaml index 1d404f74c..025af0ec5 100644 --- a/incubator/hnc/config/crd/bases/hnc.x-k8s.io_hncconfigurations.yaml +++ b/incubator/hnc/config/crd/bases/hnc.x-k8s.io_hncconfigurations.yaml @@ -3,8 +3,6 @@ apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.2.4 creationTimestamp: null name: hncconfigurations.hnc.x-k8s.io spec: