blob: 577a0620dd5f662f8f8c1ec2a74f7ea2fe411bcf [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 }}
49 serviceAccountName: {{ $serviceAccountName }}
50 affinity:
51{{ tuple $envAll "staffeln" "api" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }}
52 nodeSelector:
53 {{ .Values.labels.api.node_selector_key }}: {{ .Values.labels.api.node_selector_value }}
54{{ if $envAll.Values.pod.tolerations.staffeln.enabled }}
55{{ tuple $envAll "staffeln" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }}
56{{ end }}
57 initContainers:
58{{ tuple $envAll "api" $mounts_staffeln_api_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
59 containers:
60 - name: staffeln-api
61{{ tuple $envAll "staffeln_api" | include "helm-toolkit.snippets.image" | indent 10 }}
62{{ tuple $envAll $envAll.Values.pod.resources.api | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
63{{ dict "envAll" $envAll "application" "staffeln" "container" "staffeln_api" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
64 command:
65 - /tmp/staffeln-api.sh
66 - start
67 env:
68 lifecycle:
69 preStop:
70 exec:
71 command:
72 - /tmp/staffeln-api.sh
73 - stop
74 ports:
75 - name: s-api
76 containerPort: {{ tuple "staffeln" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
77 readinessProbe:
78 httpGet:
79 scheme: HTTP
80 path: /v1/health
81 port: {{ tuple "staffeln" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
82 volumeMounts:
83 - name: pod-tmp
84 mountPath: /tmp
85 - name: state-tmp
86 mountPath: /var/lib/staffeln
87 - name: etcstaffeln
88 mountPath: /etc/staffeln
89 - name: staffeln-etc
90 mountPath: /etc/staffeln/staffeln.conf
91 subPath: staffeln.conf
92 readOnly: true
93 - name: staffeln-bin
94 mountPath: /tmp/staffeln-api.sh
95 subPath: staffeln-api.sh
96 readOnly: true
97{{ if $mounts_staffeln_api.volumeMounts }}{{ toYaml $mounts_staffeln_api.volumeMounts | indent 12 }}{{ end }}
98 volumes:
99 - name: pod-tmp
100 emptyDir: {}
101 - name: state-tmp
102 emptyDir: {}
103 - name: etcstaffeln
104 emptyDir: {}
105 - name: staffeln-etc
106 secret:
107 secretName: staffeln-etc
108 defaultMode: 0444
109 - name: staffeln-bin
110 configMap:
111 name: staffeln-bin
112 defaultMode: 0555
113
114{{ if $mounts_staffeln_api.volumes }}{{ toYaml $mounts_staffeln_api.volumes | indent 8 }}{{ end }}
115{{- end }}