Skip to content

Commit

Permalink
feat: Add workers
Browse files Browse the repository at this point in the history
Add workers to run side processes to an application.
  • Loading branch information
colinjfw committed Sep 7, 2019
1 parent 10d3007 commit 13efedc
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions charts/app/templates/workers.yaml
Original file line number Diff line number Diff line change
@@ -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 }}

0 comments on commit 13efedc

Please # to comment.