Skip to content

Commit db8d5f9

Browse files
committed
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
1 parent 09a19a6 commit db8d5f9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pkg/metricstorage/dashboard_datasource.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package metricstorage
1919
import (
2020
"context"
2121

22+
"github.com/openstack-k8s-operators/lib-common/modules/common/clusterdns"
2223
telemetryv1 "github.com/openstack-k8s-operators/telemetry-operator/api/v1beta1"
2324
corev1 "k8s.io/api/core/v1"
2425
"k8s.io/apimachinery/pkg/types"
@@ -29,6 +30,7 @@ func DashboardDatasourceData(ctx context.Context, c client.Client, instance *tel
2930

3031
scheme := "http"
3132
certText := ""
33+
dnsDomain := clusterdns.GetDNSClusterDomain()
3234
if instance.Spec.PrometheusTLS.Enabled() {
3335
scheme = "https"
3436
namespacedName := types.NamespacedName{
@@ -55,6 +57,6 @@ spec:
5557
plugin:
5658
kind: "PrometheusDatasource"
5759
spec:
58-
direct_url: "` + scheme + `://metric-storage-prometheus.` + instance.Namespace + `.svc.cluster.local:9090"
60+
direct_url: "` + scheme + `://metric-storage-prometheus.` + instance.Namespace + `.svc.` + dnsDomain + `:9090"
5961
`}, nil
6062
}

0 commit comments

Comments
 (0)