diff --git a/k8sutils/redis-cluster.go b/k8sutils/redis-cluster.go index 6e667dc46..241fd338f 100644 --- a/k8sutils/redis-cluster.go +++ b/k8sutils/redis-cluster.go @@ -187,6 +187,8 @@ func (service RedisClusterService) CreateRedisClusterService(cr *redisv1beta1.Re annotations := generateServiceAnots(cr.ObjectMeta, nil) if cr.Spec.RedisExporter != nil && cr.Spec.RedisExporter.Enabled { enableMetrics = true + } else { + enableMetrics = false } additionalServiceAnnotations := map[string]string{} if cr.Spec.KubernetesConfig.Service != nil { diff --git a/k8sutils/redis-replication.go b/k8sutils/redis-replication.go index 0c825fd83..1cb6a8790 100644 --- a/k8sutils/redis-replication.go +++ b/k8sutils/redis-replication.go @@ -11,6 +11,8 @@ func CreateReplicationService(cr *redisv1beta1.RedisReplication) error { annotations := generateServiceAnots(cr.ObjectMeta, nil) if cr.Spec.RedisExporter != nil && cr.Spec.RedisExporter.Enabled { enableMetrics = true + } else { + enableMetrics = false } additionalServiceAnnotations := map[string]string{} if cr.Spec.KubernetesConfig.Service != nil { diff --git a/k8sutils/redis-sentinel.go b/k8sutils/redis-sentinel.go index fb2c4731b..4f6bd9ec8 100644 --- a/k8sutils/redis-sentinel.go +++ b/k8sutils/redis-sentinel.go @@ -166,6 +166,8 @@ func (service RedisSentinelService) CreateRedisSentinelService(cr *redisv1beta1. if cr.Spec.RedisExporter != nil && cr.Spec.RedisExporter.Enabled { enableMetrics = true + } else { + enableMetrics = false } additionalServiceAnnotations := map[string]string{} if cr.Spec.KubernetesConfig.Service != nil { diff --git a/k8sutils/redis-standalone.go b/k8sutils/redis-standalone.go index 4fe96f9f7..fd7cf97d1 100644 --- a/k8sutils/redis-standalone.go +++ b/k8sutils/redis-standalone.go @@ -15,6 +15,8 @@ func CreateStandaloneService(cr *redisv1beta1.Redis) error { annotations := generateServiceAnots(cr.ObjectMeta, nil) if cr.Spec.RedisExporter != nil && cr.Spec.RedisExporter.Enabled { enableMetrics = true + } else { + enableMetrics = false } additionalServiceAnnotations := map[string]string{} if cr.Spec.KubernetesConfig.Service != nil {