From 22a59ba29509065416b44dfc7f9c74454c8325e3 Mon Sep 17 00:00:00 2001 From: David ALEXANDRE <9482408+david972@users.noreply.github.com> Date: Tue, 19 Sep 2023 12:12:57 +0200 Subject: [PATCH] Templating prometheus url into cronjob heartbeat (#11343) Can not use external prometheus with hearbeat. This change adds a new variable `.prometheusUrl` in value and use it into heartbeat from linkerd-control-plane chart. Fixes #11342 Signed-off-by: David ALEXANDRE --- charts/linkerd-control-plane/templates/heartbeat.yaml | 4 ++++ charts/linkerd-control-plane/values.yaml | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/charts/linkerd-control-plane/templates/heartbeat.yaml b/charts/linkerd-control-plane/templates/heartbeat.yaml index f90875fe8abb6..aa43874fb19d4 100644 --- a/charts/linkerd-control-plane/templates/heartbeat.yaml +++ b/charts/linkerd-control-plane/templates/heartbeat.yaml @@ -64,7 +64,11 @@ spec: - "-controller-namespace={{.Release.Namespace}}" - "-log-level={{.Values.controllerLogLevel}}" - "-log-format={{.Values.controllerLogFormat}}" + {{- if .Values.prometheusUrl }} + - "-prometheus-url={{.Values.prometheusUrl}}" + {{- else }} - "-prometheus-url=http://prometheus.linkerd-viz.svc.{{.Values.clusterDomain}}:9090" + {{- end }} {{- if .Values.heartbeatResources -}} {{- include "partials.resources" .Values.heartbeatResources | nindent 12 }} {{- end }} diff --git a/charts/linkerd-control-plane/values.yaml b/charts/linkerd-control-plane/values.yaml index 90d6832b57521..c055b5bc57154 100644 --- a/charts/linkerd-control-plane/values.yaml +++ b/charts/linkerd-control-plane/values.yaml @@ -521,7 +521,7 @@ policyValidator: # for more information. injectCaFromSecret: "" -# -|- CPU, Memory and Ephemeral Storage resources required by the policy controller +# -|- CPU, Memory and Ephemeral Storage resources required by the policy controller #policyControllerResources: # -- NodeSelector section, See the [K8S @@ -544,6 +544,9 @@ nodeSelector: # for more information #nodeAffinity: +# -- url of external prometheus instance (used for the heartbeat) +prometheusUrl: "" + # Prometheus Operator PodMonitor configuration podMonitor: # -- Enables the creation of Prometheus Operator [PodMonitor](https://prometheus-operator.dev/docs/operator/api/#monitoring.coreos.com/v1.PodMonitor)