Skip to content
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

[Feature] - Auto recreate redis replication statefulset when update failed #586

Merged
merged 1 commit into from
Aug 20, 2023
Merged
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
5 changes: 5 additions & 0 deletions k8sutils/const.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package k8sutils

const (
AnnotationKeyRecreateStatefulset = "redis.opstreelabs.in/recreate-statefulset"
)
2 changes: 1 addition & 1 deletion k8sutils/redis-cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func generateRedisClusterParams(cr *redisv1beta1.RedisCluster, replicas int32, e
if externalConfig != nil {
res.ExternalConfig = externalConfig
}
if _, found := cr.ObjectMeta.GetAnnotations()["redis.opstreelabs.in/recreate-statefulset"]; found {
if _, found := cr.ObjectMeta.GetAnnotations()[AnnotationKeyRecreateStatefulset]; found {
res.RecreateStatefulSet = true
}
return res
Expand Down
3 changes: 3 additions & 0 deletions k8sutils/redis-replication.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ func generateRedisReplicationParams(cr *redisv1beta1.RedisReplication) statefulS
if cr.Spec.ServiceAccountName != nil {
res.ServiceAccountName = cr.Spec.ServiceAccountName
}
if _, found := cr.ObjectMeta.GetAnnotations()[AnnotationKeyRecreateStatefulset]; found {
res.RecreateStatefulSet = true
}
return res
}

Expand Down
2 changes: 1 addition & 1 deletion k8sutils/redis-standalone.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func generateRedisStandaloneParams(cr *redisv1beta1.Redis) statefulSetParameters
if cr.Spec.ServiceAccountName != nil {
res.ServiceAccountName = cr.Spec.ServiceAccountName
}
if _, found := cr.ObjectMeta.GetAnnotations()["redis.opstreelabs.in/recreate-statefulset"]; found {
if _, found := cr.ObjectMeta.GetAnnotations()[AnnotationKeyRecreateStatefulset]; found {
res.RecreateStatefulSet = true
}
return res
Expand Down