{{- if .Values.policies.monitoring.enabled }}
apiVersion: apps/v1beta1
kind: Deployment
metadata:
  name: {{ template "openebs.fullname" . }}-grafana
  labels:
    app: {{ template "openebs.name" . }}
    chart: {{ template "openebs.chart" . }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
    component: grafana
spec:
  replicas: 1
  revisionHistoryLimit: 2
  template:
    metadata:
      labels:
        app: {{ template "openebs.name" . }}
        release: {{ .Release.Name }}
        component: grafana
    spec:
      serviceAccountName: {{ template "openebs.serviceAccountName" . }}
      containers:
      - name: {{ template "openebs.name" . }}-grafana
        image: "{{ .Values.grafana.image }}:{{ .Values.grafana.imageTag }}"
        ports:
        - containerPort: {{ .Values.grafana.ports.internalPort }}
        env:
          - name: GF_AUTH_BASIC_ENABLED
            value: "true"
          - name: GF_AUTH_ANONYMOUS_ENABLED
            value: "false"
        livenessProbe:
          httpGet:
            path: /
            port: {{ .Values.grafana.ports.internalPort }}
          initialDelaySeconds: 30
          timeoutSeconds: 1
{{- end }}
