From abce2b1a367de1b6d5a01acbdec026f85f284c88 Mon Sep 17 00:00:00 2001 From: syedsadath-17 <90619459+sadath-12@users.noreply.github.com> Date: Fri, 7 Apr 2023 13:42:42 +0530 Subject: [PATCH] fix: exporter ports enabled even when exporters disabled (#484) * fix: exporter ports enabled even when exporters disabled Signed-off-by: sadath-12 * fix: dependency issues Signed-off-by: sadath-12 --------- Signed-off-by: sadath-12 Signed-off-by: guozhi.li --- k8sutils/redis-cluster.go | 2 ++ k8sutils/redis-replication.go | 2 ++ k8sutils/redis-sentinel.go | 2 ++ k8sutils/redis-standalone.go | 2 ++ 4 files changed, 8 insertions(+) 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 6ff1e0753..41b89e905 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 {