Skip to content

Adopt v1beta2 conditions for IBM VPC Machine #2447

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions api/v1beta1/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions api/v1beta2/conditions_consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,35 @@ const (
IBMPowerVSMachineReadyUnknownV1Beta2Reason = clusterv1beta1.ReadyUnknownV1Beta2Reason
)

const (
// IBMVPCMachineReadyV1Beta2Condition is true if the IBMVPCMachine's deletionTimestamp is not set, IBMVPCMachine's
// IBMVPCMachineInstanceReadyV1Beta2Condition is true.
IBMVPCMachineReadyV1Beta2Condition = clusterv1beta1.ReadyV1Beta2Condition

// IBMVPCMachineReadyV1Beta2Reason surfaces when the IBMVPCMachine readiness criteria is met.
IBMVPCMachineReadyV1Beta2Reason = clusterv1beta1.ReadyV1Beta2Reason

// IBMVPCMachineNotReadyV1Beta2Reason surfaces when the IBMVPCMachine readiness criteria is not met.
IBMVPCMachineNotReadyV1Beta2Reason = clusterv1beta1.NotReadyV1Beta2Reason

// IBMVPCMachineReadyUnknownV1Beta2Reason surfaces when at least one IBMVPCMachine readiness criteria is unknown.
IBMVPCMachineReadyUnknownV1Beta2Reason = clusterv1beta1.ReadyUnknownV1Beta2Reason
)

// IBMVPCMachine's InstanceReady condition and corresponding reasons that will be used in v1Beta2 API version.
const (
// IBMVPCMachineInstanceReadyV1Beta2Condition documents the status of the instance that is controlled
// by the IBMVPCMachine.
IBMVPCMachineInstanceReadyV1Beta2Condition = "InstanceReady"

// IBMVPCMachineInstanceReadyV1Beta2Reason surfaces when the instance that is controlled
// by the IBMVPCMachine is ready.
IBMVPCMachineInstanceReadyV1Beta2Reason = "InstanceReady"

// IBMVPCMachineInstanceNotReadyV1Beta2Reason surfaces when the instance that is controlled
// by the IBMVPCMachine is not ready.
IBMVPCMachineInstanceNotReadyV1Beta2Reason = "InstanceNotReady"
)
const (
// IBMPowerVSMachineInstanceReadyV1Beta2Condition documents the status of the instance that is controlled
// by the IBMPowerVSMachine.
Expand Down Expand Up @@ -95,6 +124,9 @@ const (
// InstanceNotReadyReason used when the instance is in a not ready state.
InstanceNotReadyReason = "InstanceNotReady"

// InstanceDeletingReason is used when the instance is in deleting state.
InstanceDeletingReason = "InstanceDeleting"

// InstanceStateUnknownReason used when the instance is in a unknown state.
InstanceStateUnknownReason = "InstanceStateUnknown"
)
Expand Down
31 changes: 31 additions & 0 deletions api/v1beta2/ibmvpcmachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,21 @@ type IBMVPCMachineStatus struct {
// LoadBalancerPoolMembers is the status of IBM Cloud VPC Load Balancer Backend Pools the machine is a member.
// +optional
LoadBalancerPoolMembers []VPCLoadBalancerBackendPoolMember `json:"loadBalancerPoolMembers,omitempty"`

// V1beta2 groups all the fields that will be added or modified in IBMVPCMachine's status with the V1Beta2 version.
// +optional
V1Beta2 *IBMVPCMachineV1Beta2Status `json:"v1beta2,omitempty"`
}

// IBMVPCMachineV1Beta2Status groups all the fields that will be added or modified in IBMVPCMachineStatus with the V1Beta2 version.
// See https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more context.
type IBMVPCMachineV1Beta2Status struct {
// Conditions represents the observations of a IBMVPCMachine's current state.
// +optional
// +listType=map
// +listMapKey=type
// +kubebuilder:validation:MaxItems=32
Conditions []metav1.Condition `json:"conditions,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down Expand Up @@ -211,6 +226,22 @@ type IBMVPCMachineList struct {
Items []IBMVPCMachine `json:"items"`
}

// GetV1Beta2Conditions returns the set of conditions for IBMVPCMachine object.
func (r *IBMVPCMachine) GetV1Beta2Conditions() []metav1.Condition {
if r.Status.V1Beta2 == nil {
return nil
}
return r.Status.V1Beta2.Conditions
}

// SetV1Beta2Conditions sets conditions for IBMVPCMachine object.
func (r *IBMVPCMachine) SetV1Beta2Conditions(conditions []metav1.Condition) {
if r.Status.V1Beta2 == nil {
r.Status.V1Beta2 = &IBMVPCMachineV1Beta2Status{}
}
r.Status.V1Beta2.Conditions = conditions
}

func init() {
objectTypes = append(objectTypes, &IBMVPCMachine{}, &IBMVPCMachineList{})
}
27 changes: 27 additions & 0 deletions api/v1beta2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading