apiVersion: "apps/v1"
kind: "Deployment"
metadata:
  labels:
    component: "server"
    metrics: "prometheus"
  name: "{{ .Release.Name }}"
  namespace: "{{ .Release.Namespace }}"
spec:
  selector:
    matchLabels:
      component: "server"
      metrics: "prometheus"
  replicas: 1
  template:
    metadata:
      labels:
        component: "server"
        metrics: "prometheus"
    spec:
      containers:
        - name: "prometheus"
          image: "prom/prometheus:v2.21.0"
          imagePullPolicy: "IfNotPresent"
          args:
            - --storage.tsdb.retention.time=15d
            - --config.file=/etc/config/prometheus.yml
            - --storage.tsdb.path=/data
            - --web.console.libraries=/etc/prometheus/console_libraries
            - --web.console.templates=/etc/prometheus/consoles
            - --web.enable-lifecycle
          ports:
            - containerPort: 9090
          readinessProbe:
            httpGet:
              path: "/-/ready"
              port: 9090
            initialDelaySeconds: 30
            timeoutSeconds: 30
            failureThreshold: 3
            successThreshold: 1
          livenessProbe:
            httpGet:
              path: "/-/healthy"
              port: 9090
            initialDelaySeconds: 30
            timeoutSeconds: 30
            failureThreshold: 3
            successThreshold: 1
          resources: {}
          volumeMounts:
            - name: "config"
              mountPath: "/etc/config"
            - name: "storage"
              mountPath: "/data"
      securityContext:
        fsGroup: 65534
        runAsGroup: 65534
        runAsNonRoot: true
        runAsUser: 65534
      serviceAccountName: "prometheus"
      terminationGracePeriodSeconds: 300
      volumes:
        - name: "config"
          configMap:
            name: "{{ .Release.Name }}"
        - name: "storage"
          emptyDir: {}
