blob: e61236c97f148d314341cd27c9a3107aecbf64fa [file] [log] [blame]
Rico Lind020bc22023-11-01 01:57:03 +08001{{/*
2Licensed under the Apache License, Version 2.0 (the "License");
3you may not use this file except in compliance with the License.
4You may obtain a copy of the License at
5
6 http://www.apache.org/licenses/LICENSE-2.0
7
8Unless required by applicable law or agreed to in writing, software
9distributed under the License is distributed on an "AS IS" BASIS,
10WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11See the License for the specific language governing permissions and
12limitations under the License.
13*/}}
14
15{{- if .Values.manifests.deployment_api }}
16{{- $envAll := . }}
17
18{{- $mounts_staffeln_api := .Values.pod.mounts.staffeln_api.staffeln_api }}
19{{- $mounts_staffeln_api_init := .Values.pod.mounts.staffeln_api.init_container }}
20
21{{- $serviceAccountName := "staffeln-api" }}
22{{ tuple $envAll "api" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
23---
24apiVersion: apps/v1
25kind: Deployment
26metadata:
27 name: staffeln-api
28 annotations:
29 {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
30 labels:
31{{ tuple $envAll "staffeln" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
32spec:
33 replicas: {{ .Values.pod.replicas.api }}
34 selector:
35 matchLabels:
36{{ tuple $envAll "staffeln" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }}
37{{ tuple $envAll | include "helm-toolkit.snippets.kubernetes_upgrades_deployment" | indent 2 }}
38 template:
39 metadata:
40 labels:
41{{ tuple $envAll "staffeln" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
42 annotations:
43{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }}
44 configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }}
45 configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }}
46{{ dict "envAll" $envAll "podName" "staffeln-api" "containerNames" (list "init" "staffeln-api") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }}
47 spec:
48{{ dict "envAll" $envAll "application" "staffeln" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }}
Dong Ma9f49d7a2025-02-12 04:24:30 +000049{{ with .Values.pod.priorityClassName.staffeln_api }}
50 priorityClassName: {{ . }}
51{{ end }}
52{{ with .Values.pod.runtimeClassName.staffeln_api }}
53 runtimeClassName: {{ . }}
54{{ end }}
Rico Lind020bc22023-11-01 01:57:03 +080055 serviceAccountName: {{ $serviceAccountName }}
56 affinity:
57{{ tuple $envAll "staffeln" "api" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }}
58 nodeSelector:
59 {{ .Values.labels.api.node_selector_key }}: {{ .Values.labels.api.node_selector_value }}
60{{ if $envAll.Values.pod.tolerations.staffeln.enabled }}
61{{ tuple $envAll "staffeln" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }}
62{{ end }}
63 initContainers:
64{{ tuple $envAll "api" $mounts_staffeln_api_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
65 containers:
66 - name: staffeln-api
67{{ tuple $envAll "staffeln_api" | include "helm-toolkit.snippets.image" | indent 10 }}
68{{ tuple $envAll $envAll.Values.pod.resources.api | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
69{{ dict "envAll" $envAll "application" "staffeln" "container" "staffeln_api" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
70 command:
71 - /tmp/staffeln-api.sh
72 - start
73 env:
74 lifecycle:
75 preStop:
76 exec:
77 command:
78 - /tmp/staffeln-api.sh
79 - stop
80 ports:
81 - name: s-api
82 containerPort: {{ tuple "staffeln" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
83 readinessProbe:
84 httpGet:
85 scheme: HTTP
86 path: /v1/health
87 port: {{ tuple "staffeln" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
88 volumeMounts:
89 - name: pod-tmp
90 mountPath: /tmp
91 - name: state-tmp
92 mountPath: /var/lib/staffeln
93 - name: etcstaffeln
94 mountPath: /etc/staffeln
95 - name: staffeln-etc
96 mountPath: /etc/staffeln/staffeln.conf
97 subPath: staffeln.conf
98 readOnly: true
99 - name: staffeln-bin
100 mountPath: /tmp/staffeln-api.sh
101 subPath: staffeln-api.sh
102 readOnly: true
103{{ if $mounts_staffeln_api.volumeMounts }}{{ toYaml $mounts_staffeln_api.volumeMounts | indent 12 }}{{ end }}
104 volumes:
105 - name: pod-tmp
106 emptyDir: {}
107 - name: state-tmp
108 emptyDir: {}
109 - name: etcstaffeln
110 emptyDir: {}
111 - name: staffeln-etc
112 secret:
113 secretName: staffeln-etc
114 defaultMode: 0444
115 - name: staffeln-bin
116 configMap:
117 name: staffeln-bin
118 defaultMode: 0555
119
120{{ if $mounts_staffeln_api.volumes }}{{ toYaml $mounts_staffeln_api.volumes | indent 8 }}{{ end }}
121{{- end }}