From 044dc5c97ab4eca2b3492341e4f376a3f73a752a Mon Sep 17 00:00:00 2001 From: Arnau Verdaguer Date: Tue, 10 Dec 2024 12:52:21 +0100 Subject: [PATCH] Use dns cluster info from lib common get function Openshift coreDNS creates the domain name using an string located in dnses.operator.openshift.io. This string can change in the future, calling lib-common/GetDNSClusterDomain the responsability of gathering this information correctly only falls under lib-common intead of all operators. Resolves: OSPRH-3627 Depends-on: openstack-k8s-operators/lib-common#580 --- pkg/redis/statefulset.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/redis/statefulset.go b/pkg/redis/statefulset.go index f87263c0..700a3326 100644 --- a/pkg/redis/statefulset.go +++ b/pkg/redis/statefulset.go @@ -9,6 +9,7 @@ import ( appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "github.com/openstack-k8s-operators/lib-common/modules/clusterdns" "k8s.io/apimachinery/pkg/util/intstr" ) @@ -61,6 +62,7 @@ func StatefulSet( Port: intstr.IntOrString{Type: intstr.Int, IntVal: int32(26379)}, } name := r.Name + "-" + "redis" + clusterDomain := clusterdns.GetDNSClusterDomain() commonEnvVars := []corev1.EnvVar{{ Name: "KOLLA_CONFIG_STRATEGY", @@ -69,8 +71,7 @@ func StatefulSet( Name: "SVC_FQDN", // https://github.com/kubernetes/dns/blob/master/docs/specification.md // Headless services only publish dns entries that include cluster domain. - // For the time being, assume this is .cluster.local - Value: name + "." + r.GetNamespace() + ".svc.cluster.local", + Value: name + "." + r.GetNamespace() + ".svc." + clusterDomain, }, { Name: "CONFIG_HASH", Value: configHash,