Skip to content

Commit af5ef66

Browse files
authored
Adopt CAPI v2beta2 status changes and respective controller changes for IBMPowerVSCluster (#2312)
* Add v1beta2 changes to IBMPowerVSCluster * Controller changes for v1beta2 * Update test files to accomodate controller changes
1 parent 38fffdc commit af5ef66

11 files changed

+1398
-855
lines changed

api/v1beta1/zz_generated.conversion.go

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v1beta2/conditions_consts.go

+115
Original file line numberDiff line numberDiff line change
@@ -180,3 +180,118 @@ const (
180180
// Power VS infrastructure should be created as a part of cluster creation.
181181
CreateInfrastructureAnnotation = "powervs.cluster.x-k8s.io/create-infra"
182182
)
183+
184+
// IBMPowerVSCluster's Ready condition and corresponding reasons that will be used in v1Beta2 API version.
185+
const (
186+
// IBMPowerVSClusterReadyV1Beta2Condition is true if the IBMPowerVSCluster's deletionTimestamp is not set, IBMPowerVSCluster's
187+
// FailureDomainsReady, VCenterAvailable and ClusterModulesReady conditions are true.
188+
IBMPowerVSClusterReadyV1Beta2Condition = capiv1beta1.ReadyV1Beta2Condition
189+
190+
// IBMPowerVSClusterReadyV1Beta2Reason surfaces when the IBMPowerVSCluster readiness criteria is met.
191+
IBMPowerVSClusterReadyV1Beta2Reason = capiv1beta1.ReadyV1Beta2Reason
192+
193+
// IBMPowerVSClusterNotReadyV1Beta2Reason surfaces when the IBMPowerVSCluster readiness criteria is not met.
194+
IBMPowerVSClusterNotReadyV1Beta2Reason = capiv1beta1.NotReadyV1Beta2Reason
195+
196+
// IBMPowerVSClusterReadyUnknownV1Beta2Reason surfaces when at least one of the IBMPowerVSCluster readiness criteria is unknown
197+
// and none of the IBMPowerVSCluster readiness criteria is met.
198+
IBMPowerVSClusterReadyUnknownV1Beta2Reason = capiv1beta1.ReadyUnknownV1Beta2Reason
199+
)
200+
201+
const (
202+
// WorkspaceReadyV1Beta2Condition reports on the successful reconciliation of a PowerVS workspace.
203+
WorkspaceReadyV1Beta2Condition = "WorkspaceReady"
204+
205+
// WorkspaceReadyV1Beta2Reason surfaces when the PowerVS workspace is ready.
206+
WorkspaceReadyV1Beta2Reason = capiv1beta1.ReadyV1Beta2Reason
207+
208+
// WorkspaceNotReadyV1Beta2Reason surfaces when PowerVS workspace is not ready.
209+
WorkspaceNotReadyV1Beta2Reason = capiv1beta1.NotReadyV1Beta2Reason
210+
211+
// WorkspaceDeletingV1Beta2Reason surfaces when the PowerVS workspace is being deleted.
212+
WorkspaceDeletingV1Beta2Reason = capiv1beta1.DeletingV1Beta2Reason
213+
214+
// NetworkReadyV1Beta2Condition reports on the successful reconciliation of a PowerVS network.
215+
NetworkReadyV1Beta2Condition = "NetworkReady"
216+
217+
// NetworkReadyV1Beta2Reason surfaces when PowerVS workspace is ready.
218+
NetworkReadyV1Beta2Reason = capiv1beta1.ReadyV1Beta2Reason
219+
220+
// NetworkNotReadyV1Beta2Reason surfaces when the PowerVS network is not ready.
221+
NetworkNotReadyV1Beta2Reason = capiv1beta1.NotReadyV1Beta2Reason
222+
223+
// NetworkDeletingV1Beta2Reason surfaces when the PowerVS network is being deleted.
224+
NetworkDeletingV1Beta2Reason = capiv1beta1.DeletingV1Beta2Reason
225+
226+
// VPCReadyV1Beta2Condition reports on the successful reconciliation of a VPC.
227+
VPCReadyV1Beta2Condition = "VPCReady"
228+
229+
// VPCReadyV1Beta2Reason surfaces when the VPC is ready.
230+
VPCReadyV1Beta2Reason = capiv1beta1.ReadyV1Beta2Reason
231+
232+
// VPCNotReadyV1Beta2Reason surfaces when VPC is not ready.
233+
VPCNotReadyV1Beta2Reason = capiv1beta1.NotReadyV1Beta2Reason
234+
235+
// VPCDeletingV1Beta2Reason surfaces when the VPC is being deleted.
236+
VPCDeletingV1Beta2Reason = capiv1beta1.DeletingV1Beta2Reason
237+
238+
// VPCSubnetReadyV1Beta2Condition reports on the successful reconciliation of a VPC subnet.
239+
VPCSubnetReadyV1Beta2Condition = "VPCSubnetReady"
240+
241+
// VPCSubnetReadyV1Beta2Reason surfaces when the VPC subnet is ready.
242+
VPCSubnetReadyV1Beta2Reason = capiv1beta1.ReadyV1Beta2Reason
243+
244+
// VPCSubnetNotReadyV1Beta2Reason surfaces when VPC subnet is not ready.
245+
VPCSubnetNotReadyV1Beta2Reason = capiv1beta1.NotReadyV1Beta2Reason
246+
247+
// VPCSubnetDeletingV1Beta2Reason surfaces when the VPC subnet is being deleted.
248+
VPCSubnetDeletingV1Beta2Reason = capiv1beta1.DeletingV1Beta2Reason
249+
250+
// VPCSecurityGroupReadyV1Beta2Condition reports on the successful reconciliation of a VPC Security Group.
251+
VPCSecurityGroupReadyV1Beta2Condition = "VPCSecurityGroupReady"
252+
253+
// VPCSecurityGroupReadyV1Beta2Reason surfaces when the VPC security group is ready.
254+
VPCSecurityGroupReadyV1Beta2Reason = capiv1beta1.ReadyV1Beta2Reason
255+
256+
// VPCSecurityGroupNotReadyV1Beta2Reason surfaces when VPC security group is not ready.
257+
VPCSecurityGroupNotReadyV1Beta2Reason = capiv1beta1.NotReadyV1Beta2Reason
258+
259+
// VPCSecurityGroupDeletingV1Beta2Reason surfaces when the VPC security group is being deleted.
260+
VPCSecurityGroupDeletingV1Beta2Reason = capiv1beta1.DeletingV1Beta2Reason
261+
262+
// TransitGatewayReadyV1Beta2Condition reports on the successful reconciliation of a transit gateway.
263+
TransitGatewayReadyV1Beta2Condition = "TransitGatewayReady"
264+
265+
// TransitGatewayReadyV1Beta2Reason surfaces when the transit gateway is ready.
266+
TransitGatewayReadyV1Beta2Reason = capiv1beta1.ReadyV1Beta2Reason
267+
268+
// TransitGatewayNotReadyV1Beta2Reason surfaces when the transit gateway is not ready.
269+
TransitGatewayNotReadyV1Beta2Reason = capiv1beta1.NotReadyV1Beta2Reason
270+
271+
// TransitGatewayDeletingV1Beta2Reason surfaces when the transit gateway is being deleted.
272+
TransitGatewayDeletingV1Beta2Reason = capiv1beta1.DeletingV1Beta2Reason
273+
274+
// VPCLoadBalancerReadyV1Beta2Condition reports on the successful reconciliation of a VPC LoadBalancer.
275+
VPCLoadBalancerReadyV1Beta2Condition = "LoadBalancerReady"
276+
277+
// VPCLoadBalancerReadyV1Beta2Reason surfaces when the VPC LoadBalancer is ready.
278+
VPCLoadBalancerReadyV1Beta2Reason = capiv1beta1.ReadyV1Beta2Reason
279+
280+
// VPCLoadBalancerNotReadyV1Beta2Reason surfaces when VPC LoadBalancer is not ready.
281+
VPCLoadBalancerNotReadyV1Beta2Reason = capiv1beta1.NotReadyV1Beta2Reason
282+
283+
// VPCLoadBalancerDeletingV1Beta2Reason surfaces when the VPC LoadBalancer is being deleted.
284+
VPCLoadBalancerDeletingV1Beta2Reason = capiv1beta1.DeletingV1Beta2Reason
285+
286+
// COSInstanceReadyV1Beta2Condition reports on the successful reconciliation of a COS instance.
287+
COSInstanceReadyV1Beta2Condition = "COSInstanceReady"
288+
289+
// COSInstanceReadyV1Beta2Reason surfaces when the COS instance is ready.
290+
COSInstanceReadyV1Beta2Reason = capiv1beta1.ReadyV1Beta2Reason
291+
292+
// COSInstanceNotReadyV1Beta2Reason surfaces when the COS instance is not ready.
293+
COSInstanceNotReadyV1Beta2Reason = capiv1beta1.NotReadyV1Beta2Reason
294+
295+
// COSInstanceDeletingV1Beta2Reason surfaces when the COS instance is being deleted.
296+
COSInstanceDeletingV1Beta2Reason = capiv1beta1.DeletingV1Beta2Reason
297+
)

api/v1beta2/ibmpowervscluster_types.go

+31
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,21 @@ type IBMPowerVSClusterStatus struct {
232232

233233
// Conditions defines current service state of the IBMPowerVSCluster.
234234
Conditions capiv1beta1.Conditions `json:"conditions,omitempty"`
235+
236+
// v1beta2 groups all the fields that will be added or modified in IBMPowerVSCluster's status with the V1Beta2 version.
237+
// +optional
238+
V1Beta2 *IBMPowerVSClusterV1Beta2Status `json:"v1beta2,omitempty"`
239+
}
240+
241+
// IBMPowerVSClusterV1Beta2Status groups all the fields that will be added or modified in IBMPowerVSCluster with the V1Beta2 version.
242+
// See https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more context.
243+
type IBMPowerVSClusterV1Beta2Status struct {
244+
// conditions represents the observations of a DevCluster's current state.
245+
// +optional
246+
// +listType=map
247+
// +listMapKey=type
248+
// +kubebuilder:validation:MaxItems=32
249+
Conditions []metav1.Condition `json:"conditions,omitempty"`
235250
}
236251

237252
// +kubebuilder:object:root=true
@@ -329,6 +344,22 @@ func (r *IBMPowerVSCluster) SetConditions(conditions capiv1beta1.Conditions) {
329344
r.Status.Conditions = conditions
330345
}
331346

347+
// GetV1Beta2Conditions returns the set of conditions for this object.
348+
func (r *IBMPowerVSCluster) GetV1Beta2Conditions() []metav1.Condition {
349+
if r.Status.V1Beta2 == nil {
350+
return nil
351+
}
352+
return r.Status.V1Beta2.Conditions
353+
}
354+
355+
// SetV1Beta2Conditions sets conditions for an API object.
356+
func (r *IBMPowerVSCluster) SetV1Beta2Conditions(conditions []metav1.Condition) {
357+
if r.Status.V1Beta2 == nil {
358+
r.Status.V1Beta2 = &IBMPowerVSClusterV1Beta2Status{}
359+
}
360+
r.Status.V1Beta2.Conditions = conditions
361+
}
362+
332363
// Set sets the details of the resource.
333364
func (rf *ResourceReference) Set(resource ResourceReference) {
334365
rf.ID = resource.ID

api/v1beta2/zz_generated.deepcopy.go

+35-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)