123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- {{- define "grafana.workload" -}}
- workload:
- grafana:
- enabled: true
- primary: true
- type: Deployment
- podSpec:
- hostNetwork: {{ .Values.grafanaNetwork.hostNetwork }}
- containers:
- grafana:
- enabled: true
- primary: true
- imageSelector: image
- securityContext:
- runAsUser: {{ .Values.grafanaRunAs.user }}
- runAsGroup: {{ .Values.grafanaRunAs.group }}
- envFrom:
- - configMapRef:
- name: grafana-config
- {{ with .Values.grafanaConfig.additionalEnvs }}
- envList:
- {{ range $env := . }}
- - name: {{ $env.name }}
- value: {{ $env.value }}
- {{ end }}
- {{ end }}
- probes:
- {{ $scheme := "http" }}
- {{ if .Values.grafanaNetwork.certificateID }}
- {{ $scheme = "https" }}
- {{ end }}
- liveness:
- enabled: true
- type: {{ $scheme }}
- port: {{ .Values.grafanaNetwork.webPort }}
- path: /api/health
- readiness:
- enabled: true
- type: {{ $scheme }}
- port: {{ .Values.grafanaNetwork.webPort }}
- path: /api/health
- startup:
- enabled: true
- type: {{ $scheme }}
- port: {{ .Values.grafanaNetwork.webPort }}
- path: /api/health
- initContainers:
- {{- include "ix.v1.common.app.permissions" (dict "containerName" "01-permissions"
- "UID" .Values.grafanaRunAs.user
- "GID" .Values.grafanaRunAs.group
- "mode" "check"
- "type" "install") | nindent 8 }}
- {{/* Service */}}
- service:
- grafana:
- enabled: true
- primary: true
- type: NodePort
- targetSelector: grafana
- ports:
- webui:
- enabled: true
- primary: true
- port: {{ .Values.grafanaNetwork.webPort }}
- nodePort: {{ .Values.grafanaNetwork.webPort }}
- targetSelector: grafana
- {{/* Persistence */}}
- persistence:
- data:
- enabled: true
- {{- include "grafana.storage.ci.migration" (dict "storage" .Values.grafanaStorage.data) }}
- {{- include "ix.v1.common.app.storageOptions" (dict "storage" .Values.grafanaStorage.data) | nindent 4 }}
- targetSelector:
- grafana:
- grafana:
- mountPath: /var/lib/grafana
- {{- if and (eq .Values.grafanaStorage.data.type "ixVolume")
- (not (.Values.grafanaStorage.data.ixVolumeConfig | default dict).aclEnable) }}
- 01-permissions:
- mountPath: /mnt/directories/data
- {{- end }}
- tmp:
- enabled: true
- type: emptyDir
- targetSelector:
- grafana:
- grafana:
- mountPath: /tmp
- {{- range $idx, $storage := .Values.grafanaStorage.additionalStorages }}
- {{ printf "grafana-%v:" (int $idx) }}
- enabled: true
- {{- include "grafana.storage.ci.migration" (dict "storage" $storage) }}
- {{- include "ix.v1.common.app.storageOptions" (dict "storage" $storage) | nindent 4 }}
- targetSelector:
- grafana:
- grafana:
- mountPath: {{ $storage.mountPath }}
- {{- if and (eq $storage.type "ixVolume") (not ($storage.ixVolumeConfig | default dict).aclEnable) }}
- 01-permissions:
- mountPath: /mnt/directories{{ $storage.mountPath }}
- {{- end }}
- {{- end }}
- {{- if .Values.grafanaNetwork.certificateID }}
- cert:
- enabled: true
- type: secret
- objectName: grafana-cert
- defaultMode: "0600"
- items:
- - key: tls.key
- path: tls.key
- - key: tls.crt
- path: tls.crt
- targetSelector:
- grafana:
- grafana:
- mountPath: /grafana/certs
- readOnly: true
- scaleCertificate:
- grafana-cert:
- enabled: true
- id: {{ .Values.grafanaNetwork.certificateID }}
- {{- end -}}
- {{- end -}}
- {{/* TODO: Remove on the next version bump, eg 1.2.0+ */}}
- {{- define "grafana.storage.ci.migration" -}}
- {{- $storage := .storage -}}
- {{- if $storage.hostPath -}}
- {{- $_ := set $storage "hostPathConfig" dict -}}
- {{- $_ := set $storage.hostPathConfig "hostPath" $storage.hostPath -}}
- {{- end -}}
- {{- end -}}
|