This repository has been archived by the owner on Jun 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This CRD is created as the UX of the HNC self-service namespace. See design at http://bit.ly/hnc-self-serve-ux. Tested on a GKE cluster by "kubectl apply -f" the generated CRD yaml file. The CRD was created with success.
- Loading branch information
1 parent
95218a0
commit 8a39dbb
Showing
5 changed files
with
193 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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{}) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
52 changes: 52 additions & 0 deletions
52
incubator/hnc/config/crd/bases/hnc.x-k8s.io_hierarchicalnamespaces.yaml
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,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: [] |
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