Skip to content

Commit

Permalink
Use dns cluster info from lib common get function
Browse files Browse the repository at this point in the history
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
  • Loading branch information
averdagu committed Dec 2, 2024
1 parent 283a3d4 commit 0f6c47d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/metricstorage/dashboard_datasource.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -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{
Expand All @@ -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
}

0 comments on commit 0f6c47d

Please sign in to comment.