1+ apiVersion : apps/v1
2+ kind : Deployment
3+ metadata :
4+ name : {{ .Release.Name }}-api
5+ namespace : {{ .Release.Namespace }}
6+ labels :
7+ app : {{ .Release.Name }}-api
8+ app.kubernetes.io/instance : {{ .Release.Name }}
9+ app.kubernetes.io/name : {{ .Release.Name }}
10+ app.kubernetes.io/component : api
11+ spec :
12+ replicas : {{ .Values.api.replicaCount }}
13+
14+ strategy :
15+ type : RollingUpdate
16+ rollingUpdate :
17+ maxSurge : 1
18+ maxUnavailable : 0
19+
20+ selector :
21+ matchLabels :
22+ app : {{ .Release.Name }}-api
23+
24+ template :
25+ metadata :
26+ labels :
27+ app : {{ .Release.Name }}-api
28+ app.kubernetes.io/instance : {{ .Release.Name }}
29+ app.kubernetes.io/name : {{ .Release.Name }}
30+ app.kubernetes.io/component : api
31+ annotations :
32+ checksum/config : {{ include (print $.Template.BasePath "/config.yaml") . | sha256sum }}
33+
34+ {{- if .Values.api.apparmor.enabled }}
35+ container.apparmor.security.beta.kubernetes.io/{{ .Release.Name }}-api : runtime/default
36+ {{- end }}
37+
38+ spec :
39+ # Run with a dedicated ServiceAccount (create below)
40+ serviceAccountName : {{ .Release.Name }}-sa
41+ automountServiceAccountToken : false
42+
43+ # Spread replicas across nodes/azs if possible
44+ topologySpreadConstraints :
45+ - maxSkew : 1
46+ topologyKey : kubernetes.io/hostname
47+ whenUnsatisfiable : ScheduleAnyway
48+ labelSelector :
49+ matchLabels :
50+ app : {{ .Release.Name }}-api
51+
52+ securityContext :
53+ runAsNonRoot : true
54+ runAsUser : 10001
55+ runAsGroup : 10001
56+ fsGroup : 10001
57+ seccompProfile :
58+ type : RuntimeDefault
59+
60+ containers :
61+ - name : {{ .Release.Name }}-api
62+ image : {{ .Values.api.image.repository }}:{{ .Values.api.image.tag }}
63+ imagePullPolicy : {{ .Values.api.image.pullPolicy }}
64+
65+ envFrom :
66+ - configMapRef :
67+ name : {{ .Release.Name }}-config
68+ {{- if .Values.config.existingSecret }}
69+ - secretRef :
70+ name : {{ .Values.config.existingSecret }}
71+ {{- end }}
72+
73+ ports :
74+ - containerPort : {{ .Values.api.service.port }}
75+ name : http
76+
77+ # Resource requests/limits to prevent noisy neighbor + OOM loops
78+ resources :
79+ requests :
80+ cpu : {{ .Values.api.resources.requests.cpu }}
81+ memory : {{ .Values.api.resources.requests.memory }}
82+ limits :
83+ cpu : {{ .Values.api.resources.limits.cpu }}
84+ memory : {{ .Values.api.resources.limits.memory }}
85+
86+ securityContext :
87+ allowPrivilegeEscalation : false
88+ readOnlyRootFilesystem : true
89+ runAsNonRoot : true
90+ privileged : false
91+ capabilities :
92+ drop : ["ALL"]
93+
94+ readinessProbe :
95+ httpGet :
96+ path : {{ .Values.api.probes.path }}
97+ port : {{ .Values.api.service.port }}
98+ initialDelaySeconds : {{ .Values.api.probes.readiness.initialDelaySeconds }}
99+ periodSeconds : {{ .Values.api.probes.readiness.periodSeconds }}
100+ timeoutSeconds : {{ .Values.api.probes.readiness.timeoutSeconds }}
101+ failureThreshold : {{ .Values.api.probes.readiness.failureThreshold }}
102+
103+ livenessProbe :
104+ httpGet :
105+ path : {{ .Values.api.probes.path }}
106+ port : {{ .Values.api.service.port }}
107+ initialDelaySeconds : {{ .Values.api.probes.liveness.initialDelaySeconds }}
108+ periodSeconds : {{ .Values.api.probes.liveness.periodSeconds }}
109+ timeoutSeconds : {{ .Values.api.probes.liveness.timeoutSeconds }}
110+ failureThreshold : {{ .Values.api.probes.liveness.failureThreshold }}
111+
112+ startupProbe :
113+ httpGet :
114+ path : {{ .Values.api.probes.path }}
115+ port : {{ .Values.api.service.port }}
116+ failureThreshold : {{ .Values.api.probes.startup.failureThreshold }}
117+ periodSeconds : {{ .Values.api.probes.startup.periodSeconds }}
0 commit comments