Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion bootstrap/api/v1beta1/condition_consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
package v1beta1

import (
clusterv1beta1 "sigs.k8s.io/cluster-api/api/core/v1beta1" // nolint:staticcheck
clusterv1beta1 "sigs.k8s.io/cluster-api/api/core/v1beta2"
)

const (
Expand Down
25 changes: 2 additions & 23 deletions bootstrap/api/v1beta1/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,27 +165,13 @@ func Convert_v1beta1_RKE2ConfigStatus_To_v1beta2_RKE2ConfigStatus(in *RKE2Config
}

// Reset conditions from autogenerated conversions
// NOTE: v1beta1 conditions should not be automatically be converted into v1beta2 conditions.
out.Conditions = nil

// Retrieve new conditions (v1beta2) from the v1beta2 field.
if in.V1Beta2 != nil {
out.Conditions = in.V1Beta2.Conditions
}

// Move legacy conditions (v1beta1), failureReason and failureMessage to the deprecated field.
if out.Deprecated == nil {
out.Deprecated = &bootstrapv1.RKE2ConfigDeprecatedStatus{}
}
if out.Deprecated.V1Beta1 == nil {
out.Deprecated.V1Beta1 = &bootstrapv1.RKE2ConfigV1Beta1DeprecatedStatus{}
}
if in.Conditions != nil {
clusterv1beta1.Convert_v1beta1_Conditions_To_v1beta2_Deprecated_V1Beta1_Conditions(&in.Conditions, &out.Deprecated.V1Beta1.Conditions)
}
out.Deprecated.V1Beta1.FailureReason = in.FailureReason
out.Deprecated.V1Beta1.FailureMessage = in.FailureMessage

return nil
}

Expand All @@ -196,17 +182,10 @@ func Convert_v1beta2_RKE2ConfigStatus_To_v1beta1_RKE2ConfigStatus(in *bootstrapv
}

// Reset conditions from autogenerated conversions
// NOTE: v1beta2 conditions should not be automatically be converted into legacy conditions (v1beta1).
out.Conditions = nil

// Retrieve legacy conditions (v1beta1), failureReason and failureMessage from the deprecated field.
if in.Deprecated != nil && in.Deprecated.V1Beta1 != nil {
if in.Deprecated.V1Beta1.Conditions != nil {
clusterv1beta1.Convert_v1beta2_Deprecated_V1Beta1_Conditions_To_v1beta1_Conditions(&in.Deprecated.V1Beta1.Conditions, &out.Conditions)
}
out.FailureReason = in.Deprecated.V1Beta1.FailureReason
out.FailureMessage = in.Deprecated.V1Beta1.FailureMessage
}
// v1beta1 conditions are no longer stored in v1beta2, so out.Conditions stays empty on down-conversion.
// FailureReason and FailureMessage are also dropped.

// Move initialization to old fields
out.Ready = ptr.Deref(in.Initialization.DataSecretCreated, false)
Expand Down
1 change: 0 additions & 1 deletion bootstrap/api/v1beta1/zz_generated.conversion.go

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

63 changes: 0 additions & 63 deletions bootstrap/api/v1beta2/rke2config_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ package v1beta2
import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2"
)

// Format specifies the output format of the bootstrap data
Expand Down Expand Up @@ -226,10 +224,6 @@ type RKE2ConfigStatus struct {
// ObservedGeneration is the latest generation observed by the controller.
//+optional
ObservedGeneration int64 `json:"observedGeneration,omitempty"`

// deprecated groups all the status fields that are deprecated and will be removed when all the nested field are removed.
// +optional
Deprecated *RKE2ConfigDeprecatedStatus `json:"deprecated,omitempty"`
}

// RKE2ConfigInitializationStatus provides observations of the RKE2Config initialization process.
Expand All @@ -241,41 +235,6 @@ type RKE2ConfigInitializationStatus struct {
DataSecretCreated *bool `json:"dataSecretCreated,omitempty"`
}

// RKE2ConfigDeprecatedStatus groups all the status fields that are deprecated and will be removed in a future version.
type RKE2ConfigDeprecatedStatus struct {
// v1beta1 groups all the status fields that are deprecated and will be removed when support for v1beta1 is dropped.
// +optional
V1Beta1 *RKE2ConfigV1Beta1DeprecatedStatus `json:"v1beta1,omitempty"`
}

// RKE2ConfigV1Beta1DeprecatedStatus groups all the status fields that are deprecated and will be removed when support for v1beta1 is dropped.
type RKE2ConfigV1Beta1DeprecatedStatus struct {
// conditions defines current service state of the RKE2Config.
//
// Deprecated: This field is deprecated and is going to be removed when support for v1beta1 is dropped.
//
// +optional
Conditions clusterv1.Conditions `json:"conditions,omitempty"`

// failureReason will be set on non-retryable errors
//
// Deprecated: This field is deprecated and is going to be removed when support for v1beta1 is dropped.
//
// +optional
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=256
FailureReason string `json:"failureReason,omitempty"`

// failureMessage will be set on non-retryable errors
//
// Deprecated: This field is deprecated and is going to be removed when support for v1beta1 is dropped.
//
// +optional
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=10240
FailureMessage string `json:"failureMessage,omitempty"`
}

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:storageversion
Expand Down Expand Up @@ -303,28 +262,6 @@ func (r *RKE2Config) SetConditions(conditions []metav1.Condition) {
r.Status.Conditions = conditions
}

// GetV1Beta1Conditions returns the set of conditions for this object.
func (r *RKE2Config) GetV1Beta1Conditions() clusterv1.Conditions {
if r.Status.Deprecated == nil || r.Status.Deprecated.V1Beta1 == nil {
return nil
}

return r.Status.Deprecated.V1Beta1.Conditions
}

// SetV1Beta1Conditions sets the conditions on this object.
func (r *RKE2Config) SetV1Beta1Conditions(conditions clusterv1.Conditions) {
if r.Status.Deprecated == nil {
r.Status.Deprecated = &RKE2ConfigDeprecatedStatus{}
}

if r.Status.Deprecated.V1Beta1 == nil {
r.Status.Deprecated.V1Beta1 = &RKE2ConfigV1Beta1DeprecatedStatus{}
}

r.Status.Deprecated.V1Beta1.Conditions = conditions
}

// +kubebuilder:object:root=true

// RKE2ConfigList contains a list of RKE2Config.
Expand Down
48 changes: 0 additions & 48 deletions bootstrap/api/v1beta2/zz_generated.deepcopy.go

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

Original file line number Diff line number Diff line change
Expand Up @@ -1305,88 +1305,6 @@ spec:
description: DataSecretName is the name of the secret that stores
the bootstrap data script.
type: string
deprecated:
description: deprecated groups all the status fields that are deprecated
and will be removed when all the nested field are removed.
properties:
v1beta1:
description: v1beta1 groups all the status fields that are deprecated
and will be removed when support for v1beta1 is dropped.
properties:
conditions:
description: |-
conditions defines current service state of the RKE2Config.

Deprecated: This field is deprecated and is going to be removed when support for v1beta1 is dropped.
items:
description: Condition defines an observation of a Cluster
API resource operational state.
properties:
lastTransitionTime:
description: |-
lastTransitionTime is the last time the condition transitioned from one status to another.
This should be when the underlying condition changed. If that is not known, then using the time when
the API field changed is acceptable.
format: date-time
type: string
message:
description: |-
message is a human readable message indicating details about the transition.
This field may be empty.
maxLength: 10240
minLength: 1
type: string
reason:
description: |-
reason is the reason for the condition's last transition in CamelCase.
The specific API may choose whether or not this field is considered a guaranteed API.
This field may be empty.
maxLength: 256
minLength: 1
type: string
severity:
description: |-
severity provides an explicit classification of Reason code, so the users or machines can immediately
understand the current situation and act accordingly.
The Severity field MUST be set only when Status=False.
maxLength: 32
type: string
status:
description: status of the condition, one of True, False,
Unknown.
type: string
type:
description: |-
type of condition in CamelCase or in foo.example.com/CamelCase.
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions
can be useful (see .node.status.conditions), the ability to deconflict is important.
maxLength: 256
minLength: 1
type: string
required:
- lastTransitionTime
- status
- type
type: object
type: array
failureMessage:
description: |-
failureMessage will be set on non-retryable errors

Deprecated: This field is deprecated and is going to be removed when support for v1beta1 is dropped.
maxLength: 10240
minLength: 1
type: string
failureReason:
description: |-
failureReason will be set on non-retryable errors

Deprecated: This field is deprecated and is going to be removed when support for v1beta1 is dropped.
maxLength: 256
minLength: 1
type: string
type: object
type: object
initialization:
description: |-
initialization provides observations of the RKE2Config initialization process.
Expand Down
Loading
Loading