40 lines
1.5 KiB
Smarty
40 lines
1.5 KiB
Smarty
{{/*
|
|
This is a builder for deployments
|
|
*/}}
|
|
|
|
{{- define "lib.metadata.hash" -}} {{- /* (define) */ -}}
|
|
{{- range $k, $v := .Env -}} {{- /* (1) */ -}}
|
|
{{ printf "softplayer.net/env-%s" $k }}: {{ $v.data | toString | sha256sum }}
|
|
{{ end -}} {{/* /(1) */}}
|
|
{{- range $k, $v := .Files -}} {{- /* (1) */ -}}
|
|
{{ printf "softplayer.net/files-%s" $k }}: {{ $v.data | toString | sha256sum }}
|
|
{{ end }} {{/* /(1) */}}
|
|
{{- end -}} {{- /* /(define) */ -}}
|
|
|
|
{{- define "deployment.spec" }} {{- /* (define) */}}
|
|
# ---------------------------------------------------------------------
|
|
# The spec is build within the helm library
|
|
# please check the lib/templates/deployment/spec
|
|
# ---------------------------------------------------------------------
|
|
spec:
|
|
replicas: {{ .Values.workload.replicas | default 1}}
|
|
selector:
|
|
matchLabels:
|
|
{{ include "metadata.selectorLabels" . | indent 6 }}
|
|
{{ include "lib.deployment.template" . | indent 2 }}
|
|
|
|
{{- end -}}
|
|
|
|
{{- define "lib.deployment.template" -}} {{- /* (define) */ -}}
|
|
template:
|
|
metadata:
|
|
labels:
|
|
{{- include "metadata.labels" . | nindent 6 }}
|
|
annotations:
|
|
{{- include "lib.metadata.hash" (dict "Env" $.Values.env "Files" $.Values.files) | nindent 6 }}
|
|
spec:
|
|
{{- include "helper.workload.securityContext" . | nindent 4 -}}
|
|
{{- include "helper.deployment.volumes" . | nindent 4 }}
|
|
{{- include "helper.deployment.containers" . | nindent 4 }}
|
|
{{- include "helper.deployment.initContainers" . | nindent 4 }}
|
|
{{- end -}} {{- /* /(define) */ -}} |