Skip to content

Commit

Permalink
Implement v1beta2 condition interface
Browse files Browse the repository at this point in the history
  • Loading branch information
fabriziopandini committed Sep 30, 2024
1 parent cd29c09 commit b4cf95d
Show file tree
Hide file tree
Showing 14 changed files with 224 additions and 0 deletions.
16 changes: 16 additions & 0 deletions api/v1beta1/cluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,22 @@ func (c *Cluster) SetConditions(conditions Conditions) {
c.Status.Conditions = conditions
}

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

// SetV1Beta2Conditions sets conditions for an API object.
func (o *Cluster) SetV1Beta2Conditions(conditions []metav1.Condition) {
if o.Status.V1Beta2 == nil && conditions != nil {
o.Status.V1Beta2 = &ClusterV1Beta2Status{}
}
o.Status.V1Beta2.Conditions = conditions
}

// GetIPFamily returns a ClusterIPFamily from the configuration provided.
//
// Deprecated: IPFamily is not a concept in Kubernetes. It was originally introduced in CAPI for CAPD.
Expand Down
16 changes: 16 additions & 0 deletions api/v1beta1/clusterclass_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -961,6 +961,22 @@ func (c *ClusterClass) SetConditions(conditions Conditions) {
c.Status.Conditions = conditions
}

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

// SetV1Beta2Conditions sets conditions for an API object.
func (o *ClusterClass) SetV1Beta2Conditions(conditions []metav1.Condition) {
if o.Status.V1Beta2 == nil && conditions != nil {
o.Status.V1Beta2 = &ClusterClassV1Beta2Status{}
}
o.Status.V1Beta2.Conditions = conditions
}

// ANCHOR_END: ClusterClassStatus

// +kubebuilder:object:root=true
Expand Down
16 changes: 16 additions & 0 deletions api/v1beta1/machine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,22 @@ func (m *Machine) SetConditions(conditions Conditions) {
m.Status.Conditions = conditions
}

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

// SetV1Beta2Conditions sets conditions for an API object.
func (o *Machine) SetV1Beta2Conditions(conditions []metav1.Condition) {
if o.Status.V1Beta2 == nil && conditions != nil {
o.Status.V1Beta2 = &MachineV1Beta2Status{}
}
o.Status.V1Beta2.Conditions = conditions
}

// +kubebuilder:object:root=true

// MachineList contains a list of Machine.
Expand Down
16 changes: 16 additions & 0 deletions api/v1beta1/machinedeployment_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -415,3 +415,19 @@ func (m *MachineDeployment) GetConditions() Conditions {
func (m *MachineDeployment) SetConditions(conditions Conditions) {
m.Status.Conditions = conditions
}

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

// SetV1Beta2Conditions sets conditions for an API object.
func (o *MachineDeployment) SetV1Beta2Conditions(conditions []metav1.Condition) {
if o.Status.V1Beta2 == nil && conditions != nil {
o.Status.V1Beta2 = &MachineDeploymentV1Beta2Status{}
}
o.Status.V1Beta2.Conditions = conditions
}
16 changes: 16 additions & 0 deletions api/v1beta1/machinehealthcheck_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,22 @@ func (m *MachineHealthCheck) SetConditions(conditions Conditions) {
m.Status.Conditions = conditions
}

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

// SetV1Beta2Conditions sets conditions for an API object.
func (o *MachineHealthCheck) SetV1Beta2Conditions(conditions []metav1.Condition) {
if o.Status.V1Beta2 == nil && conditions != nil {
o.Status.V1Beta2 = &MachineHealthCheckV1Beta2Status{}
}
o.Status.V1Beta2.Conditions = conditions
}

// +kubebuilder:object:root=true

// MachineHealthCheckList contains a list of MachineHealthCheck.
Expand Down
16 changes: 16 additions & 0 deletions api/v1beta1/machineset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,22 @@ func (m *MachineSet) SetConditions(conditions Conditions) {
m.Status.Conditions = conditions
}

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

// SetV1Beta2Conditions sets conditions for an API object.
func (o *MachineSet) SetV1Beta2Conditions(conditions []metav1.Condition) {
if o.Status.V1Beta2 == nil && conditions != nil {
o.Status.V1Beta2 = &MachineSetV1Beta2Status{}
}
o.Status.V1Beta2.Conditions = conditions
}

// +kubebuilder:object:root=true

// MachineSetList contains a list of MachineSet.
Expand Down
16 changes: 16 additions & 0 deletions bootstrap/kubeadm/api/v1beta1/kubeadmconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,22 @@ func (c *KubeadmConfig) SetConditions(conditions clusterv1.Conditions) {
c.Status.Conditions = conditions
}

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

// SetV1Beta2Conditions sets conditions for an API object.
func (o *KubeadmConfig) SetV1Beta2Conditions(conditions []metav1.Condition) {
if o.Status.V1Beta2 == nil && conditions != nil {
o.Status.V1Beta2 = &KubeadmConfigV1Beta2Status{}
}
o.Status.V1Beta2.Conditions = conditions
}

// +kubebuilder:object:root=true

// KubeadmConfigList contains a list of KubeadmConfig.
Expand Down
16 changes: 16 additions & 0 deletions controlplane/kubeadm/api/v1beta1/kubeadm_control_plane_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,22 @@ func (in *KubeadmControlPlane) SetConditions(conditions clusterv1.Conditions) {
in.Status.Conditions = conditions
}

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

// SetV1Beta2Conditions sets conditions for an API object.
func (o *KubeadmControlPlane) SetV1Beta2Conditions(conditions []metav1.Condition) {
if o.Status.V1Beta2 == nil && conditions != nil {
o.Status.V1Beta2 = &KubeadmControlPlaneV1Beta2Status{}
}
o.Status.V1Beta2.Conditions = conditions
}

// +kubebuilder:object:root=true

// KubeadmControlPlaneList contains a list of KubeadmControlPlane.
Expand Down
16 changes: 16 additions & 0 deletions exp/addons/api/v1beta1/clusterresourceset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,22 @@ func (m *ClusterResourceSet) SetConditions(conditions clusterv1.Conditions) {
m.Status.Conditions = conditions
}

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

// SetV1Beta2Conditions sets conditions for an API object.
func (o *ClusterResourceSet) SetV1Beta2Conditions(conditions []metav1.Condition) {
if o.Status.V1Beta2 == nil && conditions != nil {
o.Status.V1Beta2 = &ClusterResourceSetV1Beta2Status{}
}
o.Status.V1Beta2.Conditions = conditions
}

// +kubebuilder:object:root=true
// +kubebuilder:resource:path=clusterresourcesets,scope=Namespaced,categories=cluster-api
// +kubebuilder:subresource:status
Expand Down
16 changes: 16 additions & 0 deletions exp/api/v1beta1/machinepool_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,22 @@ func (m *MachinePool) SetConditions(conditions clusterv1.Conditions) {
m.Status.Conditions = conditions
}

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

// SetV1Beta2Conditions sets conditions for an API object.
func (o *MachinePool) SetV1Beta2Conditions(conditions []metav1.Condition) {
if o.Status.V1Beta2 == nil && conditions != nil {
o.Status.V1Beta2 = &MachinePoolV1Beta2Status{}
}
o.Status.V1Beta2.Conditions = conditions
}

// +kubebuilder:object:root=true

// MachinePoolList contains a list of MachinePool.
Expand Down
16 changes: 16 additions & 0 deletions test/infrastructure/docker/api/v1beta1/dockercluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,22 @@ func (c *DockerCluster) SetConditions(conditions clusterv1.Conditions) {
c.Status.Conditions = conditions
}

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

// SetV1Beta2Conditions sets conditions for an API object.
func (o *DockerCluster) SetV1Beta2Conditions(conditions []metav1.Condition) {
if o.Status.V1Beta2 == nil && conditions != nil {
o.Status.V1Beta2 = &DockerClusterV1Beta2Status{}
}
o.Status.V1Beta2.Conditions = conditions
}

// +kubebuilder:object:root=true

// DockerClusterList contains a list of DockerCluster.
Expand Down
16 changes: 16 additions & 0 deletions test/infrastructure/docker/api/v1beta1/dockermachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,22 @@ func (c *DockerMachine) SetConditions(conditions clusterv1.Conditions) {
c.Status.Conditions = conditions
}

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

// SetV1Beta2Conditions sets conditions for an API object.
func (o *DockerMachine) SetV1Beta2Conditions(conditions []metav1.Condition) {
if o.Status.V1Beta2 == nil && conditions != nil {
o.Status.V1Beta2 = &DockerMachineV1Beta2Status{}
}
o.Status.V1Beta2.Conditions = conditions
}

// +kubebuilder:object:root=true

// DockerMachineList contains a list of DockerMachine.
Expand Down
16 changes: 16 additions & 0 deletions test/infrastructure/inmemory/api/v1alpha1/inmemorycluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,22 @@ func (c *InMemoryCluster) SetConditions(conditions clusterv1.Conditions) {
c.Status.Conditions = conditions
}

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

// SetV1Beta2Conditions sets conditions for an API object.
func (o *InMemoryCluster) SetV1Beta2Conditions(conditions []metav1.Condition) {
if o.Status.V1Beta2 == nil && conditions != nil {
o.Status.V1Beta2 = &InMemoryClusterV1Beta2Status{}
}
o.Status.V1Beta2.Conditions = conditions
}

// +kubebuilder:object:root=true

// InMemoryClusterList contains a list of InMemoryCluster.
Expand Down
16 changes: 16 additions & 0 deletions test/infrastructure/inmemory/api/v1alpha1/inmemorymachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,22 @@ func (c *InMemoryMachine) SetConditions(conditions clusterv1.Conditions) {
c.Status.Conditions = conditions
}

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

// SetV1Beta2Conditions sets conditions for an API object.
func (o *InMemoryMachine) SetV1Beta2Conditions(conditions []metav1.Condition) {
if o.Status.V1Beta2 == nil && conditions != nil {
o.Status.V1Beta2 = &InMemoryMachineV1Beta2Status{}
}
o.Status.V1Beta2.Conditions = conditions
}

// +kubebuilder:object:root=true

// InMemoryMachineList contains a list of InMemoryMachine.
Expand Down

0 comments on commit b4cf95d

Please sign in to comment.