@@ -18,11 +18,19 @@ const (
1818 UpgradeJobConditionUpgradeCompleted = "UpgradeCompleted"
1919 // UpgradeJobConditionPostHealthCheckDone is the condition type for a post health check done upgrade job
2020 UpgradeJobConditionPostHealthCheckDone = "PostHealthCheckDone"
21+ // UpgradeJobConditionPaused is the condition type for a paused upgrade job.
22+ // A upgrade job can be paused if `.spec.machineConfigPools` matches a pool and `delayUpgrade` is set.
23+ UpgradeJobConditionPaused = "Paused"
24+ // UpgradeJobConditionMachineConfigPoolsPaused is true if the controller paused any machine config pools.
25+ // Does not correlate with any upgrade specific condition.
26+ UpgradeJobConditionMachineConfigPoolsPaused = "MachineConfigPoolsPaused"
2127
2228 // UpgradeJobReasonFailed is the generic reason for a failed upgrade job
2329 UpgradeJobReasonFailed = "Failed"
2430 // UpgradeJobReasonExpired is used when the upgrade job is not started before the startBefore time
2531 UpgradeJobReasonExpired = "Expired"
32+ // UpgradeJobReasonUnpausingPoolsExpired is used when the upgrade job was not able to unpause the machine config pools before the delayMax time
33+ UpgradeJobReasonUnpausingPoolsExpired = "UnpausingPoolsExpired"
2634 // UpgradeJobReasonTimedOut is used when the upgrade job is not completed before the upgradeTimeout time
2735 UpgradeJobReasonTimedOut = "TimedOut"
2836 // UpgradeJobReasonPreHealthCheckFailed is used when the health check failed
@@ -41,6 +49,10 @@ const (
4149 UpgradeJobReasonCompleted = "Completed"
4250 // UpgradeJobReasonInProgress is used when the pre health check was done
4351 UpgradeJobReasonInProgress = "InProgress"
52+ // UpgradeJobReasonNoManagedPools is used when no machine config pools are managed by the upgrade job
53+ UpgradeJobReasonNoManagedPools = "NoManagedPools"
54+ // UpgradeJobReasonDelaySet is used if the upgrade job paused machine config pools due to delayUpgrade
55+ UpgradeJobReasonDelaySet = "DelaySet"
4456)
4557
4658// UpgradeJobSpec defines the desired state of UpgradeJob
@@ -62,7 +74,8 @@ type UpgradeJobSpec struct {
6274
6375// UpgradeJobConfig defines the configuration for the upgrade job
6476type UpgradeJobConfig struct {
65- // UpgradeTimeout defines the timeout after which the upgrade is considered failed
77+ // UpgradeTimeout defines the timeout after which the upgrade is considered failed.
78+ // Relative to the `.spec.startAfter` timestamp of the upgrade job.
6679 // +kubebuilder:validation:Type=string
6780 // +kubebuilder:validation:Format=duration
6881 // +kubebuilder:default:="12h"
@@ -72,6 +85,36 @@ type UpgradeJobConfig struct {
7285 PreUpgradeHealthChecks UpgradeJobHealthCheck `json:"preUpgradeHealthChecks"`
7386 // PostUpgradeHealthChecks defines the health checks to be performed after the upgrade
7487 PostUpgradeHealthChecks UpgradeJobHealthCheck `json:"postUpgradeHealthChecks"`
88+
89+ // MachineConfigPools defines the machine config pool specific configuration for the upgrade job
90+ // +optional
91+ MachineConfigPools []UpgradeJobMachineConfigPoolSpec `json:"machineConfigPools,omitempty"`
92+ }
93+
94+ // UpgradeJobMachineConfigPoolSpec allows configuring the upgrade of a machine config pool
95+ type UpgradeJobMachineConfigPoolSpec struct {
96+ // MatchLabels defines the labels to match the machine config pool.
97+ // If empty, all machine config pools are matched.
98+ // If nil, no machine config pools are matched.
99+ // +optional
100+ MatchLabels * metav1.LabelSelector `json:"matchLabels,omitempty"`
101+
102+ // DelayUpgrade defines whether to delay the upgrade of the machine config pool
103+ // +optional
104+ DelayUpgrade UpgradeJobMachineConfigPoolDelayUpgradeSpec `json:"delayUpgrade,omitempty"`
105+ }
106+
107+ // UpgradeJobMachineConfigPoolDelayUpgradeSpec defines the delay for the upgrade of a machine config pool
108+ type UpgradeJobMachineConfigPoolDelayUpgradeSpec struct {
109+ // DelayMin defines the delay after which the upgrade of the machine config pool should start.
110+ // Relative to the `.spec.startAfter` timestamp of the upgrade job.
111+ // +optional
112+ DelayMin metav1.Duration `json:"delayMin,omitempty"`
113+ // DelayMax defines the maximum delay after which the upgrade of the machine config pool should start.
114+ // Relative to the `.spec.startBefore` timestamp of the upgrade job.
115+ // If the upgrade of the machine config pool can't be started before this time, it is considered failed.
116+ // +optional
117+ DelayMax metav1.Duration `json:"delayMax,omitempty"`
75118}
76119
77120// UpgradeJobHealthCheck defines the health checks to be performed
0 commit comments