apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "photos.fullname" . }}-worker
  labels:
    {{- include "photos.labels" . | nindent 4 }}
    app.kubernetes.io/component: worker
spec:
  replicas: {{ .Values.worker.replicas }}
  selector:
    matchLabels:
      app.kubernetes.io/name: photos
      app.kubernetes.io/instance: {{ .Release.Name }}
      app.kubernetes.io/component: worker
  template:
    metadata:
      labels:
        {{- include "photos.labels" . | nindent 8 }}
        app.kubernetes.io/component: worker
    spec:
      containers:
        - name: worker
          image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
          imagePullPolicy: {{ .Values.image.pullPolicy }}
          command: ["worker"]
          env:
            {{- include "photos.env" . | nindent 12 }}
            - name: WORKER_CONCURRENCY
              value: {{ .Values.worker.concurrency | quote }}
          envFrom:
            - secretRef:
                name: {{ include "photos.secretName" . }}
          resources:
            {{- toYaml .Values.worker.resources | nindent 12 }}
