Skip to content

Commit 51d9ba7

Browse files
committed
[BugFix] Fix StatefulSet Update Strategy Handling
- Removed unnecessary quotes around `maxUnavailable` in `starrockscluster.yaml` to ensure proper YAML parsing and value interpretation. - Added `updateStrategy` to the `hashStatefulsetObject` struct in `statefulset.go` to include update strategy in the hash calculation. Signed-off-by: yandongxiao <[email protected]>
1 parent 549db92 commit 51d9ba7

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

helm-charts/charts/kube-starrocks/charts/starrocks/templates/starrockscluster.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ spec:
3030
{{- if .Values.starrocksFESpec.maxUnavailablePods }}
3131
updateStrategy:
3232
rollingUpdate:
33-
maxUnavailable: "{{ .Values.starrocksFESpec.maxUnavailablePods }}"
33+
maxUnavailable: {{ .Values.starrocksFESpec.maxUnavailablePods }}
3434
{{- end }}
3535
{{- /*
3636
support both resources and resource for backward compatibility
@@ -277,7 +277,7 @@ spec:
277277
{{- if .Values.starrocksBeSpec.maxUnavailablePods }}
278278
updateStrategy:
279279
rollingUpdate:
280-
maxUnavailable: "{{ .Values.starrocksBeSpec.maxUnavailablePods }}"
280+
maxUnavailable: {{ .Values.starrocksBeSpec.maxUnavailablePods }}
281281
{{- end }}
282282
{{- /*
283283
support both resources and resource for backward compatibility
@@ -556,7 +556,7 @@ spec:
556556
{{- if .Values.starrocksCnSpec.maxUnavailablePods }}
557557
updateStrategy:
558558
rollingUpdate:
559-
maxUnavailable: "{{ .Values.starrocksCnSpec.maxUnavailablePods }}"
559+
maxUnavailable: {{ .Values.starrocksCnSpec.maxUnavailablePods }}
560560
{{- end }}
561561
{{- if or .Values.starrocksCnSpec.serviceAccount .Values.starrocksCluster.componentValues.serviceAccount }}
562562
serviceAccount: {{ include "starrockscluster.cn.serviceAccount" . }}

pkg/common/resource_utils/statefulset.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ type hashStatefulsetObject struct {
3434
serviceName string
3535
volumeClaimTemplates []corev1.PersistentVolumeClaim
3636
replicas int32
37+
updateStrategy appv1.StatefulSetUpdateStrategy
3738
}
3839

3940
// StatefulsetHashObject construct the hash spec for deep equals to exist statefulset.
@@ -60,6 +61,7 @@ func statefulSetHashObject(sts *appv1.StatefulSet, excludeReplica bool) hashStat
6061
serviceName: sts.Spec.ServiceName,
6162
volumeClaimTemplates: sts.Spec.VolumeClaimTemplates,
6263
replicas: replicas,
64+
updateStrategy: sts.Spec.UpdateStrategy,
6365
}
6466
}
6567

@@ -91,8 +93,7 @@ func StatefulSetDeepEqual(new *appv1.StatefulSet, old *appv1.StatefulSet, exclud
9193

9294
// avoid the update from kubectl.
9395
return newHashv == oldHashv &&
94-
new.Namespace == old.Namespace /* &&
95-
oldGeneration == old.Generation*/
96+
new.Namespace == old.Namespace
9697
}
9798

9899
// MergeStatefulSets merge exist statefulset and new statefulset.

0 commit comments

Comments
 (0)