From 0f6c47d12fb307581937bd04cc21deb58bb998d6 Mon Sep 17 00:00:00 2001 From: Arnau Verdaguer Date: Mon, 2 Dec 2024 17:44:59 +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/metricstorage/dashboard_datasource.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/metricstorage/dashboard_datasource.go b/pkg/metricstorage/dashboard_datasource.go index 72199d01..36bcf263 100644 --- a/pkg/metricstorage/dashboard_datasource.go +++ b/pkg/metricstorage/dashboard_datasource.go @@ -21,6 +21,7 @@ import ( telemetryv1 "github.com/openstack-k8s-operators/telemetry-operator/api/v1beta1" corev1 "k8s.io/api/core/v1" + "github.com/openstack-k8s-operators/lib-common/modules/common/clusterdns" "k8s.io/apimachinery/pkg/types" "sigs.k8s.io/controller-runtime/pkg/client" ) @@ -29,6 +30,7 @@ func DashboardDatasourceData(ctx context.Context, c client.Client, instance *tel scheme := "http" certText := "" + dnsDomain := clusterdns.GetDNSClusterDomain() if instance.Spec.PrometheusTLS.Enabled() { scheme = "https" namespacedName := types.NamespacedName{ @@ -55,6 +57,6 @@ spec: plugin: kind: "PrometheusDatasource" spec: - direct_url: "` + scheme + `://metric-storage-prometheus.` + instance.Namespace + `.svc.cluster.local:9090" + direct_url: "` + scheme + `://metric-storage-prometheus.` + instance.Namespace + `.svc.` + dnsDomain + `":9090" `}, nil }