@@ -75,6 +75,66 @@ type SchedulingPolicy struct {
7575 TopologySpreadConstraints []corev1.TopologySpreadConstraint `json:"topologySpreadConstraints,omitempty"`
7676}
7777
78+ // InstanceSetUpdateStrategyType is a string enumeration type that enumerates
79+ // all possible update strategies for the InstanceSet controller.
80+ // +enum
81+ type InstanceSetUpdateStrategyType string
82+
83+ const (
84+ // RollingUpdateInstanceSetStrategyType indicates that update will be
85+ // applied to all Pods in the InstanceSet with respect to the InstanceSet
86+ // ordering constraints. When a scale operation is performed with this
87+ // strategy, new Pods will be created from the specification version indicated
88+ // by the InstanceSet's updateRevision.
89+ RollingUpdateInstanceSetStrategyType InstanceSetUpdateStrategyType = "RollingUpdate"
90+ // OnDeleteInstanceSetStrategyType triggers the legacy behavior. Version
91+ // tracking and ordered rolling restarts are disabled. Pods are recreated
92+ // when they are manually deleted. When a scale
93+ // operation is performed with this strategy, specification version indicated
94+ // by the InstanceSet's currentRevision.
95+ OnDeleteInstanceSetStrategyType InstanceSetUpdateStrategyType = "OnDelete"
96+ )
97+
98+ // InstanceUpdateStrategy indicates the strategy that the InstanceSet
99+ // controller will use to perform updates. It includes any additional parameters
100+ // necessary to perform the update for the indicated strategy.
101+ type InstanceUpdateStrategy struct {
102+ // Type indicates the type of the InstanceUpdateStrategy.
103+ // Default is RollingUpdate.
104+ // +optional
105+ Type InstanceSetUpdateStrategyType `json:"type,omitempty"`
106+ // RollingUpdate is used to communicate parameters when Type is RollingUpdateStatefulSetStrategyType.
107+ // +optional
108+ RollingUpdate * RollingUpdateStrategy `json:"rollingUpdate,omitempty"`
109+ // Members(Pods) update strategy.
110+ //
111+ // - serial: update Members one by one that guarantee minimum component unavailable time.
112+ // - bestEffortParallel: update Members in parallel that guarantee minimum component un-writable time.
113+ // - parallel: force parallel
114+ //
115+ // +kubebuilder:validation:Enum={Serial,BestEffortParallel,Parallel}
116+ // +optional
117+ MemberUpdateStrategy * MemberUpdateStrategy `json:"memberUpdateStrategy,omitempty"`
118+ }
119+
120+ // RollingUpdateStrategy is used to communicate parameter for RollingUpdateInstanceSetStrategyType.
121+ type RollingUpdateStrategy struct {
122+ // Partition indicates the ordinal at which the InstanceSet should be partitioned
123+ // for updates. During a rolling update, all pods from ordinal Replicas-1 to
124+ // Partition are updated. All pods from ordinal Partition-1 to 0 remain untouched.
125+ // This is helpful in being able to do a canary based deployment. The default value is 0.
126+ // +optional
127+ Partition * int32 `json:"partition,omitempty"`
128+ // The maximum number of pods that can be unavailable during the update.
129+ // Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%).
130+ // Absolute number is calculated from percentage by rounding up. This can not be 0.
131+ // Defaults to 1. The field applies to all pods in the range 0 to Replicas-1.
132+ // That means if there is any unavailable pod in the range 0 to Replicas-1,
133+ // it will be counted towards MaxUnavailable.
134+ // +optional
135+ MaxUnavailable * intstr.IntOrString `json:"maxUnavailable,omitempty"`
136+ }
137+
78138// Range represents a range with a start and an end value.
79139// It is used to define a continuous segment.
80140type Range struct {
@@ -326,10 +386,10 @@ type InstanceSetSpec struct {
326386 // Indicates the StatefulSetUpdateStrategy that will be
327387 // employed to update Pods in the InstanceSet when a revision is made to
328388 // Template.
329- // UpdateStrategy.Type will be set to appsv1.OnDeleteStatefulSetStrategyType if MemberUpdateStrategy is not nil
389+ // UpdateStrategy.Type will be set to OnDeleteInstanceSetStrategyType if UpdateStrategy. MemberUpdateStrategy is not nil
330390 //
331391 // Note: This field will be removed in future version.
332- UpdateStrategy appsv1. StatefulSetUpdateStrategy `json:"updateStrategy,omitempty"`
392+ UpdateStrategy InstanceUpdateStrategy `json:"updateStrategy,omitempty"`
333393
334394 // A list of roles defined in the system.
335395 //
@@ -346,16 +406,6 @@ type InstanceSetSpec struct {
346406 // +optional
347407 MembershipReconfiguration * MembershipReconfiguration `json:"membershipReconfiguration,omitempty"`
348408
349- // Members(Pods) update strategy.
350- //
351- // - serial: update Members one by one that guarantee minimum component unavailable time.
352- // - bestEffortParallel: update Members in parallel that guarantee minimum component un-writable time.
353- // - parallel: force parallel
354- //
355- // +kubebuilder:validation:Enum={Serial,BestEffortParallel,Parallel}
356- // +optional
357- MemberUpdateStrategy * MemberUpdateStrategy `json:"memberUpdateStrategy,omitempty"`
358-
359409 // Indicates that the InstanceSet is paused, meaning the reconciliation of this InstanceSet object will be paused.
360410 // +optional
361411 Paused bool `json:"paused,omitempty"`
0 commit comments