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
This commit is contained in:
Steve Wilkerson 2018-03-05 10:16:33 -06:00
parent d681396412
commit 934bef2f0d
5 changed files with 6 additions and 5 deletions

View File

@ -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 }}}"

View File

@ -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:

View File

@ -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:

View File

@ -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 }}

View File

@ -221,7 +221,6 @@ dependencies:
network:
grafana:
port: 3000
node_port:
enabled: false
port: 30902