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