linkerd2/viz/charts/linkerd-viz/templates/grafana.yaml

173 lines
5.0 KiB
YAML

{{ if .Values.grafana.enabled -}}
---
###
### Grafana
###
kind: ConfigMap
apiVersion: v1
metadata:
name: linkerd-grafana-config
namespace: {{.Values.namespace}}
labels:
{{.Values.extensionAnnotation}}: linkerd-viz
component: grafana
namespace: {{.Values.namespace}}
annotations:
{{.Values.createdByAnnotation}}: {{default (printf "linkerd/helm %s" .Values.linkerdVersion) .Values.cliVersion}}
data:
grafana.ini: |-
instance_name = linkerd-grafana
[server]
root_url = %(protocol)s://%(domain)s:/grafana/
[auth]
disable_login_form = true
[auth.anonymous]
enabled = true
org_role = Editor
[auth.basic]
enabled = false
[analytics]
check_for_updates = false
[panels]
disable_sanitize_html = true
datasources.yaml: |-
apiVersion: 1
datasources:
- name: prometheus
type: prometheus
access: proxy
orgId: 1
{{- if .Values.prometheusUrl }}
url: {{.Values.prometheusUrl}}
{{- else }}
url: http://linkerd-prometheus.{{.Values.namespace}}.svc.{{.Values.clusterDomain}}:9090
{{- end }}
isDefault: true
jsonData:
timeInterval: "5s"
version: 1
editable: true
dashboards.yaml: |-
apiVersion: 1
providers:
- name: 'default'
orgId: 1
folder: ''
type: file
disableDeletion: true
editable: true
options:
path: /var/lib/grafana/dashboards
homeDashboardId: linkerd-top-line
---
kind: Service
apiVersion: v1
metadata:
name: linkerd-grafana
namespace: {{.Values.namespace}}
labels:
{{.Values.extensionAnnotation}}: linkerd-viz
component: grafana
namespace: {{.Values.namespace}}
annotations:
{{.Values.createdByAnnotation}}: {{default (printf "linkerd/helm %s" .Values.linkerdVersion) .Values.cliVersion}}
spec:
type: ClusterIP
selector:
{{.Values.extensionAnnotation}}: linkerd-viz
component: grafana
ports:
- name: http
port: 3000
targetPort: 3000
---
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
{{.Values.createdByAnnotation}}: {{default (printf "linkerd/helm %s" .Values.linkerdVersion) .Values.cliVersion}}
labels:
{{.Values.extensionAnnotation}}: linkerd-viz
app.kubernetes.io/name: grafana
app.kubernetes.io/part-of: Linkerd
app.kubernetes.io/version: {{default .Values.linkerdVersion .Values.controllerImageVersion}}
component: grafana
namespace: {{.Values.namespace}}
name: linkerd-grafana
namespace: {{.Values.namespace}}
spec:
replicas: 1
selector:
matchLabels:
{{.Values.extensionAnnotation}}: linkerd-viz
component: grafana
namespace: {{.Values.namespace}}
template:
metadata:
annotations:
{{.Values.createdByAnnotation}}: {{default (printf "linkerd/helm %s" .Values.linkerdVersion) .Values.cliVersion}}
{{- with .Values.grafana.proxy }}
{{- include "partials.proxy.config.annotations" .resources | nindent 8 }}
{{- end }}
{{- with .Values.podAnnotations }}{{ toYaml . | trim | nindent 8 }}{{- end }}
labels:
{{.Values.extensionAnnotation}}: linkerd-viz
component: grafana
namespace: {{.Values.namespace}}
{{- with .Values.podLabels }}{{ toYaml . | trim | nindent 8 }}{{- end }}
spec:
{{- if .Values.tolerations -}}
{{- include "linkerd.tolerations" . | nindent 6 }}
{{- end -}}
{{- include "linkerd.node-selector" . | nindent 6 }}
containers:
- env:
- name: GF_PATHS_DATA
value: /data
# Force using the go-based DNS resolver instead of the OS' to avoid failures in some environments
# see https://github.com/grafana/grafana/issues/20096
- name: GODEBUG
value: netdns=go
image: {{.Values.grafana.image.registry}}/{{.Values.grafana.image.name}}:{{.Values.grafana.image.tag}}
imagePullPolicy: {{.Values.imagePullPolicy}}
livenessProbe:
httpGet:
path: /api/health
port: 3000
initialDelaySeconds: 30
name: grafana
ports:
- containerPort: 3000
name: http
readinessProbe:
httpGet:
path: /api/health
port: 3000
{{- if .Values.grafana.resources -}}
{{- include "partials.resources" .Values.grafana.resources | nindent 8 }}
{{- end }}
securityContext:
runAsUser: 472
volumeMounts:
- mountPath: /data
name: data
- mountPath: /etc/grafana
name: grafana-config
readOnly: true
serviceAccountName: linkerd-grafana
volumes:
- emptyDir: {}
name: data
- configMap:
items:
- key: grafana.ini
path: grafana.ini
- key: datasources.yaml
path: provisioning/datasources/datasources.yaml
- key: dashboards.yaml
path: provisioning/dashboards/dashboards.yaml
name: linkerd-grafana-config
name: grafana-config
{{ end -}}