diff --git a/charts/app/templates/workers.yaml b/charts/app/templates/workers.yaml new file mode 100644 index 00000000..e8de09ad --- /dev/null +++ b/charts/app/templates/workers.yaml @@ -0,0 +1,70 @@ +{{- range $index, $worker := .Values.workers }} +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "app.fullname" $ }}-{{ $worker.name }} + namespace: {{ $.Release.Namespace }} + annotations: + "deliverybot.io/secret-checksum": {{ toJson $.Values.secrets | sha256sum }} + labels: + app.kubernetes.io/component: {{ $worker.name }} +{{ include "app.labels" $ | indent 4 }} +spec: + replicas: {{ $worker.replicaCount }} + selector: + matchLabels: + app.kubernetes.io/component: {{ $worker.name }} +{{ include "app.matchLabels" $ | indent 6 }} + template: + metadata: + labels: + app.kubernetes.io/component: {{ $worker.name }} +{{ include "app.matchLabels" $ | indent 8 }} + spec: + {{- with $.Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml $ | nindent 8 }} + {{- end }} + containers: + - name: {{ $.Chart.Name }} + image: "{{ $.Values.image.repository }}:{{ $.Values.image.tag }}" + imagePullPolicy: {{ $.Values.image.pullPolicy }} + command: {{ toJson $worker.command }} + args: {{ toJson $worker.args }} + envFrom: + - secretRef: + name: {{ include "app.fullname" $ }} + {{ with $.Values.env }} + env: + {{- toYaml . | nindent 12 }} + {{- end }} + ports: + - name: http + containerPort: {{ $.Values.service.internalPort }} + protocol: TCP + {{ with $.Values.readinessProbe }} + readinessProbe: + {{- toYaml . | nindent 12 }} + {{- end -}} + {{- with $.Values.livenessProbe }} + livenessProbe: + {{- toYaml . | nindent 12 }} + {{- end -}} + {{- with $.Values.resources }} + resources: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with $.Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with $.Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with $.Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} +{{- end }}