@@ -34,6 +34,95 @@ const (
3434 ProviderServiceAccountFinalizer = "providerserviceaccount.vmware.infrastructure.cluster.x-k8s.io"
3535)
3636
37+ // VSphereCluster's Ready condition and corresponding reasons that will be used in v1Beta2 API version.
38+ const (
39+ // VSphereClusterReadyV1Beta2Condition is true if the VSphereCluster's deletionTimestamp is not set, VSphereCluster's
40+ // ResourcePolicyReady, NetworkReady, LoadBalancerReady, ProviderServiceAccountsReady and ServiceDiscoveryReady conditions are true.
41+ VSphereClusterReadyV1Beta2Condition = clusterv1 .ReadyV1Beta2Condition
42+
43+ // VSphereClusterReadyV1Beta2Reason surfaces when the VSphereCluster readiness criteria is met.
44+ VSphereClusterReadyV1Beta2Reason = clusterv1 .ReadyV1Beta2Reason
45+
46+ // VSphereClusterNotReadyV1Beta2Reason surfaces when the VSphereCluster readiness criteria is not met.
47+ VSphereClusterNotReadyV1Beta2Reason = clusterv1 .NotReadyV1Beta2Reason
48+
49+ // VSphereClusterReadyUnknownV1Beta2Reason surfaces when at least one VSphereCluster readiness criteria is unknown
50+ // and no VSphereCluster readiness criteria is not met.
51+ VSphereClusterReadyUnknownV1Beta2Reason = clusterv1 .ReadyUnknownV1Beta2Reason
52+ )
53+
54+ // VSphereCluster's ResourcePolicyReady condition and corresponding reasons that will be used in v1Beta2 API version.
55+ const (
56+ // VSphereClusterResourcePolicyReadyV1Beta2Condition documents the status of the ResourcePolicy for a VSphereCluster.
57+ VSphereClusterResourcePolicyReadyV1Beta2Condition = "ResourcePolicyReady"
58+
59+ // VSphereClusterResourcePolicyReadyV1Beta2Reason surfaces when the ResourcePolicy for a VSphereCluster is ready.
60+ VSphereClusterResourcePolicyReadyV1Beta2Reason = clusterv1 .ReadyV1Beta2Reason
61+
62+ // VSphereClusterResourcePolicyNotReadyV1Beta2Reason surfaces when the ResourcePolicy for a VSphereCluster is not ready.
63+ VSphereClusterResourcePolicyNotReadyV1Beta2Reason = clusterv1 .NotReadyV1Beta2Reason
64+
65+ // VSphereClusterResourcePolicyReadyDeletingV1Beta2Reason surfaces when the resource policy for a VSphereCluster is being deleted.
66+ VSphereClusterResourcePolicyReadyDeletingV1Beta2Reason = clusterv1 .DeletingV1Beta2Reason
67+ )
68+
69+ // VSphereCluster's NetworkReady condition and corresponding reasons that will be used in v1Beta2 API version.
70+ const (
71+ // VSphereClusterNetworkReadyV1Beta2Condition documents the status of the network for a VSphereCluster.
72+ VSphereClusterNetworkReadyV1Beta2Condition = "NetworkReady"
73+
74+ // VSphereClusterNetworkReadyV1Beta2Reason surfaces when the network for a VSphereCluster is ready.
75+ VSphereClusterNetworkReadyV1Beta2Reason = clusterv1 .ReadyV1Beta2Reason
76+
77+ // VSphereClusterNetworkNotReadyV1Beta2Reason surfaces when the network for a VSphereCluster is not ready.
78+ VSphereClusterNetworkNotReadyV1Beta2Reason = clusterv1 .NotReadyV1Beta2Reason
79+
80+ // VSphereClusterNetworkReadyDeletingV1Beta2Reason surfaces when the network for a VSphereCluster is being deleted.
81+ VSphereClusterNetworkReadyDeletingV1Beta2Reason = clusterv1 .DeletingV1Beta2Reason
82+ )
83+
84+ // VSphereCluster's LoadBalancerReady condition and corresponding reasons that will be used in v1Beta2 API version.
85+ const (
86+ // VSphereClusterLoadBalancerReadyV1Beta2Condition documents the status of the LoadBalancer for a VSphereCluster.
87+ VSphereClusterLoadBalancerReadyV1Beta2Condition = "LoadBalancerReady"
88+
89+ // VSphereClusterLoadBalancerReadyV1Beta2Reason surfaces when the LoadBalancer for a VSphereCluster is ready.
90+ VSphereClusterLoadBalancerReadyV1Beta2Reason = clusterv1 .ReadyV1Beta2Reason
91+
92+ // VSphereClusterLoadBalancerNotReadyV1Beta2Reason surfaces when the LoadBalancer for a VSphereCluster is not ready.
93+ VSphereClusterLoadBalancerNotReadyV1Beta2Reason = clusterv1 .NotReadyV1Beta2Reason
94+
95+ // VSphereClusterLoadBalancerWaitingForIPV1Beta2Reason surfaces when the LoadBalancer for a VSphereCluster is waiting for an IP to be assigned.
96+ VSphereClusterLoadBalancerWaitingForIPV1Beta2Reason = "WaitingForIP"
97+
98+ // VSphereClusterLoadBalancerDeletingV1Beta2Reason surfaces when the LoadBalancer for a VSphereCluster is being deleted.
99+ VSphereClusterLoadBalancerDeletingV1Beta2Reason = clusterv1 .DeletingV1Beta2Reason
100+ )
101+
102+ // VSphereCluster's ProviderServiceAccountsReady condition and corresponding reasons that will be used in v1Beta2 API version.
103+ const (
104+ // VSphereClusterProviderServiceAccountsReadyV1Beta2Condition documents the status of the provider service accounts for a VSphereCluster.
105+ VSphereClusterProviderServiceAccountsReadyV1Beta2Condition = "ProviderServiceAccountsReady"
106+
107+ // VSphereClusterProviderServiceAccountsReadyV1Beta2Reason surfaces when the provider service accounts for a VSphereCluster is ready.
108+ VSphereClusterProviderServiceAccountsReadyV1Beta2Reason = clusterv1 .ReadyV1Beta2Reason
109+
110+ // VSphereClusterProviderServiceAccountsNotReadyV1Beta2Reason surfaces when the provider service accounts for a VSphereCluster is not ready.
111+ VSphereClusterProviderServiceAccountsNotReadyV1Beta2Reason = clusterv1 .NotReadyV1Beta2Reason
112+ )
113+
114+ // VSphereCluster's ServiceDiscoveryReady condition and corresponding reasons that will be used in v1Beta2 API version.
115+ const (
116+ // VSphereClusterServiceDiscoveryReadyV1Beta2Condition documents the status of the service discovery for a VSphereCluster.
117+ VSphereClusterServiceDiscoveryReadyV1Beta2Condition = "ServiceDiscoveryReady"
118+
119+ // VSphereClusterServiceDiscoveryReadyV1Beta2Reason surfaces when the service discovery for a VSphereCluster is ready.
120+ VSphereClusterServiceDiscoveryReadyV1Beta2Reason = clusterv1 .ReadyV1Beta2Reason
121+
122+ // VSphereClusterServiceDiscoveryNotReadyV1Beta2Reason surfaces when the service discovery for a VSphereCluster is not ready.
123+ VSphereClusterServiceDiscoveryNotReadyV1Beta2Reason = clusterv1 .NotReadyV1Beta2Reason
124+ )
125+
37126// VSphereClusterSpec defines the desired state of VSphereCluster.
38127type VSphereClusterSpec struct {
39128 // +optional
@@ -59,6 +148,23 @@ type VSphereClusterStatus struct {
59148 // FailureDomains is a list of failure domain objects synced from the
60149 // infrastructure provider.
61150 FailureDomains clusterv1.FailureDomains `json:"failureDomains,omitempty"`
151+
152+ // v1beta2 groups all the fields that will be added or modified in VSphereCluster's status with the V1Beta2 version.
153+ // +optional
154+ V1Beta2 * VSphereClusterV1Beta2Status `json:"v1beta2,omitempty"`
155+ }
156+
157+ // VSphereClusterV1Beta2Status groups all the fields that will be added or modified in VSphereClusterStatus with the V1Beta2 version.
158+ // See https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more context.
159+ type VSphereClusterV1Beta2Status struct {
160+ // conditions represents the observations of a VSphereCluster's current state.
161+ // Known condition types are Ready, ResourcePolicyReady, NetworkReady, LoadBalancerReady,
162+ // ProviderServiceAccountsReady and ServiceDiscoveryReady conditions.
163+ // +optional
164+ // +listType=map
165+ // +listMapKey=type
166+ // +kubebuilder:validation:MaxItems=32
167+ Conditions []metav1.Condition `json:"conditions,omitempty"`
62168}
63169
64170// +kubebuilder:object:root=true
@@ -94,6 +200,22 @@ func (r *VSphereCluster) SetConditions(conditions clusterv1.Conditions) {
94200 r .Status .Conditions = conditions
95201}
96202
203+ // GetV1Beta2Conditions returns the set of conditions for this object.
204+ func (r * VSphereCluster ) GetV1Beta2Conditions () []metav1.Condition {
205+ if r .Status .V1Beta2 == nil {
206+ return nil
207+ }
208+ return r .Status .V1Beta2 .Conditions
209+ }
210+
211+ // SetV1Beta2Conditions sets conditions for an API object.
212+ func (r * VSphereCluster ) SetV1Beta2Conditions (conditions []metav1.Condition ) {
213+ if r .Status .V1Beta2 == nil {
214+ r .Status .V1Beta2 = & VSphereClusterV1Beta2Status {}
215+ }
216+ r .Status .V1Beta2 .Conditions = conditions
217+ }
218+
97219func init () {
98220 objectTypes = append (objectTypes , & VSphereCluster {}, & VSphereClusterList {})
99221}
0 commit comments