Skip to content

Commit

Permalink
[fix #1128] some rollingupdate field can not updated (#1189)
Browse files Browse the repository at this point in the history
Signed-off-by: liuzhenwei <dui_zhang@163.com>
  • Loading branch information
diannaowa authored Feb 22, 2023
1 parent 85a9542 commit 07c51b9
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions apis/apps/defaults/v1beta1.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,19 @@ import (
utilpointer "k8s.io/utils/pointer"
)

// SetDefaults_StatefulSet set default values for StatefulSet.
// SetDefaultsStatefulSet set default values for StatefulSet.
func SetDefaultsStatefulSet(obj *v1beta1.StatefulSet, injectTemplateDefaults bool) {
if len(obj.Spec.PodManagementPolicy) == 0 {
obj.Spec.PodManagementPolicy = appsv1.OrderedReadyPodManagement
}

if obj.Spec.UpdateStrategy.Type == "" {
obj.Spec.UpdateStrategy.Type = appsv1.RollingUpdateStatefulSetStrategyType

// UpdateStrategy.RollingUpdate will take default values below.
obj.Spec.UpdateStrategy.RollingUpdate = &v1beta1.RollingUpdateStatefulSetStrategy{}
}

if obj.Spec.UpdateStrategy.Type == appsv1.RollingUpdateStatefulSetStrategyType {
if obj.Spec.UpdateStrategy.RollingUpdate == nil {
// UpdateStrategy.RollingUpdate will take default values below.
obj.Spec.UpdateStrategy.RollingUpdate = &v1beta1.RollingUpdateStatefulSetStrategy{}
}
if obj.Spec.UpdateStrategy.RollingUpdate.Partition == nil {
Expand Down

0 comments on commit 07c51b9

Please sign in to comment.