diff --git a/apis/apps/v1/cluster_types.go b/apis/apps/v1/cluster_types.go index 5074b278783..68b4c0d10ff 100644 --- a/apis/apps/v1/cluster_types.go +++ b/apis/apps/v1/cluster_types.go @@ -438,6 +438,11 @@ type ClusterComponentSpec struct { // +optional PodUpdatePolicy *PodUpdatePolicyType `json:"podUpdatePolicy,omitempty"` + // Provides fine-grained control over the spec update process of all instances. + // + // +optional + InstanceUpdateStrategy *InstanceUpdateStrategy `json:"instanceUpdateStrategy,omitempty"` + // Allows for the customization of configuration values for each instance within a Component. // An instance represent a single replica (Pod and associated K8s resources like PVCs, Services, and ConfigMaps). // While instances typically share a common configuration as defined in the ClusterComponentSpec, diff --git a/apis/apps/v1/component_types.go b/apis/apps/v1/component_types.go index fdf3e5af9a4..ea8df5c6ce9 100644 --- a/apis/apps/v1/component_types.go +++ b/apis/apps/v1/component_types.go @@ -212,6 +212,11 @@ type ComponentSpec struct { // +optional PodUpdatePolicy *PodUpdatePolicyType `json:"podUpdatePolicy,omitempty"` + // Provides fine-grained control over the spec update process of all instances. + // + // +optional + InstanceUpdateStrategy *InstanceUpdateStrategy `json:"instanceUpdateStrategy,omitempty"` + // Specifies the scheduling policy for the Component. // // +optional diff --git a/apis/apps/v1/types.go b/apis/apps/v1/types.go index 0ad03156a19..01190966d94 100644 --- a/apis/apps/v1/types.go +++ b/apis/apps/v1/types.go @@ -18,6 +18,7 @@ package v1 import ( corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/util/intstr" ) const ( @@ -526,6 +527,59 @@ const ( PreferInPlacePodUpdatePolicyType PodUpdatePolicyType = "PreferInPlace" ) +// InstanceUpdateStrategy defines fine-grained control over the spec update process of all instances. +type InstanceUpdateStrategy struct { + // Indicates the type of the update strategy. + // Default is RollingUpdate. + // + // +optional + Type InstanceUpdateStrategyType `json:"type,omitempty"` + + // Specifies how the rolling update should be applied. + // + // +optional + RollingUpdate *RollingUpdate `json:"rollingUpdate,omitempty"` +} + +// InstanceUpdateStrategyType is a string enumeration type that enumerates +// all possible update strategies for the KubeBlocks controllers. +// +// +enum +// +kubebuilder:validation:Enum={RollingUpdate,OnDelete} +type InstanceUpdateStrategyType string + +const ( + // RollingUpdateStrategyType indicates that update will be + // applied to all Instances with respect to the workload + // ordering constraints. + RollingUpdateStrategyType InstanceUpdateStrategyType = "RollingUpdate" + // OnDeleteStrategyType indicates that ordered rolling restarts are disabled. Instances are recreated + // when they are manually deleted. + OnDeleteStrategyType InstanceUpdateStrategyType = "OnDelete" +) + +// RollingUpdate specifies how the rolling update should be applied. +type RollingUpdate struct { + // Indicates the number of instances that should be updated during a rolling update. + // The remaining instances will remain untouched. This is helpful in defining how many instances + // should participate in the update process. + // Value can be an absolute number (ex: 5) or a percentage of desired instances (ex: 10%). + // Absolute number is calculated from percentage by rounding up. + // The default value is ComponentSpec.Replicas (i.e., update all instances). + // + // +optional + Replicas *intstr.IntOrString `json:"replicas,omitempty"` + + // The maximum number of instances that can be unavailable during the update. + // Value can be an absolute number (ex: 5) or a percentage of desired instances (ex: 10%). + // Absolute number is calculated from percentage by rounding up. This can not be 0. + // Defaults to 1. The field applies to all instances. That means if there is any unavailable pod, + // it will be counted towards MaxUnavailable. + // + // +optional + MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty"` +} + type SchedulingPolicy struct { // If specified, the Pod will be dispatched by specified scheduler. // If not specified, the Pod will be dispatched by default scheduler. diff --git a/apis/apps/v1/zz_generated.deepcopy.go b/apis/apps/v1/zz_generated.deepcopy.go index a8ca3cf4d73..b3ef440bc1c 100644 --- a/apis/apps/v1/zz_generated.deepcopy.go +++ b/apis/apps/v1/zz_generated.deepcopy.go @@ -351,6 +351,11 @@ func (in *ClusterComponentSpec) DeepCopyInto(out *ClusterComponentSpec) { *out = new(PodUpdatePolicyType) **out = **in } + if in.InstanceUpdateStrategy != nil { + in, out := &in.InstanceUpdateStrategy, &out.InstanceUpdateStrategy + *out = new(InstanceUpdateStrategy) + (*in).DeepCopyInto(*out) + } if in.Instances != nil { in, out := &in.Instances, &out.Instances *out = make([]InstanceTemplate, len(*in)) @@ -1537,6 +1542,11 @@ func (in *ComponentSpec) DeepCopyInto(out *ComponentSpec) { *out = new(PodUpdatePolicyType) **out = **in } + if in.InstanceUpdateStrategy != nil { + in, out := &in.InstanceUpdateStrategy, &out.InstanceUpdateStrategy + *out = new(InstanceUpdateStrategy) + (*in).DeepCopyInto(*out) + } if in.SchedulingPolicy != nil { in, out := &in.SchedulingPolicy, &out.SchedulingPolicy *out = new(SchedulingPolicy) @@ -2227,6 +2237,26 @@ func (in *InstanceTemplate) DeepCopy() *InstanceTemplate { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InstanceUpdateStrategy) DeepCopyInto(out *InstanceUpdateStrategy) { + *out = *in + if in.RollingUpdate != nil { + in, out := &in.RollingUpdate, &out.RollingUpdate + *out = new(RollingUpdate) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceUpdateStrategy. +func (in *InstanceUpdateStrategy) DeepCopy() *InstanceUpdateStrategy { + if in == nil { + return nil + } + out := new(InstanceUpdateStrategy) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Issuer) DeepCopyInto(out *Issuer) { *out = *in @@ -2534,6 +2564,31 @@ func (in *RoledVar) DeepCopy() *RoledVar { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RollingUpdate) DeepCopyInto(out *RollingUpdate) { + *out = *in + if in.Replicas != nil { + in, out := &in.Replicas, &out.Replicas + *out = new(intstr.IntOrString) + **out = **in + } + if in.MaxUnavailable != nil { + in, out := &in.MaxUnavailable, &out.MaxUnavailable + *out = new(intstr.IntOrString) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RollingUpdate. +func (in *RollingUpdate) DeepCopy() *RollingUpdate { + if in == nil { + return nil + } + out := new(RollingUpdate) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SchedulingPolicy) DeepCopyInto(out *SchedulingPolicy) { *out = *in diff --git a/apis/workloads/v1/instanceset_types.go b/apis/workloads/v1/instanceset_types.go index b041b4bd71a..e3913468edb 100644 --- a/apis/workloads/v1/instanceset_types.go +++ b/apis/workloads/v1/instanceset_types.go @@ -184,13 +184,20 @@ type InstanceSetSpec struct { // +optional PodUpdatePolicy PodUpdatePolicyType `json:"podUpdatePolicy,omitempty"` - // Indicates the StatefulSetUpdateStrategy that will be - // employed to update Pods in the InstanceSet when a revision is made to - // Template. - // UpdateStrategy.Type will be set to appsv1.OnDeleteStatefulSetStrategyType if MemberUpdateStrategy is not nil + // Provides fine-grained control over the spec update process of all instances. // - // Note: This field will be removed in future version. - UpdateStrategy appsv1.StatefulSetUpdateStrategy `json:"updateStrategy,omitempty"` + // +optional + InstanceUpdateStrategy *InstanceUpdateStrategy `json:"instanceUpdateStrategy,omitempty"` + + // Members(Pods) update strategy. + // + // - serial: update Members one by one that guarantee minimum component unavailable time. + // - parallel: force parallel + // - bestEffortParallel: update Members in parallel that guarantee minimum component un-writable time. + // + // +kubebuilder:validation:Enum={Serial,Parallel,BestEffortParallel} + // +optional + MemberUpdateStrategy *MemberUpdateStrategy `json:"memberUpdateStrategy,omitempty"` // A list of roles defined in the system. Instanceset obtains role through pods' role label `kubeblocks.io/role`. // @@ -207,16 +214,6 @@ type InstanceSetSpec struct { // +optional TemplateVars map[string]string `json:"templateVars,omitempty"` - // Members(Pods) update strategy. - // - // - serial: update Members one by one that guarantee minimum component unavailable time. - // - bestEffortParallel: update Members in parallel that guarantee minimum component un-writable time. - // - parallel: force parallel - // - // +kubebuilder:validation:Enum={Serial,BestEffortParallel,Parallel} - // +optional - MemberUpdateStrategy *MemberUpdateStrategy `json:"memberUpdateStrategy,omitempty"` - // Indicates that the InstanceSet is paused, meaning the reconciliation of this InstanceSet object will be paused. // +optional Paused bool `json:"paused,omitempty"` @@ -308,16 +305,29 @@ type InstanceSetStatus struct { // +kubebuilder:object:generate=false type InstanceTemplate = kbappsv1.InstanceTemplate -type PodUpdatePolicyType string +// PodUpdatePolicyType indicates how pods should be updated +// +// +kubebuilder:object:generate=false +type PodUpdatePolicyType = kbappsv1.PodUpdatePolicyType -const ( - // StrictInPlacePodUpdatePolicyType indicates that only allows in-place upgrades. - // Any attempt to modify other fields will be rejected. - StrictInPlacePodUpdatePolicyType PodUpdatePolicyType = "StrictInPlace" +// InstanceUpdateStrategy defines fine-grained control over the spec update process of all instances. +// +// +kubebuilder:object:generate=false +type InstanceUpdateStrategy = kbappsv1.InstanceUpdateStrategy - // PreferInPlacePodUpdatePolicyType indicates that we will first attempt an in-place upgrade of the Pod. - // If that fails, it will fall back to the ReCreate, where pod will be recreated. - PreferInPlacePodUpdatePolicyType PodUpdatePolicyType = "PreferInPlace" +// RollingUpdate specifies how the rolling update should be applied. +// +// +kubebuilder:object:generate=false +type RollingUpdate = kbappsv1.RollingUpdate + +// MemberUpdateStrategy defines Cluster Component update strategy. +// +enum +type MemberUpdateStrategy string + +const ( + SerialUpdateStrategy MemberUpdateStrategy = "Serial" + ParallelUpdateStrategy MemberUpdateStrategy = "Parallel" + BestEffortParallelUpdateStrategy MemberUpdateStrategy = "BestEffortParallel" ) // ReplicaRole represents a role that can be assigned to a component instance, defining its behavior and responsibilities. @@ -404,16 +414,6 @@ type MembershipReconfiguration struct { Switchover *kbappsv1.Action `json:"switchover,omitempty"` } -// MemberUpdateStrategy defines Cluster Component update strategy. -// +enum -type MemberUpdateStrategy string - -const ( - SerialUpdateStrategy MemberUpdateStrategy = "Serial" - BestEffortParallelUpdateStrategy MemberUpdateStrategy = "BestEffortParallel" - ParallelUpdateStrategy MemberUpdateStrategy = "Parallel" -) - type MemberStatus struct { // Represents the name of the pod. // diff --git a/apis/workloads/v1/zz_generated.deepcopy.go b/apis/workloads/v1/zz_generated.deepcopy.go index 60f81300d75..1d265941b5c 100644 --- a/apis/workloads/v1/zz_generated.deepcopy.go +++ b/apis/workloads/v1/zz_generated.deepcopy.go @@ -154,7 +154,16 @@ func (in *InstanceSetSpec) DeepCopyInto(out *InstanceSetSpec) { *out = new(intstr.IntOrString) **out = **in } - in.UpdateStrategy.DeepCopyInto(&out.UpdateStrategy) + if in.InstanceUpdateStrategy != nil { + in, out := &in.InstanceUpdateStrategy, &out.InstanceUpdateStrategy + *out = new(appsv1.InstanceUpdateStrategy) + (*in).DeepCopyInto(*out) + } + if in.MemberUpdateStrategy != nil { + in, out := &in.MemberUpdateStrategy, &out.MemberUpdateStrategy + *out = new(MemberUpdateStrategy) + **out = **in + } if in.Roles != nil { in, out := &in.Roles, &out.Roles *out = make([]appsv1.ReplicaRole, len(*in)) @@ -172,11 +181,6 @@ func (in *InstanceSetSpec) DeepCopyInto(out *InstanceSetSpec) { (*out)[key] = val } } - if in.MemberUpdateStrategy != nil { - in, out := &in.MemberUpdateStrategy, &out.MemberUpdateStrategy - *out = new(MemberUpdateStrategy) - **out = **in - } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstanceSetSpec. diff --git a/apis/workloads/v1alpha1/instanceset_conversion.go b/apis/workloads/v1alpha1/instanceset_conversion.go index 78a14aeb3be..775a05f35aa 100644 --- a/apis/workloads/v1alpha1/instanceset_conversion.go +++ b/apis/workloads/v1alpha1/instanceset_conversion.go @@ -22,7 +22,9 @@ package v1alpha1 import ( "github.com/jinzhu/copier" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/intstr" "k8s.io/apimachinery/pkg/util/json" + "k8s.io/utils/pointer" "sigs.k8s.io/controller-runtime/pkg/conversion" workloadsv1 "github.com/apecloud/kubeblocks/apis/workloads/v1" @@ -43,6 +45,7 @@ func (r *InstanceSet) ConvertTo(dstRaw conversion.Hub) error { if err := copier.Copy(&dst.Spec, &r.Spec); err != nil { return err } + r.changesToInstanceSet(dst) // status if err := copier.Copy(&dst.Status, &r.Status); err != nil { @@ -67,6 +70,7 @@ func (r *InstanceSet) ConvertFrom(srcRaw conversion.Hub) error { if err := copier.Copy(&r.Spec, &src.Spec); err != nil { return err } + r.changesFromInstanceSet(src) // status if err := copier.Copy(&r.Status, &src.Status); err != nil { @@ -80,22 +84,12 @@ func (r *InstanceSet) ConvertFrom(srcRaw conversion.Hub) error { } func (r *InstanceSet) incrementConvertTo(dstRaw metav1.Object) error { - if r.Spec.RoleProbe == nil && r.Spec.UpdateStrategy == nil { + if r.Spec.RoleProbe == nil && r.Spec.Credential == nil { return nil } - // changed instanceConvert := instanceSetConverter{ - RoleProbe: r.Spec.RoleProbe, - UpdateStrategy: r.Spec.UpdateStrategy, - Credential: r.Spec.Credential, - } - - if r.Spec.UpdateStrategy == nil || r.Spec.UpdateStrategy.MemberUpdateStrategy == nil { - // 1. set default update strategy - updateStrategy := SerialUpdateStrategy - instanceConvert.UpdateStrategy = &InstanceUpdateStrategy{ - MemberUpdateStrategy: &updateStrategy, - } + RoleProbe: r.Spec.RoleProbe, + Credential: r.Spec.Credential, } bytes, err := json.Marshal(instanceConvert) if err != nil { @@ -121,13 +115,73 @@ func (r *InstanceSet) incrementConvertFrom(srcRaw metav1.Object) error { } delete(srcRaw.GetAnnotations(), kbIncrementConverterAK) r.Spec.RoleProbe = instanceConvert.RoleProbe - r.Spec.UpdateStrategy = instanceConvert.UpdateStrategy r.Spec.Credential = instanceConvert.Credential return nil } type instanceSetConverter struct { - RoleProbe *RoleProbe `json:"roleProbe,omitempty"` - UpdateStrategy *InstanceUpdateStrategy `json:"updateStrategy,omitempty"` - Credential *Credential `json:"credential,omitempty"` + RoleProbe *RoleProbe `json:"roleProbe,omitempty"` + Credential *Credential `json:"credential,omitempty"` +} + +func (r *InstanceSet) changesToInstanceSet(its *workloadsv1.InstanceSet) { + // changed: + // spec + // updateStrategy.partition -> instanceUpdateStrategy.rollingUpdate.replicas + // updateStrategy.maxUnavailable -> instanceUpdateStrategy.rollingUpdate.maxUnavailable + // updateStrategy.memberUpdateStrategy -> memberUpdateStrategy + if its.Spec.InstanceUpdateStrategy == nil { + its.Spec.InstanceUpdateStrategy = &workloadsv1.InstanceUpdateStrategy{} + } + initRollingUpdate := func() { + if its.Spec.InstanceUpdateStrategy.RollingUpdate == nil { + its.Spec.InstanceUpdateStrategy.RollingUpdate = &workloadsv1.RollingUpdate{} + } + } + setMemberUpdateStrategy := func(strategy *MemberUpdateStrategy) { + if strategy == nil { + return + } + its.Spec.MemberUpdateStrategy = (*workloadsv1.MemberUpdateStrategy)(strategy) + } + setMemberUpdateStrategy(r.Spec.MemberUpdateStrategy) + if r.Spec.UpdateStrategy != nil { + setMemberUpdateStrategy(r.Spec.UpdateStrategy.MemberUpdateStrategy) + if r.Spec.UpdateStrategy.Partition != nil { + initRollingUpdate() + replicas := intstr.FromInt32(*r.Spec.UpdateStrategy.Partition) + its.Spec.InstanceUpdateStrategy.RollingUpdate.Replicas = &replicas + } + if r.Spec.UpdateStrategy.MaxUnavailable != nil { + initRollingUpdate() + its.Spec.InstanceUpdateStrategy.RollingUpdate.MaxUnavailable = r.Spec.UpdateStrategy.MaxUnavailable + } + } +} + +func (r *InstanceSet) changesFromInstanceSet(its *workloadsv1.InstanceSet) { + // changed: + // spec + // updateStrategy.partition -> instanceUpdateStrategy.rollingUpdate.replicas + // updateStrategy.maxUnavailable -> instanceUpdateStrategy.rollingUpdate.maxUnavailable + // updateStrategy.memberUpdateStrategy -> memberUpdateStrategy + r.Spec.MemberUpdateStrategy = (*MemberUpdateStrategy)(its.Spec.MemberUpdateStrategy) + if its.Spec.InstanceUpdateStrategy == nil { + return + } + if its.Spec.InstanceUpdateStrategy.RollingUpdate == nil { + return + } + if r.Spec.UpdateStrategy == nil { + r.Spec.UpdateStrategy = &InstanceUpdateStrategy{ + MemberUpdateStrategy: r.Spec.MemberUpdateStrategy, + } + } + if its.Spec.InstanceUpdateStrategy.RollingUpdate.Replicas != nil { + partition, _ := intstr.GetScaledValueFromIntOrPercent(its.Spec.InstanceUpdateStrategy.RollingUpdate.Replicas, int(*its.Spec.Replicas), false) + r.Spec.UpdateStrategy.Partition = pointer.Int32(int32(partition)) + } + if its.Spec.InstanceUpdateStrategy.RollingUpdate.MaxUnavailable != nil { + r.Spec.UpdateStrategy.MaxUnavailable = its.Spec.InstanceUpdateStrategy.RollingUpdate.MaxUnavailable + } } diff --git a/config/crd/bases/apps.kubeblocks.io_clusters.yaml b/config/crd/bases/apps.kubeblocks.io_clusters.yaml index 327dba49aed..8a04343dc05 100644 --- a/config/crd/bases/apps.kubeblocks.io_clusters.yaml +++ b/config/crd/bases/apps.kubeblocks.io_clusters.yaml @@ -713,6 +713,47 @@ spec: - name type: object type: array + instanceUpdateStrategy: + description: Provides fine-grained control over the spec update + process of all instances. + properties: + rollingUpdate: + description: Specifies how the rolling update should be + applied. + properties: + maxUnavailable: + anyOf: + - type: integer + - type: string + description: |- + The maximum number of instances that can be unavailable during the update. + Value can be an absolute number (ex: 5) or a percentage of desired instances (ex: 10%). + Absolute number is calculated from percentage by rounding up. This can not be 0. + Defaults to 1. The field applies to all instances. That means if there is any unavailable pod, + it will be counted towards MaxUnavailable. + x-kubernetes-int-or-string: true + replicas: + anyOf: + - type: integer + - type: string + description: |- + Indicates the number of instances that should be updated during a rolling update. + The remaining instances will remain untouched. This is helpful in defining how many instances + should participate in the update process. + Value can be an absolute number (ex: 5) or a percentage of desired instances (ex: 10%). + Absolute number is calculated from percentage by rounding up. + The default value is ComponentSpec.Replicas (i.e., update all instances). + x-kubernetes-int-or-string: true + type: object + type: + description: |- + Indicates the type of the update strategy. + Default is RollingUpdate. + enum: + - RollingUpdate + - OnDelete + type: string + type: object instances: description: |- Allows for the customization of configuration values for each instance within a Component. @@ -7853,6 +7894,47 @@ spec: - name type: object type: array + instanceUpdateStrategy: + description: Provides fine-grained control over the spec + update process of all instances. + properties: + rollingUpdate: + description: Specifies how the rolling update should + be applied. + properties: + maxUnavailable: + anyOf: + - type: integer + - type: string + description: |- + The maximum number of instances that can be unavailable during the update. + Value can be an absolute number (ex: 5) or a percentage of desired instances (ex: 10%). + Absolute number is calculated from percentage by rounding up. This can not be 0. + Defaults to 1. The field applies to all instances. That means if there is any unavailable pod, + it will be counted towards MaxUnavailable. + x-kubernetes-int-or-string: true + replicas: + anyOf: + - type: integer + - type: string + description: |- + Indicates the number of instances that should be updated during a rolling update. + The remaining instances will remain untouched. This is helpful in defining how many instances + should participate in the update process. + Value can be an absolute number (ex: 5) or a percentage of desired instances (ex: 10%). + Absolute number is calculated from percentage by rounding up. + The default value is ComponentSpec.Replicas (i.e., update all instances). + x-kubernetes-int-or-string: true + type: object + type: + description: |- + Indicates the type of the update strategy. + Default is RollingUpdate. + enum: + - RollingUpdate + - OnDelete + type: string + type: object instances: description: |- Allows for the customization of configuration values for each instance within a Component. diff --git a/config/crd/bases/apps.kubeblocks.io_components.yaml b/config/crd/bases/apps.kubeblocks.io_components.yaml index 3c310ba9e94..acc8a6146b5 100644 --- a/config/crd/bases/apps.kubeblocks.io_components.yaml +++ b/config/crd/bases/apps.kubeblocks.io_components.yaml @@ -581,6 +581,46 @@ spec: - name type: object type: array + instanceUpdateStrategy: + description: Provides fine-grained control over the spec update process + of all instances. + properties: + rollingUpdate: + description: Specifies how the rolling update should be applied. + properties: + maxUnavailable: + anyOf: + - type: integer + - type: string + description: |- + The maximum number of instances that can be unavailable during the update. + Value can be an absolute number (ex: 5) or a percentage of desired instances (ex: 10%). + Absolute number is calculated from percentage by rounding up. This can not be 0. + Defaults to 1. The field applies to all instances. That means if there is any unavailable pod, + it will be counted towards MaxUnavailable. + x-kubernetes-int-or-string: true + replicas: + anyOf: + - type: integer + - type: string + description: |- + Indicates the number of instances that should be updated during a rolling update. + The remaining instances will remain untouched. This is helpful in defining how many instances + should participate in the update process. + Value can be an absolute number (ex: 5) or a percentage of desired instances (ex: 10%). + Absolute number is calculated from percentage by rounding up. + The default value is ComponentSpec.Replicas (i.e., update all instances). + x-kubernetes-int-or-string: true + type: object + type: + description: |- + Indicates the type of the update strategy. + Default is RollingUpdate. + enum: + - RollingUpdate + - OnDelete + type: string + type: object instances: description: |- Allows for the customization of configuration values for each instance within a Component. diff --git a/config/crd/bases/workloads.kubeblocks.io_instancesets.yaml b/config/crd/bases/workloads.kubeblocks.io_instancesets.yaml index b3a3c00a8c5..547a789fb77 100644 --- a/config/crd/bases/workloads.kubeblocks.io_instancesets.yaml +++ b/config/crd/bases/workloads.kubeblocks.io_instancesets.yaml @@ -94,6 +94,46 @@ spec: type: object type: array type: object + instanceUpdateStrategy: + description: Provides fine-grained control over the spec update process + of all instances. + properties: + rollingUpdate: + description: Specifies how the rolling update should be applied. + properties: + maxUnavailable: + anyOf: + - type: integer + - type: string + description: |- + The maximum number of instances that can be unavailable during the update. + Value can be an absolute number (ex: 5) or a percentage of desired instances (ex: 10%). + Absolute number is calculated from percentage by rounding up. This can not be 0. + Defaults to 1. The field applies to all instances. That means if there is any unavailable pod, + it will be counted towards MaxUnavailable. + x-kubernetes-int-or-string: true + replicas: + anyOf: + - type: integer + - type: string + description: |- + Indicates the number of instances that should be updated during a rolling update. + The remaining instances will remain untouched. This is helpful in defining how many instances + should participate in the update process. + Value can be an absolute number (ex: 5) or a percentage of desired instances (ex: 10%). + Absolute number is calculated from percentage by rounding up. + The default value is ComponentSpec.Replicas (i.e., update all instances). + x-kubernetes-int-or-string: true + type: object + type: + description: |- + Indicates the type of the update strategy. + Default is RollingUpdate. + enum: + - RollingUpdate + - OnDelete + type: string + type: object instances: description: |- Overrides values in default Template. @@ -1530,12 +1570,12 @@ spec: - serial: update Members one by one that guarantee minimum component unavailable time. - - bestEffortParallel: update Members in parallel that guarantee minimum component un-writable time. - parallel: force parallel + - bestEffortParallel: update Members in parallel that guarantee minimum component un-writable time. enum: - Serial - - BestEffortParallel - Parallel + - BestEffortParallel type: string membershipReconfiguration: description: Provides actions to do membership dynamic reconfiguration. @@ -9654,48 +9694,6 @@ spec: type: string description: Provides variables which are used to call Actions. type: object - updateStrategy: - description: |- - Indicates the StatefulSetUpdateStrategy that will be - employed to update Pods in the InstanceSet when a revision is made to - Template. - UpdateStrategy.Type will be set to appsv1.OnDeleteStatefulSetStrategyType if MemberUpdateStrategy is not nil - - - Note: This field will be removed in future version. - properties: - rollingUpdate: - description: RollingUpdate is used to communicate parameters when - Type is RollingUpdateStatefulSetStrategyType. - properties: - maxUnavailable: - anyOf: - - type: integer - - type: string - description: |- - The maximum number of pods that can be unavailable during the update. - Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). - Absolute number is calculated from percentage by rounding up. This can not be 0. - Defaults to 1. This field is alpha-level and is only honored by servers that enable the - MaxUnavailableStatefulSet feature. The field applies to all pods in the range 0 to - Replicas-1. That means if there is any unavailable pod in the range 0 to Replicas-1, it - will be counted towards MaxUnavailable. - x-kubernetes-int-or-string: true - partition: - description: |- - Partition indicates the ordinal at which the StatefulSet should be partitioned - for updates. During a rolling update, all pods from ordinal Replicas-1 to - Partition are updated. All pods from ordinal Partition-1 to 0 remain untouched. - This is helpful in being able to do a canary based deployment. The default value is 0. - format: int32 - type: integer - type: object - type: - description: |- - Type indicates the type of the StatefulSetUpdateStrategy. - Default is RollingUpdate. - type: string - type: object volumeClaimTemplates: description: |- Specifies a list of PersistentVolumeClaim templates that define the storage requirements for each replica. diff --git a/controllers/apps/cluster/transformer_cluster_component.go b/controllers/apps/cluster/transformer_cluster_component.go index 3899488672a..6706e0d3d44 100644 --- a/controllers/apps/cluster/transformer_cluster_component.go +++ b/controllers/apps/cluster/transformer_cluster_component.go @@ -207,6 +207,7 @@ func copyAndMergeComponent(oldCompObj, newCompObj *appsv1.Component) *appsv1.Com compObjCopy.Spec.ServiceAccountName = compProto.Spec.ServiceAccountName compObjCopy.Spec.ParallelPodManagementConcurrency = compProto.Spec.ParallelPodManagementConcurrency compObjCopy.Spec.PodUpdatePolicy = compProto.Spec.PodUpdatePolicy + compObjCopy.Spec.InstanceUpdateStrategy = compProto.Spec.InstanceUpdateStrategy compObjCopy.Spec.SchedulingPolicy = compProto.Spec.SchedulingPolicy compObjCopy.Spec.TLSConfig = compProto.Spec.TLSConfig compObjCopy.Spec.Instances = compProto.Spec.Instances diff --git a/controllers/apps/component/transformer_component_workload.go b/controllers/apps/component/transformer_component_workload.go index f8aea10daf1..9c2090e2c68 100644 --- a/controllers/apps/component/transformer_component_workload.go +++ b/controllers/apps/component/transformer_component_workload.go @@ -35,7 +35,6 @@ import ( apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" - "k8s.io/apimachinery/pkg/util/intstr" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/utils/ptr" "sigs.k8s.io/controller-runtime/pkg/client" @@ -410,22 +409,6 @@ func buildPodSpecVolumeMounts(synthesizeComp *component.SynthesizedComponent) { // 1. new an object targetObj by copying from oldObj // 2. merge all fields can be updated from newObj into targetObj func copyAndMergeITS(oldITS, newITS *workloads.InstanceSet) *workloads.InstanceSet { - updateUpdateStrategy := func(itsObj, itsProto *workloads.InstanceSet) { - var objMaxUnavailable *intstr.IntOrString - if itsObj.Spec.UpdateStrategy.RollingUpdate != nil { - objMaxUnavailable = itsObj.Spec.UpdateStrategy.RollingUpdate.MaxUnavailable - } - itsObj.Spec.UpdateStrategy = itsProto.Spec.UpdateStrategy - if objMaxUnavailable == nil && itsObj.Spec.UpdateStrategy.RollingUpdate != nil { - // HACK: This field is alpha-level (since v1.24) and is only honored by servers that enable the - // MaxUnavailableStatefulSet feature. - // When we get a nil MaxUnavailable from k8s, we consider that the field is not supported by the server, - // and set the MaxUnavailable as nil explicitly to avoid the workload been updated unexpectedly. - // Ref: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#maximum-unavailable-pods - itsObj.Spec.UpdateStrategy.RollingUpdate.MaxUnavailable = nil - } - } - itsObjCopy := oldITS.DeepCopy() itsProto := newITS @@ -450,17 +433,28 @@ func copyAndMergeITS(oldITS, newITS *workloads.InstanceSet) *workloads.InstanceS itsObjCopy.Spec.Roles = itsProto.Spec.Roles itsObjCopy.Spec.MembershipReconfiguration = itsProto.Spec.MembershipReconfiguration itsObjCopy.Spec.TemplateVars = itsProto.Spec.TemplateVars - itsObjCopy.Spec.MemberUpdateStrategy = itsProto.Spec.MemberUpdateStrategy itsObjCopy.Spec.Instances = itsProto.Spec.Instances itsObjCopy.Spec.OfflineInstances = itsProto.Spec.OfflineInstances itsObjCopy.Spec.MinReadySeconds = itsProto.Spec.MinReadySeconds itsObjCopy.Spec.VolumeClaimTemplates = itsProto.Spec.VolumeClaimTemplates itsObjCopy.Spec.ParallelPodManagementConcurrency = itsProto.Spec.ParallelPodManagementConcurrency itsObjCopy.Spec.PodUpdatePolicy = itsProto.Spec.PodUpdatePolicy + itsObjCopy.Spec.InstanceUpdateStrategy = itsProto.Spec.InstanceUpdateStrategy + itsObjCopy.Spec.MemberUpdateStrategy = itsProto.Spec.MemberUpdateStrategy itsObjCopy.Spec.Paused = itsProto.Spec.Paused - if itsProto.Spec.UpdateStrategy.Type != "" || itsProto.Spec.UpdateStrategy.RollingUpdate != nil { - updateUpdateStrategy(itsObjCopy, itsProto) + if itsObjCopy.Spec.InstanceUpdateStrategy != nil && itsObjCopy.Spec.InstanceUpdateStrategy.RollingUpdate != nil { + // use oldITS because itsObjCopy has been overwritten + if oldITS.Spec.InstanceUpdateStrategy != nil && + oldITS.Spec.InstanceUpdateStrategy.RollingUpdate != nil && + oldITS.Spec.InstanceUpdateStrategy.RollingUpdate.MaxUnavailable == nil { + // HACK: This field is alpha-level (since v1.24) and is only honored by servers that enable the + // MaxUnavailableStatefulSet feature. + // When we get a nil MaxUnavailable from k8s, we consider that the field is not supported by the server, + // and set the MaxUnavailable as nil explicitly to avoid the workload been updated unexpectedly. + // Ref: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#maximum-unavailable-pods + itsObjCopy.Spec.InstanceUpdateStrategy.RollingUpdate.MaxUnavailable = nil + } } intctrlutil.ResolvePodSpecDefaultFields(oldITS.Spec.Template.Spec, &itsObjCopy.Spec.Template.Spec) diff --git a/controllers/apps/componentdefinition_controller_test.go b/controllers/apps/componentdefinition_controller_test.go index 7b3638b5aab..58be0a38fc7 100644 --- a/controllers/apps/componentdefinition_controller_test.go +++ b/controllers/apps/componentdefinition_controller_test.go @@ -29,6 +29,7 @@ import ( appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" "k8s.io/utils/pointer" + "k8s.io/utils/ptr" "sigs.k8s.io/controller-runtime/pkg/client" kbappsv1 "github.com/apecloud/kubeblocks/apis/apps/v1" @@ -542,8 +543,7 @@ var _ = Describe("ComponentDefinition Controller", func() { Expect(testapps.GetAndChangeObj(&testCtx, client.ObjectKeyFromObject(componentDefObj), func(cmpd *kbappsv1.ComponentDefinition) { cmpd.Spec.Description = "v0.0.2" cmpd.Spec.Runtime.Containers[0].Image = "image:v0.0.2" - parallel := kbappsv1.ParallelStrategy - cmpd.Spec.UpdateStrategy = ¶llel + cmpd.Spec.UpdateStrategy = ptr.To(kbappsv1.ParallelStrategy) })()).Should(Succeed()) By(fmt.Sprintf("checking the updated object as %s", strings.ToLower(string(kbappsv1.AvailablePhase)))) @@ -570,8 +570,7 @@ var _ = Describe("ComponentDefinition Controller", func() { Expect(testapps.GetAndChangeObj(&testCtx, client.ObjectKeyFromObject(componentDefObj), func(cmpd *kbappsv1.ComponentDefinition) { cmpd.Spec.Description = "v0.0.2" cmpd.Spec.Runtime.Containers[0].Image = "image:v0.0.2" - parallel := kbappsv1.ParallelStrategy - cmpd.Spec.UpdateStrategy = ¶llel + cmpd.Spec.UpdateStrategy = ptr.To(kbappsv1.ParallelStrategy) })()).Should(Succeed()) By(fmt.Sprintf("checking the updated object as %s", strings.ToLower(string(kbappsv1.UnavailablePhase)))) diff --git a/controllers/parameters/reconfigure_policy.go b/controllers/parameters/reconfigure_policy.go index fc2a2dfffc2..8f63c5b9979 100644 --- a/controllers/parameters/reconfigure_policy.go +++ b/controllers/parameters/reconfigure_policy.go @@ -162,8 +162,8 @@ func (param *reconfigureParams) maxRollingReplicas() int32 { var maxUnavailable *intstr.IntOrString for _, its := range param.InstanceSetUnits { - if its.Spec.UpdateStrategy.RollingUpdate != nil { - maxUnavailable = its.Spec.UpdateStrategy.RollingUpdate.MaxUnavailable + if its.Spec.InstanceUpdateStrategy.RollingUpdate != nil { + maxUnavailable = its.Spec.InstanceUpdateStrategy.RollingUpdate.MaxUnavailable } if maxUnavailable != nil { break diff --git a/deploy/helm/crds/apps.kubeblocks.io_clusters.yaml b/deploy/helm/crds/apps.kubeblocks.io_clusters.yaml index 327dba49aed..8a04343dc05 100644 --- a/deploy/helm/crds/apps.kubeblocks.io_clusters.yaml +++ b/deploy/helm/crds/apps.kubeblocks.io_clusters.yaml @@ -713,6 +713,47 @@ spec: - name type: object type: array + instanceUpdateStrategy: + description: Provides fine-grained control over the spec update + process of all instances. + properties: + rollingUpdate: + description: Specifies how the rolling update should be + applied. + properties: + maxUnavailable: + anyOf: + - type: integer + - type: string + description: |- + The maximum number of instances that can be unavailable during the update. + Value can be an absolute number (ex: 5) or a percentage of desired instances (ex: 10%). + Absolute number is calculated from percentage by rounding up. This can not be 0. + Defaults to 1. The field applies to all instances. That means if there is any unavailable pod, + it will be counted towards MaxUnavailable. + x-kubernetes-int-or-string: true + replicas: + anyOf: + - type: integer + - type: string + description: |- + Indicates the number of instances that should be updated during a rolling update. + The remaining instances will remain untouched. This is helpful in defining how many instances + should participate in the update process. + Value can be an absolute number (ex: 5) or a percentage of desired instances (ex: 10%). + Absolute number is calculated from percentage by rounding up. + The default value is ComponentSpec.Replicas (i.e., update all instances). + x-kubernetes-int-or-string: true + type: object + type: + description: |- + Indicates the type of the update strategy. + Default is RollingUpdate. + enum: + - RollingUpdate + - OnDelete + type: string + type: object instances: description: |- Allows for the customization of configuration values for each instance within a Component. @@ -7853,6 +7894,47 @@ spec: - name type: object type: array + instanceUpdateStrategy: + description: Provides fine-grained control over the spec + update process of all instances. + properties: + rollingUpdate: + description: Specifies how the rolling update should + be applied. + properties: + maxUnavailable: + anyOf: + - type: integer + - type: string + description: |- + The maximum number of instances that can be unavailable during the update. + Value can be an absolute number (ex: 5) or a percentage of desired instances (ex: 10%). + Absolute number is calculated from percentage by rounding up. This can not be 0. + Defaults to 1. The field applies to all instances. That means if there is any unavailable pod, + it will be counted towards MaxUnavailable. + x-kubernetes-int-or-string: true + replicas: + anyOf: + - type: integer + - type: string + description: |- + Indicates the number of instances that should be updated during a rolling update. + The remaining instances will remain untouched. This is helpful in defining how many instances + should participate in the update process. + Value can be an absolute number (ex: 5) or a percentage of desired instances (ex: 10%). + Absolute number is calculated from percentage by rounding up. + The default value is ComponentSpec.Replicas (i.e., update all instances). + x-kubernetes-int-or-string: true + type: object + type: + description: |- + Indicates the type of the update strategy. + Default is RollingUpdate. + enum: + - RollingUpdate + - OnDelete + type: string + type: object instances: description: |- Allows for the customization of configuration values for each instance within a Component. diff --git a/deploy/helm/crds/apps.kubeblocks.io_components.yaml b/deploy/helm/crds/apps.kubeblocks.io_components.yaml index 3c310ba9e94..acc8a6146b5 100644 --- a/deploy/helm/crds/apps.kubeblocks.io_components.yaml +++ b/deploy/helm/crds/apps.kubeblocks.io_components.yaml @@ -581,6 +581,46 @@ spec: - name type: object type: array + instanceUpdateStrategy: + description: Provides fine-grained control over the spec update process + of all instances. + properties: + rollingUpdate: + description: Specifies how the rolling update should be applied. + properties: + maxUnavailable: + anyOf: + - type: integer + - type: string + description: |- + The maximum number of instances that can be unavailable during the update. + Value can be an absolute number (ex: 5) or a percentage of desired instances (ex: 10%). + Absolute number is calculated from percentage by rounding up. This can not be 0. + Defaults to 1. The field applies to all instances. That means if there is any unavailable pod, + it will be counted towards MaxUnavailable. + x-kubernetes-int-or-string: true + replicas: + anyOf: + - type: integer + - type: string + description: |- + Indicates the number of instances that should be updated during a rolling update. + The remaining instances will remain untouched. This is helpful in defining how many instances + should participate in the update process. + Value can be an absolute number (ex: 5) or a percentage of desired instances (ex: 10%). + Absolute number is calculated from percentage by rounding up. + The default value is ComponentSpec.Replicas (i.e., update all instances). + x-kubernetes-int-or-string: true + type: object + type: + description: |- + Indicates the type of the update strategy. + Default is RollingUpdate. + enum: + - RollingUpdate + - OnDelete + type: string + type: object instances: description: |- Allows for the customization of configuration values for each instance within a Component. diff --git a/deploy/helm/crds/workloads.kubeblocks.io_instancesets.yaml b/deploy/helm/crds/workloads.kubeblocks.io_instancesets.yaml index b3a3c00a8c5..547a789fb77 100644 --- a/deploy/helm/crds/workloads.kubeblocks.io_instancesets.yaml +++ b/deploy/helm/crds/workloads.kubeblocks.io_instancesets.yaml @@ -94,6 +94,46 @@ spec: type: object type: array type: object + instanceUpdateStrategy: + description: Provides fine-grained control over the spec update process + of all instances. + properties: + rollingUpdate: + description: Specifies how the rolling update should be applied. + properties: + maxUnavailable: + anyOf: + - type: integer + - type: string + description: |- + The maximum number of instances that can be unavailable during the update. + Value can be an absolute number (ex: 5) or a percentage of desired instances (ex: 10%). + Absolute number is calculated from percentage by rounding up. This can not be 0. + Defaults to 1. The field applies to all instances. That means if there is any unavailable pod, + it will be counted towards MaxUnavailable. + x-kubernetes-int-or-string: true + replicas: + anyOf: + - type: integer + - type: string + description: |- + Indicates the number of instances that should be updated during a rolling update. + The remaining instances will remain untouched. This is helpful in defining how many instances + should participate in the update process. + Value can be an absolute number (ex: 5) or a percentage of desired instances (ex: 10%). + Absolute number is calculated from percentage by rounding up. + The default value is ComponentSpec.Replicas (i.e., update all instances). + x-kubernetes-int-or-string: true + type: object + type: + description: |- + Indicates the type of the update strategy. + Default is RollingUpdate. + enum: + - RollingUpdate + - OnDelete + type: string + type: object instances: description: |- Overrides values in default Template. @@ -1530,12 +1570,12 @@ spec: - serial: update Members one by one that guarantee minimum component unavailable time. - - bestEffortParallel: update Members in parallel that guarantee minimum component un-writable time. - parallel: force parallel + - bestEffortParallel: update Members in parallel that guarantee minimum component un-writable time. enum: - Serial - - BestEffortParallel - Parallel + - BestEffortParallel type: string membershipReconfiguration: description: Provides actions to do membership dynamic reconfiguration. @@ -9654,48 +9694,6 @@ spec: type: string description: Provides variables which are used to call Actions. type: object - updateStrategy: - description: |- - Indicates the StatefulSetUpdateStrategy that will be - employed to update Pods in the InstanceSet when a revision is made to - Template. - UpdateStrategy.Type will be set to appsv1.OnDeleteStatefulSetStrategyType if MemberUpdateStrategy is not nil - - - Note: This field will be removed in future version. - properties: - rollingUpdate: - description: RollingUpdate is used to communicate parameters when - Type is RollingUpdateStatefulSetStrategyType. - properties: - maxUnavailable: - anyOf: - - type: integer - - type: string - description: |- - The maximum number of pods that can be unavailable during the update. - Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). - Absolute number is calculated from percentage by rounding up. This can not be 0. - Defaults to 1. This field is alpha-level and is only honored by servers that enable the - MaxUnavailableStatefulSet feature. The field applies to all pods in the range 0 to - Replicas-1. That means if there is any unavailable pod in the range 0 to Replicas-1, it - will be counted towards MaxUnavailable. - x-kubernetes-int-or-string: true - partition: - description: |- - Partition indicates the ordinal at which the StatefulSet should be partitioned - for updates. During a rolling update, all pods from ordinal Replicas-1 to - Partition are updated. All pods from ordinal Partition-1 to 0 remain untouched. - This is helpful in being able to do a canary based deployment. The default value is 0. - format: int32 - type: integer - type: object - type: - description: |- - Type indicates the type of the StatefulSetUpdateStrategy. - Default is RollingUpdate. - type: string - type: object volumeClaimTemplates: description: |- Specifies a list of PersistentVolumeClaim templates that define the storage requirements for each replica. diff --git a/docs/developer_docs/api-reference/cluster.md b/docs/developer_docs/api-reference/cluster.md index 8be2cb77475..384912c2aab 100644 --- a/docs/developer_docs/api-reference/cluster.md +++ b/docs/developer_docs/api-reference/cluster.md @@ -726,6 +726,20 @@ Default value is “PreferInPlace”
instanceUpdateStrategy
Provides fine-grained control over the spec update process of all instances.
+schedulingPolicy
instanceUpdateStrategy
Provides fine-grained control over the spec update process of all instances.
+instances
instanceUpdateStrategy
Provides fine-grained control over the spec update process of all instances.
+schedulingPolicy
+(Appears on:ClusterComponentSpec, ComponentSpec, InstanceSetSpec) +
+InstanceUpdateStrategy defines fine-grained control over the spec update process of all instances.
+Field | +Description | +
---|---|
+type + + +InstanceUpdateStrategyType + + + |
+
+(Optional)
+ Indicates the type of the update strategy. +Default is RollingUpdate. + |
+
+rollingUpdate + + +RollingUpdate + + + |
+
+(Optional)
+ Specifies how the rolling update should be applied. + |
+
string
alias)+(Appears on:InstanceUpdateStrategy) +
+InstanceUpdateStrategyType is a string enumeration type that enumerates +all possible update strategies for the KubeBlocks controllers.
+Value | +Description | +
---|---|
"OnDelete" |
+OnDeleteStrategyType indicates that ordered rolling restarts are disabled. Instances are recreated +when they are manually deleted. + |
+
"RollingUpdate" |
+RollingUpdateStrategyType indicates that update will be +applied to all Instances with respect to the workload +ordering constraints. + |
+
@@ -8846,9 +8962,10 @@ string
string
alias)-(Appears on:ClusterComponentSpec, ComponentSpec) +(Appears on:ClusterComponentSpec, ComponentSpec, InstanceSetSpec)
PodUpdatePolicyType indicates how pods should be updated
+(Appears on:InstanceUpdateStrategy) +
+RollingUpdate specifies how the rolling update should be applied.
+Field | +Description | +
---|---|
+replicas + + +Kubernetes api utils intstr.IntOrString + + + |
+
+(Optional)
+ Indicates the number of instances that should be updated during a rolling update. +The remaining instances will remain untouched. This is helpful in defining how many instances +should participate in the update process. +Value can be an absolute number (ex: 5) or a percentage of desired instances (ex: 10%). +Absolute number is calculated from percentage by rounding up. +The default value is ComponentSpec.Replicas (i.e., update all instances). + |
+
+maxUnavailable + + +Kubernetes api utils intstr.IntOrString + + + |
+
+(Optional)
+ The maximum number of instances that can be unavailable during the update. +Value can be an absolute number (ex: 5) or a percentage of desired instances (ex: 10%). +Absolute number is calculated from percentage by rounding up. This can not be 0. +Defaults to 1. The field applies to all instances. That means if there is any unavailable pod, +it will be counted towards MaxUnavailable. + |
+
@@ -29398,7 +29570,7 @@ The default Concurrency is 100%.
podUpdatePolicy
updateStrategy
instanceUpdateStrategy
Indicates the StatefulSetUpdateStrategy that will be -employed to update Pods in the InstanceSet when a revision is made to -Template. -UpdateStrategy.Type will be set to appsv1.OnDeleteStatefulSetStrategyType if MemberUpdateStrategy is not nil
-Note: This field will be removed in future version.
+(Optional) +Provides fine-grained control over the spec update process of all instances.
+memberUpdateStrategy
Members(Pods) update strategy.
+memberUpdateStrategy
Members(Pods) update strategy.
-paused
podUpdatePolicy
updateStrategy
instanceUpdateStrategy
Indicates the StatefulSetUpdateStrategy that will be -employed to update Pods in the InstanceSet when a revision is made to -Template. -UpdateStrategy.Type will be set to appsv1.OnDeleteStatefulSetStrategyType if MemberUpdateStrategy is not nil
-Note: This field will be removed in future version.
+(Optional) +Provides fine-grained control over the spec update process of all instances.
+memberUpdateStrategy
Members(Pods) update strategy.
+memberUpdateStrategy
Members(Pods) update strategy.
-paused
string
alias)-(Appears on:InstanceSetSpec) -
-Value | -Description | -
---|---|
"PreferInPlace" |
-PreferInPlacePodUpdatePolicyType indicates that we will first attempt an in-place upgrade of the Pod. -If that fails, it will fall back to the ReCreate, where pod will be recreated. - |
-
"StrictInPlace" |
-StrictInPlacePodUpdatePolicyType indicates that only allows in-place upgrades. -Any attempt to modify other fields will be rejected. - |
-
string
alias)