apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "app.fullname" . }}
  labels:
    {{- include "app.labels" . | nindent 4 }}
spec:
  replicas: {{ .Values.replicaCount }}
  selector:
    matchLabels:
      {{- include "app.selectorLabels" . | nindent 6 }}
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        {{- include "app.selectorLabels" . | nindent 8 }}
    spec:
      serviceAccountName: {{ include "app.serviceAccountName" . }}
      securityContext:
        {{- toYaml .Values.podSecurityContext | nindent 8 }}
      containers:
        - name: {{ .Chart.Name }}
          securityContext:
            {{- toYaml .Values.securityContext | nindent 12 }}
          image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
          #imagePullPolicy: {{ .Values.image.pullPolicy }}
          args:
            - --source=service
            - --source=ingress
            - --domain-filter={{ .Values.externaldns.domainfilter }}
            - --provider={{ .Values.externaldns.provider }}
          volumeMounts:
            - name: {{ .Values.volumeAndSecretname }}
              mountPath: /etc/kubernetes
              readOnly: true
      volumes:
        - name: {{ .Values.volumeAndSecretname }}
          secret:
            secretName: {{ .Values.volumeAndSecretname }}