1 package v1 2 3 import ( 4 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 5 ) 6 7 // CloudPrivateIPConfig performs an assignment of a private IP address to the 8 // primary NIC associated with cloud VMs. This is done by specifying the IP and 9 // Kubernetes node which the IP should be assigned to. This CRD is intended to 10 // be used by the network plugin which manages the cluster network. The spec 11 // side represents the desired state requested by the network plugin, and the 12 // status side represents the current state that this CRD's controller has 13 // executed. No users will have permission to modify it, and if a cluster-admin 14 // decides to edit it for some reason, their changes will be overwritten the 15 // next time the network plugin reconciles the object. Note: the CR's name 16 // must specify the requested private IP address (can be IPv4 or IPv6). 17 // 18 // Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer). 19 // +genclient 20 // +genclient:nonNamespaced 21 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 22 // +k8s:openapi-gen=true 23 // +kubebuilder:object:root=true 24 // +kubebuilder:subresource:status 25 // +kubebuilder:resource:path=cloudprivateipconfigs,scope=Cluster 26 // +openshift:compatibility-gen:level=1 27 type CloudPrivateIPConfig struct { 28 metav1.TypeMeta `json:",inline"` 29 30 // metadata is the standard object's metadata. 31 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata 32 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 33 // spec is the definition of the desired private IP request. 34 // +kubebuilder:validation:Required 35 // +required 36 Spec CloudPrivateIPConfigSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` 37 // status is the observed status of the desired private IP request. Read-only. 38 // +kubebuilder:validation:Optional 39 // +optional 40 Status CloudPrivateIPConfigStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` 41 } 42 43 // CloudPrivateIPConfigSpec consists of a node name which the private IP should be assigned to. 44 // +k8s:openapi-gen=true 45 type CloudPrivateIPConfigSpec struct { 46 // node is the node name, as specified by the Kubernetes field: node.metadata.name 47 // +kubebuilder:validation:Optional 48 // +optional 49 Node string `json:"node" protobuf:"bytes,1,opt,name=node"` 50 } 51 52 // CloudPrivateIPConfigStatus specifies the node assignment together with its assignment condition. 53 // +k8s:openapi-gen=true 54 type CloudPrivateIPConfigStatus struct { 55 // node is the node name, as specified by the Kubernetes field: node.metadata.name 56 // +kubebuilder:validation:Optional 57 // +optional 58 Node string `json:"node" protobuf:"bytes,1,opt,name=node"` 59 // condition is the assignment condition of the private IP and its status 60 // +kubebuilder:validation:Required 61 // +required 62 Conditions []metav1.Condition `json:"conditions" protobuf:"bytes,2,rep,name=conditions"` 63 } 64 65 // CloudPrivateIPConfigConditionType specifies the current condition type of the CloudPrivateIPConfig 66 type CloudPrivateIPConfigConditionType string 67 68 const ( 69 // Assigned is the condition type of the cloud private IP request. 70 // It is paired with the following ConditionStatus: 71 // - True - in the case of a successful assignment 72 // - False - in the case of a failed assignment 73 // - Unknown - in the case of a pending assignment 74 Assigned CloudPrivateIPConfigConditionType = "Assigned" 75 ) 76 77 // Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer). 78 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 79 // +resource:path=cloudprivateipconfig 80 // CloudPrivateIPConfigList is the list of CloudPrivateIPConfigList. 81 // +openshift:compatibility-gen:level=1 82 type CloudPrivateIPConfigList struct { 83 metav1.TypeMeta `json:",inline"` 84 85 // metadata is the standard list's metadata. 86 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata 87 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` 88 89 // List of CloudPrivateIPConfig. 90 Items []CloudPrivateIPConfig `json:"items" protobuf:"bytes,2,rep,name=items"` 91 } 92