Files
test/templates/charts/generic-http-service-v3/templates/deployment.yaml
2026-10-22 02:06:39 +00:00

98 lines
3.0 KiB
YAML

{{- $s := .Values.spec -}}
{{- $p := .Values.platform -}}
{{- $needsBind := false -}}
{{- range $s.runtime.ports }}{{- if lt (int .containerPort) 1024 }}{{- $needsBind = true }}{{- end }}{{- end -}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ $p.workloadName }}
namespace: {{ $p.namespace }}
labels:
{{- toYaml $p.labels | nindent 4 }}
annotations:
{{- toYaml $p.annotations | nindent 4 }}
spec:
replicas: {{ $s.replicas }}
{{- with (default (dict) $p.rollout).progressDeadlineSeconds }}
progressDeadlineSeconds: {{ . }}
{{- end }}
selector:
matchLabels:
{{- toYaml $p.selector | nindent 6 }}
template:
metadata:
labels:
{{- toYaml $p.labels | nindent 8 }}
annotations:
{{- toYaml $p.annotations | nindent 8 }}
spec:
automountServiceAccountToken: false
{{- if $s.runtime.runAsRoot }}
securityContext:
runAsNonRoot: false
{{- end }}
{{- with (default (dict) $p.scheduling).nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with (default (dict) $p.scheduling).tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with $p.volumeAttachments }}
volumes:
{{- range . }}
- name: {{ .name }}
persistentVolumeClaim:
claimName: {{ .claimName }}
{{- end }}
{{- end }}
containers:
- name: app
image: {{ $s.runtime.resolvedImage | quote }}
{{- with $s.runtime.command }}
command:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with $s.runtime.args }}
args:
{{- toYaml . | nindent 12 }}
{{- end }}
ports:
{{- toYaml $s.runtime.ports | nindent 12 }}
{{- if $s.env }}
env:
{{- range $name, $value := $s.env }}
- name: {{ $name }}
value: {{ $value | quote }}
{{- end }}
{{- else }}
env: []
{{- end }}
{{- with $p.volumeAttachments }}
volumeMounts:
{{- range . }}
- name: {{ .name }}
mountPath: {{ .mountPath | quote }}
{{- end }}
{{- end }}
resources:
{{- toYaml $p.resources | nindent 12 }}
securityContext:
allowPrivilegeEscalation: false
{{- $add := list }}
{{- if $needsBind }}{{- $add = append $add "NET_BIND_SERVICE" }}{{- end }}
{{- if $s.runtime.runAsRoot }}
{{- $add = concat $add (list "CHOWN" "DAC_OVERRIDE" "FOWNER" "FSETID" "KILL" "SETGID" "SETUID") }}
{{- end }}
{{- with $add }}
capabilities:
add:
{{- toYaml . | nindent 16 }}
{{- end }}
readinessProbe:
httpGet:
path: {{ $s.healthCheck.path | quote }}
port: {{ $s.healthCheck.port }}
initialDelaySeconds: {{ $s.healthCheck.initialDelaySeconds }}