Skip to content
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

feat: Change from upgradeAfter to rolloutAfter in v1beta2 api upgrade #116

Merged
merged 3 commits into from
May 20, 2024
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
4 changes: 2 additions & 2 deletions controlplane/api/v1beta1/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func Convert_v1beta1_KThreesControlPlaneSpec_To_v1beta2_KThreesControlPlaneSpec(
if err := Convert_v1beta1_KThreesConfigSpec_To_v1beta2_KThreesConfigSpec(&in.KThreesConfigSpec, &out.KThreesConfigSpec, s); err != nil {
return fmt.Errorf("converting KThreesConfigSpec field from v1beta1 to v1beta2: %w", err)
}
out.UpgradeAfter = in.UpgradeAfter
out.RolloutAfter = in.UpgradeAfter
if err := Convert_v1beta1_KThreesControlPlaneMachineTemplate_To_v1beta2_KThreesControlPlaneMachineTemplate(&in.MachineTemplate, &out.MachineTemplate, s); err != nil {
return fmt.Errorf("converting KThreesControlPlaneMachineTemplate field from v1beta1 to v1beta2: %w", err)
}
Expand All @@ -49,7 +49,7 @@ func Convert_v1beta2_KThreesControlPlaneSpec_To_v1beta1_KThreesControlPlaneSpec(
if err := Convert_v1beta2_KThreesConfigSpec_To_v1beta1_KThreesConfigSpec(&in.KThreesConfigSpec, &out.KThreesConfigSpec, s); err != nil {
return fmt.Errorf("converting KThreesConfigSpec field from v1beta2 to v1beta1: %w", err)
}
out.UpgradeAfter = in.UpgradeAfter
out.UpgradeAfter = in.RolloutAfter
out.NodeDrainTimeout = in.MachineTemplate.NodeDrainTimeout
if err := Convert_v1beta2_KThreesControlPlaneMachineTemplate_To_v1beta1_KThreesControlPlaneMachineTemplate(&in.MachineTemplate, &out.MachineTemplate, s); err != nil {
return fmt.Errorf("converting KThreesControlPlaneMachineTemplate field from v1beta2 to v1beta1: %w", err)
Expand Down
4 changes: 2 additions & 2 deletions controlplane/api/v1beta1/zz_generated.conversion.go

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

4 changes: 2 additions & 2 deletions controlplane/api/v1beta2/kthreescontrolplane_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ type KThreesControlPlaneSpec struct {
// +optional
KThreesConfigSpec bootstrapv1beta2.KThreesConfigSpec `json:"kthreesConfigSpec,omitempty"`

// UpgradeAfter is a field to indicate an upgrade should be performed
// RolloutAfter is a field to indicate a rollout should be performed
// after the specified time even if no changes have been made to the
// KThreesControlPlane
// +optional
UpgradeAfter *metav1.Time `json:"upgradeAfter,omitempty"`
RolloutAfter *metav1.Time `json:"rolloutAfter,omitempty"`

// MachineTemplate contains information about how machines should be shaped
// when creating or updating a control plane.
Expand Down
4 changes: 2 additions & 2 deletions controlplane/api/v1beta2/kthreescontrolplanetemplate_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ type KThreesControlPlaneTemplateResourceSpec struct {
// +optional
KThreesConfigSpec bootstrapv1beta2.KThreesConfigSpec `json:"kthreesConfigSpec,omitempty"`

// UpgradeAfter is a field to indicate an upgrade should be performed
// RolloutAfter is a field to indicate an rollout should be performed
// after the specified time even if no changes have been made to the
// KThreesControlPlane
// +optional
UpgradeAfter *metav1.Time `json:"upgradeAfter,omitempty"`
RolloutAfter *metav1.Time `json:"rolloutAfter,omitempty"`

// MachineTemplate contains information about how machines should be shaped
// when creating or updating a control plane.
Expand Down
8 changes: 4 additions & 4 deletions controlplane/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 @@ -957,9 +957,9 @@ spec:
This is a pointer to distinguish between explicit zero and not specified.
format: int32
type: integer
upgradeAfter:
rolloutAfter:
description: |-
UpgradeAfter is a field to indicate an upgrade should be performed
RolloutAfter is a field to indicate a rollout should be performed
after the specified time even if no changes have been made to the
KThreesControlPlane
format: date-time
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,9 +393,9 @@ spec:
If not set, a retry will happen immediately.
type: string
type: object
upgradeAfter:
rolloutAfter:
description: |-
UpgradeAfter is a field to indicate an upgrade should be performed
RolloutAfter is a field to indicate an rollout should be performed
after the specified time even if no changes have been made to the
KThreesControlPlane
format: date-time
Expand Down
4 changes: 2 additions & 2 deletions pkg/k3s/control_plane.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,8 @@ func (c *ControlPlane) MachinesNeedingRollout() collections.Machines {

// Return machines if they are scheduled for rollout or if with an outdated configuration.
return machines.AnyFilter(
// Machines that are scheduled for rollout (KCP.Spec.UpgradeAfter set, the UpgradeAfter deadline is expired, and the machine was created before the deadline).
collections.ShouldRolloutAfter(&c.reconciliationTime, c.KCP.Spec.UpgradeAfter),
// Machines that are scheduled for rollout (KCP.Spec.RolloutAfter set, the RolloutAfter deadline is expired, and the machine was created before the deadline).
collections.ShouldRolloutAfter(&c.reconciliationTime, c.KCP.Spec.RolloutAfter),
// Machines that do not match with KCP config.
collections.Not(machinefilters.MatchesKCPConfiguration(c.infraResources, c.kthreesConfigs, c.KCP)),
)
Expand Down
Loading