apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ template "fullname" . }}
  labels:
    app: {{ template "name" . }}
    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
spec:
  replicas: {{ .Values.replicaCount }}
  selector:
    matchLabels:
      app: {{ template "name" . }}
      release: {{ .Release.Name }}
  template:
    metadata:
      labels:
        app: {{ template "name" . }}
        release: {{ .Release.Name }}
    spec:
      containers:
        - name: {{ .Chart.Name }}
          image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
          imagePullPolicy: {{ .Values.image.pullPolicy }}
          securityContext:
            runAsNonRoot: true
          args:
          - -config=/config/config.json
          - -strict={{ .Values.strict }}
          volumeMounts:
          - name: config
            mountPath: /config
            readOnly: true
          readinessProbe:
            httpGet:
              path: /dir
              port: 14000
              scheme: HTTPS
            initialDelaySeconds: 1
            periodSeconds: 2
            failureThreshold: 10
            successThreshold: 1
          resources:
{{ toYaml .Values.resources | indent 12 }}
      volumes:
      - name: config
        configMap:
          name: {{ template "fullname" . }}
      {{- if .Values.nodeSelector }}
      nodeSelector:
{{ toYaml .Values.nodeSelector | indent 8 }}
    {{- end }}
      dnsConfig:
        options:
        - name: ndots
          value: "1"
