Skip to content

set updateStrategy OnDelete for Storage StatefulSet by default #297

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changes/unreleased/Changed-20250224-104818.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
kind: Changed
body: 'set updateStrategy: OnDelete for Storage StatefulSet by default'
time: 2025-02-24T10:48:18.815104+08:00
2 changes: 1 addition & 1 deletion internal/resources/database_statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (b *DatabaseStatefulSetBuilder) Build(obj client.Object) error {

if value, ok := b.ObjectMeta.Annotations[api.AnnotationUpdateStrategyOnDelete]; ok && value == api.AnnotationValueTrue {
sts.Spec.UpdateStrategy = appsv1.StatefulSetUpdateStrategy{
Type: "OnDelete",
Type: appsv1.OnDeleteStatefulSetStrategyType,
}
}

Expand Down
9 changes: 3 additions & 6 deletions internal/resources/storage_statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,15 @@ func (b *StorageStatefulSetBuilder) Build(obj client.Object) error {
labels.StatefulsetComponent: b.Name,
},
},
UpdateStrategy: appsv1.StatefulSetUpdateStrategy{
Type: appsv1.OnDeleteStatefulSetStrategyType,
},
PodManagementPolicy: appsv1.ParallelPodManagement,
RevisionHistoryLimit: ptr.Int32(10),
ServiceName: fmt.Sprintf(InterconnectServiceNameFormat, b.Storage.Name),
Template: b.buildPodTemplateSpec(),
}

if value, ok := b.ObjectMeta.Annotations[api.AnnotationUpdateStrategyOnDelete]; ok && value == api.AnnotationValueTrue {
sts.Spec.UpdateStrategy = appsv1.StatefulSetUpdateStrategy{
Type: "OnDelete",
}
}

pvcList := make([]corev1.PersistentVolumeClaim, 0, len(b.Spec.DataStore))
for i, pvcSpec := range b.Spec.DataStore {
pvcList = append(
Expand Down
Loading