From 13efedc1fabf8696cfa5c78934c917ae7788a329 Mon Sep 17 00:00:00 2001 From: Colin Walker Date: Sat, 7 Sep 2019 04:45:09 +0000 Subject: [PATCH] feat: Add workers Add workers to run side processes to an application. --- charts/app/templates/workers.yaml | 70 +++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 charts/app/templates/workers.yaml 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 }}