Skip to content

Commit 56242c9

Browse files
author
guozhi.li
committed
add rf Annotations to sts
1 parent 94d7492 commit 56242c9

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

operator/redisfailover/service/generator.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ func generateRedisStatefulSet(rf *redisfailoverv1.RedisFailover, labels map[stri
280280

281281
ss := &appsv1.StatefulSet{
282282
ObjectMeta: metav1.ObjectMeta{
283+
Annotations: rf.Annotations,
283284
Name: name,
284285
Namespace: namespace,
285286
Labels: labels,

service/k8s/statefulset.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import (
55
"fmt"
66
"strings"
77

8+
"github.com/spotahome/redis-operator/operator/redisfailover/util"
9+
810
appsv1 "k8s.io/api/apps/v1"
911
corev1 "k8s.io/api/core/v1"
1012
"k8s.io/apimachinery/pkg/api/errors"
@@ -99,6 +101,7 @@ func (s *StatefulSetService) CreateOrUpdateStatefulSet(namespace string, statefu
99101
// namespace is our spec(https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#concurrency-control-and-consistency),
100102
// we will replace the current namespace state.
101103
statefulSet.ResourceVersion = storedStatefulSet.ResourceVersion
104+
statefulSet.Annotations = util.MergeLabels(statefulSet.Annotations, storedStatefulSet.Annotations)
102105
return s.UpdateStatefulSet(namespace, statefulSet)
103106
}
104107

0 commit comments

Comments
 (0)