softplayer-helm-lib/charts/testing/templates/deployment/_spec.tpl
2024-05-05 18:51:37 +02:00

62 lines
1.6 KiB
Smarty

{{/*
This is a builder for deployments
*/}}
{{- define "deployment.spec" }}
spec:
replicas: {{ .Values.workload.replicas }}
selector:
matchLabels:
{{ include "metadata.selectorLabels" . | indent 6 }}
template:
metadata:
labels:
{{ include "metadata.labels" . | indent 8 }}
spec:
{{ include "lib.securityContext" . | indent 6 }}
{{- if or .Values.storage .Values.extraVolumes }}
volumes:
{{- if .Values.storage }}
{{- range $k, $v := .Values.storage }}
- name: {{ $k }}
persistentVolumeClaim:
claimName: {{ include "chart.fullname" $ }}-data
{{- end }}
{{- end }}
{{- end }}
containers:
{{- range $k,$v := .Values.workload.containers }}
- name: {{ $k }}
{{ include "lib.containerSecurityContext" . | indent 8 }}
image: {{ index $.Chart.Annotations "helm.badhouseplants.net/registry" }}:{{ $.Chart.AppVersion }}
{{- with $v.ports }}
ports:
{{- range $p := $v.ports}}
- containerPort: {{ index (index $.Values.service.ports $p) "targetPort" }}
{{- if $v.envFrom }}
envFrom:
{{- range $k := $v.envFrom }}
{{- if kindIs "string" $k }}
{{- if (index $.Values.env $k) }}
{{- if (index $.Values.env $k).sensitive }}
- secretRef:
{{- else }}
- configMapRef:
{{- end }}
name: {{ printf "%s-%s" (include "chart.fullname" $) $k }}
{{- end }}
{{- else }}
{{- range $k, $v := $k }}
- {{ $k }}:
{{ toYaml $v | indent 14 }}
{{- end }}
{{- end -}}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}