blob: a0543381d2f0aa0e532752bc6562e9f353d1b831 [file] [log] [blame]
Mohammed Naser54ee9922023-07-22 18:40:25 +00001{{/*
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
Mohammed Naser12207172024-02-05 18:49:35 -050015{{- define "controllerReadinessProbeTemplate" }}
16exec:
17 command:
18 - /usr/bin/ovn-kube-util
19 - readiness-probe
20 - -t
21 - ovn-controller
22{{- end }}
23
okozachenko120317930d42023-09-06 00:24:05 +100024{{- if .Values.manifests.daemonset_ovn_controller }}
Mohammed Naser54ee9922023-07-22 18:40:25 +000025{{- $envAll := . }}
26
27{{- $configMapName := "ovn-etc" }}
28{{- $serviceAccountName := "ovn-controller" }}
29{{ tuple $envAll "ovn_controller" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
Oleksandr K.79635252024-10-25 16:42:49 +020030
31---
Mohammed Naser54ee9922023-07-22 18:40:25 +000032kind: DaemonSet
33apiVersion: apps/v1
34metadata:
35 name: ovn-controller
36 annotations:
37 {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
38 configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }}
39 labels:
Oleksandr K.79635252024-10-25 16:42:49 +020040{{ tuple $envAll "ovn" "ovn-controller" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
Mohammed Naser54ee9922023-07-22 18:40:25 +000041spec:
42 selector:
43 matchLabels:
Oleksandr K.79635252024-10-25 16:42:49 +020044{{ tuple $envAll "ovn" "ovn-controller" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }}
Mohammed Naser54ee9922023-07-22 18:40:25 +000045 template:
46 metadata:
47 labels:
Oleksandr K.79635252024-10-25 16:42:49 +020048{{ tuple $envAll "ovn" "ovn-controller" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
Mohammed Naser54ee9922023-07-22 18:40:25 +000049 annotations:
50{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }}
51 configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }}
52 configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }}
53 spec:
54 serviceAccountName: {{ $serviceAccountName }}
Mohammed Naserd6db2452023-07-23 14:34:59 +000055 hostNetwork: true
Oleksandr K.e4e83162024-10-23 22:09:30 +020056 hostPID: true
57 hostIPC: true
Mohammed Naserd6db2452023-07-23 14:34:59 +000058 dnsPolicy: {{ .Values.pod.dns_policy }}
Mohammed Naser54ee9922023-07-22 18:40:25 +000059 nodeSelector:
60 {{ .Values.labels.ovn_controller.node_selector_key }}: {{ .Values.labels.ovn_controller.node_selector_value }}
61 initContainers:
62{{- tuple $envAll "ovn_controller" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
Oleksandr K.79635252024-10-25 16:42:49 +020063 - name: get-gw-enabled
64{{ tuple $envAll "ovn_controller_kubectl" | include "helm-toolkit.snippets.image" | indent 10 }}
65 command:
66 - /bin/bash
67 - -c
68 - |
69 kubectl get node ${NODENAME} -o jsonpath='{.metadata.labels.{{ .Values.labels.ovn_controller_gw.node_selector_key }}}' > /tmp/gw-enabled/gw-enabled
70 env:
71 - name: NODENAME
72 valueFrom:
73 fieldRef:
74 fieldPath: spec.nodeName
75 volumeMounts:
76 - name: gw-enabled
77 mountPath: /tmp/gw-enabled
78 readOnly: false
Mohammed Naser54ee9922023-07-22 18:40:25 +000079 - name: controller-init
Oleksandr K.e4e83162024-10-23 22:09:30 +020080{{ dict "envAll" $envAll "application" "ovn_controller" "container" "controller_init" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
Mohammed Naser54ee9922023-07-22 18:40:25 +000081{{ tuple $envAll "ovn_controller" | include "helm-toolkit.snippets.image" | indent 10 }}
Mohammed Naser54ee9922023-07-22 18:40:25 +000082 command:
83 - /tmp/ovn-controller-init.sh
okozachenko12036ba36902023-07-27 23:05:13 +100084 env:
Mohammed Naser19d63122024-01-08 17:10:05 -050085 - name: NODE_NAME
86 valueFrom:
87 fieldRef:
88 fieldPath: spec.nodeName
Mohammed Naser54ee9922023-07-22 18:40:25 +000089 volumeMounts:
90 - name: ovn-bin
91 mountPath: /tmp/ovn-controller-init.sh
92 subPath: ovn-controller-init.sh
93 readOnly: true
94 - name: run-openvswitch
95 mountPath: /run/openvswitch
96 - name: ovn-etc
97 mountPath: /tmp/auto_bridge_add
98 subPath: auto_bridge_add
99 readOnly: true
Oleksandr K.79635252024-10-25 16:42:49 +0200100 - name: gw-enabled
101 mountPath: /tmp/gw-enabled
102 readOnly: true
Mohammed Naser54ee9922023-07-22 18:40:25 +0000103 containers:
104 - name: controller
105{{ tuple $envAll "ovn_controller" | include "helm-toolkit.snippets.image" | indent 10 }}
Rico Lin60f9d372025-01-14 14:07:43 +0800106{{ tuple $envAll $envAll.Values.pod.resources.ovn_controller | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
Mohammed Naser54ee9922023-07-22 18:40:25 +0000107{{ dict "envAll" $envAll "application" "ovn_controller" "container" "controller" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
Oleksandr K.e4e83162024-10-23 22:09:30 +0200108 command:
109 - /root/ovnkube.sh
110 - ovn-controller
Mohammed Naser12207172024-02-05 18:49:35 -0500111{{ dict "envAll" . "component" "ovn_controller" "container" "controller" "type" "readiness" "probeTemplate" (include "controllerReadinessProbeTemplate" . | fromYaml) | include "helm-toolkit.snippets.kubernetes_probe" | indent 10 }}
112 env:
113 - name: OVN_DAEMONSET_VERSION
114 value: "3"
115 - name: OVN_LOGLEVEL_CONTROLLER
116 value: "-vconsole:info -vfile:info"
117 - name: OVN_KUBERNETES_NAMESPACE
118 valueFrom:
119 fieldRef:
120 fieldPath: metadata.namespace
121 - name: OVN_KUBERNETES_NB_STATEFULSET
122 value: ovn-ovsdb-nb
123 - name: OVN_KUBERNETES_SB_STATEFULSET
124 value: ovn-ovsdb-sb
125 - name: OVN_SSL_ENABLE
126 value: "no"
Mohammed Naser54ee9922023-07-22 18:40:25 +0000127 volumeMounts:
Mohammed Naser54ee9922023-07-22 18:40:25 +0000128 - name: run-openvswitch
Oleksandr K.79635252024-10-25 16:42:49 +0200129 mountPath: /run/openvswitch
Oleksandr K.e4e83162024-10-23 22:09:30 +0200130 - name: logs
131 mountPath: /var/log/ovn
Oleksandr K.79635252024-10-25 16:42:49 +0200132 - name: run-openvswitch
Oleksandr K.e4e83162024-10-23 22:09:30 +0200133 mountPath: /run/ovn
Oleksandr K.79635252024-10-25 16:42:49 +0200134 {{- if .Values.pod.sidecars.vector }}
135 - name: vector
136{{ tuple $envAll "vector" | include "helm-toolkit.snippets.image" | indent 10 }}
137{{ tuple $envAll $envAll.Values.pod.resources.vector | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
138{{ dict "envAll" $envAll "application" "ovn_controller" "container" "vector" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
139 command:
140 - vector
141 - --config
142 - /etc/vector/vector.toml
143 volumeMounts:
144 - name: vector-config
145 mountPath: /etc/vector
146 - name: logs
147 mountPath: /logs
148 - name: vector-data
149 mountPath: /var/lib/vector
150 {{- end }}
151 {{- if .Values.pod.sidecars.ovn_logging_parser }}
152 - name: log-parser
153{{ tuple $envAll "ovn_logging_parser" | include "helm-toolkit.snippets.image" | indent 10 }}
154{{ tuple $envAll $envAll.Values.pod.resources.ovn_logging_parser | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
155{{ dict "envAll" $envAll "application" "ovn_controller" "container" "ovn_logging_parser" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
156 command:
157 - /tmp/ovn-network-logging-parser.sh
158 - start
159 env:
160 - name: VECTOR_HTTP_ENDPOINT
161 value: http://localhost:5001
162 ports:
163 - name: http
164 containerPort: {{ tuple "ovn_logging_parser" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
165 protocol: TCP
166 volumeMounts:
167 - name: neutron-etc
168 mountPath: /etc/neutron/neutron.conf
169 subPath: neutron.conf
170 readOnly: true
171 - name: ovn-bin
172 mountPath: /tmp/ovn-network-logging-parser.sh
173 subPath: ovn-network-logging-parser.sh
174 readOnly: true
175 - name: ovn-etc
176 mountPath: /etc/neutron/neutron-ovn-network-logging-parser-uwsgi.ini
177 subPath: neutron-ovn-network-logging-parser-uwsgi.ini
178 readOnly: true
179 {{- end }}
Mohammed Naser54ee9922023-07-22 18:40:25 +0000180 volumes:
181 - name: ovn-bin
182 configMap:
183 name: ovn-bin
184 defaultMode: 0777
185 - name: run-openvswitch
186 hostPath:
187 path: /run/openvswitch
188 type: DirectoryOrCreate
189 - name: ovn-etc
190 secret:
191 secretName: {{ $configMapName }}
192 defaultMode: 0444
Oleksandr K.e4e83162024-10-23 22:09:30 +0200193 - name: logs
194 hostPath:
195 path: /var/log/ovn
196 type: DirectoryOrCreate
197 - name: run-ovn
198 hostPath:
199 path: /run/ovn
200 type: DirectoryOrCreate
Oleksandr K.79635252024-10-25 16:42:49 +0200201 - name: gw-enabled
202 emptyDir: {}
203 {{- if .Values.pod.sidecars.vector }}
204 - name: vector-config
205 secret:
206 secretName: ovn-vector-config
207 - name: vector-data
208 emptyDir: {}
209 {{- end }}
210 {{- if .Values.pod.sidecars.ovn_logging_parser }}
211 - name: neutron-etc
212 secret:
213 secretName: neutron-etc
214 defaultMode: 0444
215 {{- end }}
Mohammed Naser54ee9922023-07-22 18:40:25 +0000216{{- end }}