Skip to content

Commit

Permalink
feat: Change from upgradeAfter to rolloutAfter in v1beta2 api upgrade (
Browse files Browse the repository at this point in the history
…#116)

* feat: Change from upgradeAfter to rolloutAfter in v1beta2 api upgrade

Signed-off-by: Richard Draycott <[email protected]>

* feat: Fix comment wording

Signed-off-by: Richard Draycott <[email protected]>

* feat: Run make manifests

Signed-off-by: Richard Draycott <[email protected]>

---------

Signed-off-by: Richard Draycott <[email protected]>
  • Loading branch information
wikoion authored May 20, 2024
1 parent 7b104e6 commit ebf98fd
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 18 deletions.
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

0 comments on commit ebf98fd

Please sign in to comment.