2024-05-19 16:56:41 +00:00
|
|
|
{{/*
|
|
|
|
This is a builder for deployments
|
|
|
|
*/}}
|
|
|
|
|
2024-05-21 11:41:43 +00:00
|
|
|
{{- define "lib.metadata.hash" -}} {{- /* (define) */ -}}
|
|
|
|
{{- range $k, $v := .Env -}} {{- /* (1) */ -}}
|
2024-05-21 12:37:58 +00:00
|
|
|
{{ printf "softplayer.net/env-%s" $k }}: {{ $v.data | toString | sha256sum }}
|
2024-05-21 11:41:43 +00:00
|
|
|
{{ end -}} {{/* /(1) */}}
|
|
|
|
{{- range $k, $v := .Files -}} {{- /* (1) */ -}}
|
2024-05-21 12:37:58 +00:00
|
|
|
{{ printf "softplayer.net/files-%s" $k }}: {{ $v.data | toString | sha256sum }}
|
2024-05-21 11:41:43 +00:00
|
|
|
{{ end }} {{/* /(1) */}}
|
|
|
|
{{- end -}} {{- /* /(define) */ -}}
|
|
|
|
|
2024-05-19 16:56:41 +00:00
|
|
|
{{- 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 }}
|
2024-05-21 11:41:43 +00:00
|
|
|
annotations:
|
|
|
|
{{- include "lib.metadata.hash" (dict "Env" $.Values.env "Files" $.Values.files) | nindent 6 }}
|
2024-05-19 16:56:41 +00:00
|
|
|
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) */ -}}
|