apiVersion: apps/v1beta2
kind: Deployment
metadata:
  name: {{ include "passbook.fullname" . }}-static
  labels:
    app.kubernetes.io/name: {{ include "passbook.name" . }}
    helm.sh/chart: {{ include "passbook.chart" . }}
    app.kubernetes.io/instance: {{ .Release.Name }}
    app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: {{ include "passbook.name" . }}
      app.kubernetes.io/instance: {{ .Release.Name }}
  template:
    metadata:
      labels:
        app.kubernetes.io/name: {{ include "passbook.name" . }}
        app.kubernetes.io/instance: {{ .Release.Name }}
        k8s.passbook.io/component: static
      annotations:
        prometheus.io/scrape: "true"
        prometheus.io/port: '9113'
        field.cattle.io/workloadMetrics: '[{"path":"/metrics","port":9113,"schema":"HTTP"}]'
    spec:
      containers:
        - name: {{ .Chart.Name }}-static
          image: "docker.beryju.org/passbook/static:{{ .Values.image.tag }}"
          imagePullPolicy: IfNotPresent
          ports:
            - name: http
              containerPort: 80
              protocol: TCP
          livenessProbe:
            initialDelaySeconds: 10
            timeoutSeconds: 5
            httpGet:
              path: /_/healthz
              port: http
          readinessProbe:
            initialDelaySeconds: 10
            timeoutSeconds: 5
            httpGet:
              path: /_/healthz
              port: http
          resources:
            requests:
              cpu: 10m
              memory: 10M
            limits:
              cpu: 20m
              memory: 20M
        - name: {{ .Chart.Name }}-static-prometheus
          image: nginx/nginx-prometheus-exporter:0.4.1
          imagePullPolicy: IfNotPresent