blob: da159724295044c068ff7cedaa946bd875e6d6f8 [file] [log] [blame]
Mohammed Naserf3f59a72023-01-15 21:02:04 -05001{{/*
2Copyright 2019 Samsung Electronics Co., Ltd.
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/}}
16
17{{- if .Values.manifests.deployment_api }}
18{{- $envAll := . }}
19
20{{- $mounts_octavia_api := .Values.pod.mounts.octavia_api.octavia_api }}
21{{- $mounts_octavia_api_init := .Values.pod.mounts.octavia_api.init_container }}
22
23{{- $serviceAccountName := "octavia-api" }}
24{{ tuple $envAll "api" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
25---
26apiVersion: apps/v1
27kind: Deployment
28metadata:
29 name: octavia-api
30 annotations:
31 {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
32 labels:
33{{ tuple $envAll "octavia" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
34spec:
35 replicas: {{ .Values.pod.replicas.api }}
36 selector:
37 matchLabels:
38{{ tuple $envAll "octavia" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }}
39{{ tuple $envAll | include "helm-toolkit.snippets.kubernetes_upgrades_deployment" | indent 2 }}
40 template:
41 metadata:
42 labels:
43{{ tuple $envAll "octavia" "api" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
44 annotations:
45 configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }}
46 configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }}
47 spec:
48 serviceAccountName: {{ $serviceAccountName }}
49 affinity:
50{{ tuple $envAll "octavia" "api" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }}
51 nodeSelector:
52 {{ .Values.labels.api.node_selector_key }}: {{ .Values.labels.api.node_selector_value }}
53 terminationGracePeriodSeconds: {{ .Values.pod.lifecycle.termination_grace_period.api.timeout | default "30" }}
54 initContainers:
55{{ tuple $envAll "api" $mounts_octavia_api_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
56 containers:
57 - name: octavia-api
58{{ tuple $envAll "octavia_api" | include "helm-toolkit.snippets.image" | indent 10 }}
59{{ tuple $envAll $envAll.Values.pod.resources.api | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
60 securityContext:
61 runAsUser: {{ .Values.pod.user.octavia.uid }}
62 command:
63 - /tmp/octavia-api.sh
64 - start
65 lifecycle:
66 preStop:
67 exec:
68 command:
69 - /tmp/octavia-api.sh
70 - stop
71 ports:
72 - name: o-api
73 containerPort: {{ tuple "load_balancer" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
74 readinessProbe:
Oleksandr Kozachenkoa10d7852023-02-02 22:01:16 +010075 httpGet:
76 scheme: {{ tuple "load_balancer" "internal" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_scheme_lookup" | upper }}
77 path: /
Mohammed Naserf3f59a72023-01-15 21:02:04 -050078 port: {{ tuple "load_balancer" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
79 volumeMounts:
80 - name: pod-etc-octavia
81 mountPath: /etc/octavia
82 - name: octavia-bin
83 mountPath: /tmp/octavia-api.sh
84 subPath: octavia-api.sh
85 readOnly: true
86 - name: octavia-etc
87 mountPath: /etc/octavia/octavia.conf
88 subPath: octavia.conf
89 readOnly: true
Oleksandr Kozachenko573b0e52023-10-04 17:38:01 +020090 - name: octavia-etc
91 mountPath: /etc/octavia/octavia-api-uwsgi.ini
92 subPath: octavia-api-uwsgi.ini
93 readOnly: true
Mohammed Naserf3f59a72023-01-15 21:02:04 -050094 {{- if .Values.conf.octavia.DEFAULT.log_config_append }}
95 - name: octavia-etc
96 mountPath: {{ .Values.conf.octavia.DEFAULT.log_config_append }}
97 subPath: {{ base .Values.conf.octavia.DEFAULT.log_config_append }}
98 readOnly: true
99 {{- end }}
100{{ if $mounts_octavia_api.volumeMounts }}{{ toYaml $mounts_octavia_api.volumeMounts | indent 12 }}{{ end }}
101 volumes:
102 - name: pod-etc-octavia
103 emptyDir: {}
104 - name: octavia-bin
105 configMap:
106 name: octavia-bin
107 defaultMode: 0555
108 - name: octavia-etc
109 secret:
110 secretName: octavia-etc
111 defaultMode: 0444
112{{ if $mounts_octavia_api.volumes }}{{ toYaml $mounts_octavia_api.volumes | indent 8 }}{{ end }}
113{{- end }}