linkerd2/chart/templates/grafana.yaml

150 lines
3.2 KiB
YAML

{{with .Values -}}
---
###
### Grafana
###
---
kind: ServiceAccount
apiVersion: v1
metadata:
name: linkerd-grafana
namespace: {{.Namespace}}
---
kind: ConfigMap
apiVersion: v1
metadata:
name: linkerd-grafana-config
namespace: {{.Namespace}}
labels:
{{.ControllerComponentLabel}}: grafana
annotations:
{{.CreatedByAnnotation}}: {{.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
datasources.yaml: |-
apiVersion: 1
datasources:
- name: prometheus
type: prometheus
access: proxy
orgId: 1
url: http://linkerd-prometheus.{{.Namespace}}.svc.cluster.local:9090
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: {{.Namespace}}
labels:
{{.ControllerComponentLabel}}: grafana
annotations:
{{.CreatedByAnnotation}}: {{.CliVersion}}
spec:
type: ClusterIP
selector:
{{.ControllerComponentLabel}}: grafana
ports:
- name: http
port: 3000
targetPort: 3000
---
kind: Deployment
apiVersion: extensions/v1beta1
metadata:
name: linkerd-grafana
namespace: {{.Namespace}}
labels:
{{.ControllerComponentLabel}}: grafana
annotations:
{{.CreatedByAnnotation}}: {{.CliVersion}}
spec:
replicas: 1
template:
metadata:
labels:
{{.ControllerComponentLabel}}: grafana
annotations:
{{.CreatedByAnnotation}}: {{.CliVersion}}
spec:
volumes:
- name: data
emptyDir: {}
- name: grafana-config
configMap:
name: linkerd-grafana-config
items:
- key: grafana.ini
path: grafana.ini
- key: datasources.yaml
path: provisioning/datasources/datasources.yaml
- key: dashboards.yaml
path: provisioning/dashboards/dashboards.yaml
containers:
- name: grafana
ports:
- name: http
containerPort: 3000
env:
- name: GF_PATHS_DATA
value: /data
volumeMounts:
- name: data
mountPath: /data
- name: grafana-config
mountPath: /etc/grafana
readOnly: true
image: {{.GrafanaImage}}
imagePullPolicy: {{.ImagePullPolicy}}
livenessProbe:
httpGet:
path: /api/health
port: 3000
initialDelaySeconds: 30
readinessProbe:
httpGet:
path: /api/health
port: 3000
{{- with .GrafanaResources }}
{{- template "resources" . }}
{{- end }}
securityContext:
runAsUser: 472
serviceAccountName: linkerd-grafana
{{end -}}