From 934bef2f0daf00017ea5dd09de5963a2a8f60fb9 Mon Sep 17 00:00:00 2001 From: Steve Wilkerson Date: Mon, 5 Mar 2018 10:16:33 -0600 Subject: [PATCH] Grafana: use endpoints section and lookups to set port This PS moves grafana to use the endpoints section and lookups to set the port it serves on. Change-Id: I51d4c10297f3423569539dcbf7fbecad24d5e47f --- grafana/templates/bin/_datasource.sh.tpl | 2 +- grafana/templates/deployment.yaml | 4 ++-- grafana/templates/job-prometheus-datasource.yaml | 2 ++ grafana/templates/service.yaml | 2 +- grafana/values.yaml | 1 - 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/grafana/templates/bin/_datasource.sh.tpl b/grafana/templates/bin/_datasource.sh.tpl index 4db9ec2cd..2176f282d 100644 --- a/grafana/templates/bin/_datasource.sh.tpl +++ b/grafana/templates/bin/_datasource.sh.tpl @@ -17,7 +17,7 @@ limitations under the License. set -ex -exec curl "http://${GF_SECURITY_ADMIN_USER}:${GF_SECURITY_ADMIN_PASSWORD}@${GRAFANA_SERVICE}:{{ .Values.network.grafana.port }}/api/datasources" \ +exec curl "http://${GF_SECURITY_ADMIN_USER}:${GF_SECURITY_ADMIN_PASSWORD}@${GRAFANA_SERVICE}:${GRAFANA_PORT}/api/datasources" \ -H "Content-Type: application/json;charset=UTF-8" --data-binary \ {{- with .Values.conf.datasource }} "{\"name\":\"{{ .name }}\",\"type\":\"{{ .type }}\",\"url\":\"$PROMETHEUS_URL\",\"database\":\"{{ .database }}\",\"jsonData\":{ {{ .jsonData }} },\"access\":\"{{ .access }}\",\"isDefault\":{{ .isDefault }}}" diff --git a/grafana/templates/deployment.yaml b/grafana/templates/deployment.yaml index 5a263554e..7ec2d315b 100644 --- a/grafana/templates/deployment.yaml +++ b/grafana/templates/deployment.yaml @@ -57,11 +57,11 @@ spec: - start ports: - name: dashboard - containerPort: {{ .Values.network.grafana.port }} + containerPort: {{ tuple "grafana" "internal" "grafana" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} readinessProbe: httpGet: path: /login - port: 3000 + port: {{ tuple "grafana" "internal" "grafana" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} initialDelaySeconds: 30 timeoutSeconds: 30 env: diff --git a/grafana/templates/job-prometheus-datasource.yaml b/grafana/templates/job-prometheus-datasource.yaml index 9c923f727..f61d5a489 100644 --- a/grafana/templates/job-prometheus-datasource.yaml +++ b/grafana/templates/job-prometheus-datasource.yaml @@ -56,6 +56,8 @@ spec: key: GRAFANA_ADMIN_PASSWORD - name: GRAFANA_SERVICE value: {{ tuple "grafana" "internal" $envAll | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }} + - name: GRAFANA_PORT + value: {{ tuple "grafana" "internal" "grafana" . | include "helm-toolkit.endpoints.endpoint_port_lookup" | quote }} - name: PROMETHEUS_URL value: {{ tuple "monitoring" "internal" "api" $envAll | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup" }} volumeMounts: diff --git a/grafana/templates/service.yaml b/grafana/templates/service.yaml index 3255f7ae3..abcf43ecc 100644 --- a/grafana/templates/service.yaml +++ b/grafana/templates/service.yaml @@ -24,7 +24,7 @@ metadata: spec: ports: - name: dashboard - port: {{ .Values.network.grafana.port }} + port: {{ tuple "grafana" "internal" "grafana" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} {{ if .Values.network.grafana.node_port.enabled }} nodePort: {{ .Values.network.grafana.node_port.port }} {{ end }} diff --git a/grafana/values.yaml b/grafana/values.yaml index 8fc333814..d0fb39f95 100644 --- a/grafana/values.yaml +++ b/grafana/values.yaml @@ -221,7 +221,6 @@ dependencies: network: grafana: - port: 3000 node_port: enabled: false port: 30902