Skip to content
Open
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
9 changes: 9 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,15 @@ linters:
- linters:
- staticcheck
text: 'SA1019: "sigs.k8s.io/cluster-api/util/deprecated/v1beta1/conditions" is deprecated: This package is deprecated and is going to be removed when support for v1beta1 will be dropped. Please see https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more details.'
- linters:
- staticcheck
text: 'SA1019: .*.Status.Ready is deprecated: This field is deprecated and will be removed in a future API version. Use status.conditions to determine the ready state of the cluster.'
- linters:
- staticcheck
text: 'SA1019: .*.Status.FailureReason is deprecated: This field is deprecated and will be removed in a future API version. Use status.conditions to report failures.'
- linters:
- staticcheck
text: 'SA1019: .*.Status.FailureMessage is deprecated: This field is deprecated and will be removed in a future API version. Use status.conditions to report failures.'
paths:
- zz_generated.*\.go$
- third_party$
Expand Down
29 changes: 29 additions & 0 deletions api/v1beta1/conditions_consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,32 @@ const (
// UnableToFindFloatingIPNetworkReason is used when the floating ip network is not found.
UnableToFindFloatingIPNetworkReason = "UnableToFindFloatingIPNetwork"
)

const (
// NetworkReadyCondition reports on the current status of the cluster network infrastructure.
// Ready indicates that the network, subnets, and related resources have been successfully provisioned.
NetworkReadyCondition clusterv1beta1.ConditionType = "NetworkReady"

// RouterReadyCondition reports on the current status of the cluster router infrastructure.
// Ready indicates that the router and its interfaces have been successfully provisioned.
RouterReadyCondition clusterv1beta1.ConditionType = "RouterReady"

// SecurityGroupsReadyCondition reports on the current status of the cluster security groups.
// Ready indicates that all required security groups have been successfully provisioned.
SecurityGroupsReadyCondition clusterv1beta1.ConditionType = "SecurityGroupsReady"

// APIEndpointReadyCondition reports on the current status of the cluster API endpoint.
// Ready indicates that the control plane endpoint has been successfully configured.
APIEndpointReadyCondition clusterv1beta1.ConditionType = "APIEndpointReady"

// NetworkReconcileFailedReason is used when network reconciliation fails.
NetworkReconcileFailedReason = "NetworkCreateFailed"
// SubnetReconcileFailedReason is used when subnet reconciliation fails.
SubnetReconcileFailedReason = "SubnetCreateFailed"
// RouterReconcileFailedReason is used when router reconciliation fails.
RouterReconcileFailedReason = "RouterCreateFailed"
// SecurityGroupReconcileFailedReason is used when security group reconciliation fails.
SecurityGroupReconcileFailedReason = "SecurityGroupCreateFailed"
// APIEndpointConfigFailedReason is used when API endpoint configuration fails.
APIEndpointConfigFailedReason = "APIEndpointConfigFailed"
)
38 changes: 38 additions & 0 deletions api/v1beta1/openstackcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,27 @@ type OpenStackClusterSpec struct {
IdentityRef OpenStackIdentityReference `json:"identityRef"`
}

// ClusterInitialization represents the initialization status of the cluster.
type ClusterInitialization struct {
// Provisioned is set to true when the initial provisioning of the cluster infrastructure is completed.
// The value of this field is never updated after provisioning is completed.
// +optional
Provisioned bool `json:"provisioned,omitempty"`
}

// OpenStackClusterStatus defines the observed state of OpenStackCluster.
type OpenStackClusterStatus struct {
// Ready is true when the cluster infrastructure is ready.
//
// Deprecated: This field is deprecated and will be removed in a future API version.
// Use status.conditions to determine the ready state of the cluster.
// +kubebuilder:default=false
Ready bool `json:"ready"`

// Initialization contains information about the initialization status of the cluster.
// +optional
Initialization *ClusterInitialization `json:"initialization,omitempty"`

// Network contains information about the created OpenStack Network.
// +optional
Network *NetworkStatusWithSubnets `json:"network,omitempty"`
Expand Down Expand Up @@ -257,6 +272,9 @@ type OpenStackClusterStatus struct {
// Any transient errors that occur during the reconciliation of
// OpenStackClusters can be added as events to the OpenStackCluster object
// and/or logged in the controller's output.
//
// Deprecated: This field is deprecated and will be removed in a future API version.
// Use status.conditions to report failures.
// +optional
FailureReason *capoerrors.DeprecatedCAPIClusterStatusError `json:"failureReason,omitempty"`

Expand All @@ -276,8 +294,18 @@ type OpenStackClusterStatus struct {
// Any transient errors that occur during the reconciliation of
// OpenStackClusters can be added as events to the OpenStackCluster object
// and/or logged in the controller's output.
//
// Deprecated: This field is deprecated and will be removed in a future API version.
// Use status.conditions to report failures.
// +optional
FailureMessage *string `json:"failureMessage,omitempty"`

// Conditions defines current service state of the OpenStackCluster.
// This field surfaces into Cluster's status.conditions[InfrastructureReady] condition.
// The Ready condition must surface issues during the entire lifecycle of the OpenStackCluster
// (both during initial provisioning and after the initial provisioning is completed).
// +optional
Conditions clusterv1beta1.Conditions `json:"conditions,omitempty"`
}

// +genclient
Expand Down Expand Up @@ -344,6 +372,16 @@ type ManagedSecurityGroups struct {

var _ IdentityRefProvider = &OpenStackCluster{}

// GetConditions returns the observations of the operational state of the OpenStackCluster resource.
func (c *OpenStackCluster) GetConditions() clusterv1beta1.Conditions {
return c.Status.Conditions
}

// SetConditions sets the underlying service state of the OpenStackCluster to the predescribed clusterv1.Conditions.
func (c *OpenStackCluster) SetConditions(conditions clusterv1beta1.Conditions) {
c.Status.Conditions = conditions
}

// GetIdentifyRef returns the cluster's namespace and IdentityRef.
func (c *OpenStackCluster) GetIdentityRef() (*string, *OpenStackIdentityReference) {
return &c.Namespace, &c.Spec.IdentityRef
Expand Down
27 changes: 27 additions & 0 deletions api/v1beta1/zz_generated.deepcopy.go

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

49 changes: 45 additions & 4 deletions cmd/models-schema/zz_generated.openapi.go

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

Loading