apiVersion: apps/v1
kind: Deployment

metadata:
  name: {{ template "phpldapadmin.fullname" . }}
  labels:
    app: {{ template "phpldapadmin.name" . }}
    chart: {{ template "phpldapadmin.chart" . }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}

spec:
  replicas: {{ .Values.replicaCount }}
  selector:
    matchLabels:
      app: {{ template "phpldapadmin.name" . }}
      release: {{ .Release.Name }}
  template:
    metadata:
      labels:
        app: {{ template "phpldapadmin.name" . }}
        release: {{ .Release.Name }}
    spec:
      containers:
      - name: {{ .Chart.Name }}
        image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
        imagePullPolicy: {{ .Values.image.pullPolicy }}
        ports:
        - name: http
          containerPort: 80
          protocol: TCP
        envFrom:
        - configMapRef:
            name: {{ template "phpldapadmin.fullname" . }}
        livenessProbe:
{{ toYaml .Values.livenessProbe | indent 12 }}
        readinessProbe:
{{ toYaml .Values.readinessProbe | indent 12 }}
        resources:
{{ toYaml .Values.resources | indent 12 }}
    {{- with .Values.nodeSelector }}
      nodeSelector:
{{ toYaml . | indent 8 }}
    {{- end }}
    {{- with .Values.affinity }}
      affinity:
{{ toYaml . | indent 8 }}
    {{- end }}
    {{- with .Values.tolerations }}
      tolerations:
{{ toYaml . | indent 8 }}
    {{- end }}
