Some updates
This commit is contained in:
11
charts/workload-testing/templates/deployment/_deployment.tpl
Normal file
11
charts/workload-testing/templates/deployment/_deployment.tpl
Normal file
@ -0,0 +1,11 @@
|
||||
{{- define "lib.deployment" -}}
|
||||
# ---------------------------------------------------------------------
|
||||
# The deployment is build within the helm library
|
||||
# please check the lib/tempaltes/deployment/base
|
||||
# ---------------------------------------------------------------------
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
{{- include "lib.metadata" (dict "Context" . "customName" "")}}
|
||||
{{- include "deployment.spec" . }}
|
||||
{{- end -}}
|
||||
|
97
charts/workload-testing/templates/deployment/_spec.tpl
Normal file
97
charts/workload-testing/templates/deployment/_spec.tpl
Normal file
@ -0,0 +1,97 @@
|
||||
{{/*
|
||||
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:
|
||||
{{/* Prepare the securityContext for the pod */}}
|
||||
{{- include "lib.securityContext" . | indent 6 -}}
|
||||
{{/* Add all the volues to pod */}}
|
||||
{{- if or ( or .Values.storage .Values.extraVolumes) .Values.files }}
|
||||
volumes:
|
||||
{{- if .Values.storage }}
|
||||
{{- range $k, $v := .Values.storage }}
|
||||
- name: {{ $k }}-storage
|
||||
persistentVolumeClaim:
|
||||
claimName: " {{- printf "%s-%s" (include "chart.fullname" $) $k }}"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.files }}-file
|
||||
{{- range $k, $v := .Values.files }}
|
||||
- name: {{ $k }}
|
||||
{{- if $v.sensitive }}
|
||||
secret:
|
||||
defaultMode: 420
|
||||
secretName: " {{- printf "%s-%s" (include "chart.fullname" $) $k }}"
|
||||
{{- else }}
|
||||
configMap:
|
||||
name: "{{- printf "%s-%s" (include "chart.fullname" $) $k }}"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
{{/* Define containers */}}
|
||||
containers:
|
||||
{{- range $k,$v := .Values.workload.containers }}
|
||||
- name: {{ $k }}
|
||||
{{/* Prepare the securityContext for the container */}}
|
||||
{{- include "lib.containerSecurityContext" . | indent 8 -}}
|
||||
{{/* Image fron chart's annotations */}}
|
||||
image: {{ index $.Chart.Annotations "helm.badhouseplants.net/registry" }}:{{ $.Chart.AppVersion }}
|
||||
{{- with $v.command }}
|
||||
command:
|
||||
{{. | toYaml | indent 10 }}
|
||||
{{- end -}}
|
||||
{{- with $v.args }}
|
||||
args:
|
||||
{{. | toYaml | indent 10 }}
|
||||
{{- end -}}
|
||||
{{- if $v.mounts }}
|
||||
mounts:
|
||||
{{- range $k ,$v := range $v.mounts }}
|
||||
{{- if $k == "storage" }}
|
||||
name: {{ $k }}-storage
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
{{/* Ports */}}
|
||||
{{- with $v.ports }}
|
||||
ports:
|
||||
{{- range $p := $v.ports}}
|
||||
- containerPort: {{ index (index $.Values.service.ports $p) "targetPort" }}
|
||||
{{/* If env should be set from a Configmap/Secret */}}
|
||||
{{- if $v.envFrom }}
|
||||
envFrom:
|
||||
{{- range $k := $v.envFrom }}
|
||||
{{/* If envFrom entry is a string, then refer to the env created by the library */}}
|
||||
{{- 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 }}
|
||||
{{/* Otherwise try to add references directly (if Secrets/ConfigMaps are not managed by the chart) */}}
|
||||
{{- else }}
|
||||
{{- range $k, $v := $k }}
|
||||
- {{ $k }}:
|
||||
{{ toYaml $v | indent 14 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
Reference in New Issue
Block a user