194 lines
6.8 KiB
YAML
194 lines
6.8 KiB
YAML
{{- range .Values.workers }}
|
|
---
|
|
apiVersion: {{ include "deployment.apiVersion" $ }}
|
|
kind: Deployment
|
|
metadata:
|
|
name: "{{ $.Release.Name }}-{{ .name | default $.Values.workerTemplate.name }}"
|
|
labels:
|
|
{{- include "polymorphic-app.labels" $ | nindent 4 }}
|
|
app.kubernetes.io/component: {{ $.Release.Name }}-{{ .name | default $.Values.workerTemplate.name }}
|
|
spec:
|
|
strategy:
|
|
type: RollingUpdate
|
|
rollingUpdate:
|
|
maxUnavailable: 50%
|
|
maxSurge: 100%
|
|
replicas: {{ .minReplicaCount | default $.Values.workerTemplate.minReplicaCount }}
|
|
selector:
|
|
matchLabels:
|
|
{{- include "polymorphic-app.selectorLabels" $ | nindent 6 }}
|
|
app.kubernetes.io/component: "{{ $.Release.Name }}-{{ .name | default $.Values.workerTemplate.name }}"
|
|
template:
|
|
metadata:
|
|
labels:
|
|
{{- include "polymorphic-app.labels" $ | nindent 8 }}
|
|
app.kubernetes.io/component: {{ $.Release.Name }}-{{ .name | default $.Values.workerTemplate.name }}
|
|
spec:
|
|
{{- if $.Values.workerTemplate.imagePullSecrets }}
|
|
imagePullSecrets:
|
|
{{ toYaml .imagePullSecrets | indent 8 }}
|
|
{{- else if .imagePullSecrets }}
|
|
imagePullSecrets:
|
|
{{ toYaml .imagePullSecrets | indent 8 }}
|
|
{{- else }}
|
|
{{- if $.Values.imagePullSecrets }}
|
|
imagePullSecrets:
|
|
{{ toYaml $.Values.imagePullSecrets | indent 8 }}
|
|
{{- end }}
|
|
{{- end }}
|
|
terminationGracePeriodSeconds: {{ .terminationGracePeriodSeconds | default $.Values.workerTemplate.terminationGracePeriodSeconds }}
|
|
containers:
|
|
- name: "{{ $.Release.Name }}-{{ .name | default $.Values.workerTemplate.name }}"
|
|
{{- if .image }}
|
|
image: "{{ .image.repository }}:{{ .image.tag }}"
|
|
{{- else }}
|
|
image: "{{ $.Values.image.repository }}:{{ $.Values.image.tag }}"
|
|
{{- end }}
|
|
imagePullPolicy: {{ $.Values.image.pullPolicy }}
|
|
env:
|
|
{{- if .env }}
|
|
{{ toYaml .env | indent 12 }}
|
|
{{- end }}
|
|
{{- if $.Values.env }}
|
|
{{ toYaml $.Values.env | indent 12 }}
|
|
{{- end }}
|
|
{{- if $.Values.workerTemplate.env }}
|
|
{{ toYaml $.Values.workerTemplate.env | indent 12 }}
|
|
{{- end }}
|
|
envFrom:
|
|
{{- if .envFrom }}
|
|
{{ toYaml .envFrom | indent 12 }}
|
|
{{- end }}
|
|
{{- if $.Values.envFrom }}
|
|
{{ toYaml $.Values.envFrom | indent 12 }}
|
|
{{- end }}
|
|
{{- if $.Values.workerTemplate.envFrom }}
|
|
{{ toYaml $.Values.workerTemplate.envFrom | indent 12 }}
|
|
{{- end }}
|
|
{{- if .command }}
|
|
{{- with .command | default $.Values.workerTemplate.command }}
|
|
command:
|
|
{{ toYaml . | indent 12 }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- if .args }}
|
|
{{- with .args | default $.Values.workerTemplate.args }}
|
|
args:
|
|
{{ toYaml . | indent 12 }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- with .resources | default $.Values.workerTemplate.resources }}
|
|
resources:
|
|
{{ toYaml . | indent 12 }}
|
|
{{- end }}
|
|
{{- with .lifecycleHooks | default $.Values.workerTemplate.lifecycleHooks }}
|
|
lifecycle:
|
|
{{ toYaml . | indent 12 }}
|
|
{{- end }}
|
|
volumeMounts:
|
|
{{- if .volumeMounts }}
|
|
{{ toYaml .volumeMounts | indent 10 }}
|
|
{{- end }}
|
|
{{- if $.Values.volumeMounts }}
|
|
{{ toYaml $.Values.volumeMounts | indent 10 }}
|
|
{{- end }}
|
|
{{- if $.Values.workerTemplate.volumeMounts }}
|
|
{{ toYaml $.Values.workerTemplate.volumeMounts | indent 10 }}
|
|
{{- end }}
|
|
{{- if or ($.Values.workerTemplate.probe) (.probe) }}
|
|
livenessProbe:
|
|
exec:
|
|
{{- if $.Values.workerTemplate.probe }}
|
|
{{- with $.Values.workerTemplate.probe.aliveCommand }}
|
|
command:
|
|
{{ toYaml . | indent 14 }}
|
|
{{- end }}
|
|
{{- else }}
|
|
{{- with .probe.aliveCommand }}
|
|
command:
|
|
{{ toYaml . | indent 14 }}
|
|
{{- end }}
|
|
{{- end }}
|
|
initialDelaySeconds: 10
|
|
periodSeconds: 20
|
|
{{- if $.Values.workerTemplate.probe }}
|
|
timeoutSeconds: {{ $.Values.workerTemplate.probe.timeoutSeconds }}
|
|
{{- else }}
|
|
timeoutSeconds: {{ .probe.timeoutSeconds }}
|
|
{{- end }}
|
|
successThreshold: 1
|
|
readinessProbe:
|
|
exec:
|
|
{{- if $.Values.workerTemplate.probe }}
|
|
{{- with $.Values.workerTemplate.probe.aliveCommand }}
|
|
command:
|
|
{{ toYaml . | indent 14 }}
|
|
{{- end }}
|
|
{{- else }}
|
|
{{- with .probe.aliveCommand }}
|
|
command:
|
|
{{ toYaml . | indent 14 }}
|
|
{{- end }}
|
|
{{- end }}
|
|
initialDelaySeconds: 10
|
|
periodSeconds: 20
|
|
{{- if $.Values.workerTemplate.probe }}
|
|
timeoutSeconds: {{ $.Values.workerTemplate.probe.timeoutSeconds }}
|
|
{{- else }}
|
|
timeoutSeconds: {{ .probe.timeoutSeconds }}
|
|
{{- end }}
|
|
successThreshold: 1
|
|
{{- end }}
|
|
volumes:
|
|
{{- if .volumes }}
|
|
{{ toYaml .volumes | indent 8 }}
|
|
{{- end }}
|
|
{{- if $.Values.volumes }}
|
|
{{ toYaml $.Values.volumes | indent 8 }}
|
|
{{- end }}
|
|
{{- if $.Values.workerTemplate.volumes }}
|
|
{{ toYaml $.Values.workerTemplate.volumes | indent 8 }}
|
|
{{- end }}
|
|
{{- with .nodeSelector | default $.Values.workerTemplate.nodeSelector }}
|
|
nodeSelector:
|
|
{{ toYaml . | indent 8 }}
|
|
{{- end }}
|
|
{{- with .affinity | default $.Values.workerTemplate.affinity }}
|
|
affinity:
|
|
{{ toYaml . | indent 8 }}
|
|
{{- end }}
|
|
{{- with .tolerations | default $.Values.workerTemplate.tolerations }}
|
|
tolerations:
|
|
{{ toYaml . | indent 8 }}
|
|
{{- end }}
|
|
|
|
{{- if .autoscaling | default $.Values.workerTemplate.autoscaling }}
|
|
---
|
|
apiVersion: autoscaling/v2beta1
|
|
kind: HorizontalPodAutoscaler
|
|
metadata:
|
|
name: "{{ $.Release.Name }}-{{ .name | default $.Values.workerTemplate.name }}"
|
|
labels:
|
|
{{- include "polymorphic-app.labels" $ | nindent 4 }}
|
|
app.kubernetes.io/component: {{ $.Release.Name }}-{{ .name | default $.Values.workerTemplate.name }}
|
|
spec:
|
|
scaleTargetRef:
|
|
apiVersion: apps/v1beta2
|
|
kind: Deployment
|
|
name: "{{ $.Release.Name }}-{{ .name | default $.Values.workerTemplate.name }}"
|
|
minReplicas: {{ .minReplicaCount | default $.Values.workerTemplate.minReplicaCount }}
|
|
maxReplicas: {{ .maxReplicaCount | default $.Values.workerTemplate.maxReplicaCount }}
|
|
metrics:
|
|
- type: Object
|
|
object:
|
|
{{- if or (.metricName) ($.Values.workerTemplate.metricName) }}
|
|
metricName: {{ .metricName | default $.Values.workerTemplate.metricName }}
|
|
{{- end }}
|
|
target:
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
name: "{{ $.Release.Name }}-{{ .name | default $.Values.workerTemplate.name }}"
|
|
targetValue: 100
|
|
{{- end }}
|
|
{{- end }}
|