blob: 77337f7a8b9bc87a98b57ca3f1c806dae7b0aa00 [file] [log] [blame]
Mohammed Naserf3f59a72023-01-15 21:02:04 -05001{{/*
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{{- define "lbAgentReadinessProbeTemplate" }}
16exec:
17 command:
18 - bash
19 - -c
20 - 'brctl show'
21{{- end }}
22
23{{- define "neutron.lb_agent.daemonset" }}
24{{- $daemonset := index . 0 }}
25{{- $configMapName := index . 1 }}
26{{- $serviceAccountName := index . 2 }}
27{{- $envAll := index . 3 }}
28{{- with $envAll }}
29
30{{- $mounts_neutron_lb_agent := .Values.pod.mounts.neutron_lb_agent.neutron_lb_agent }}
31{{- $mounts_neutron_lb_agent_init := .Values.pod.mounts.neutron_lb_agent.init_container }}
32
33---
34apiVersion: apps/v1
35kind: DaemonSet
36metadata:
37 name: neutron-lb-agent
38 annotations:
39 {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
40 labels:
41{{ tuple $envAll "neutron" "neutron-lb-agent" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
42spec:
43 selector:
44 matchLabels:
45{{ tuple $envAll "neutron" "neutron-lb-agent" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }}
46{{ tuple $envAll "lb_agent" | include "helm-toolkit.snippets.kubernetes_upgrades_daemonset" | indent 2 }}
47 template:
48 metadata:
49 labels:
50{{ tuple $envAll "neutron" "neutron-lb-agent" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
51 annotations:
52{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }}
53 configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }}
54 configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }}
Rico Lin0e153482024-05-03 03:29:14 +080055{{ tuple "neutron_lb_agent" . | include "helm-toolkit.snippets.custom_pod_annotations" | indent 8 }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050056 spec:
57{{ dict "envAll" $envAll "application" "neutron_lb_agent" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }}
Dong Mae5bd5a32025-02-11 11:03:48 +000058{{ with .Values.pod.priorityClassName.neutron_lb_agent }}
59 priorityClassName: {{ . }}
60{{ end }}
61{{ with .Values.pod.runtimeClassName.neutron_lb_agent }}
62 runtimeClassName: {{ . }}
63{{ end }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050064 serviceAccountName: {{ $serviceAccountName }}
65{{ if $envAll.Values.pod.tolerations.neutron.enabled }}
66{{ tuple $envAll "neutron" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }}
67{{ end }}
68 nodeSelector:
69 {{ .Values.labels.lb.node_selector_key }}: {{ .Values.labels.lb.node_selector_value }}
70 dnsPolicy: ClusterFirstWithHostNet
71 hostNetwork: true
72 {{- if or ( gt .Capabilities.KubeVersion.Major "1" ) ( ge .Capabilities.KubeVersion.Minor "10" ) }}
73 shareProcessNamespace: true
74 {{- else }}
75 hostPID: true
76 {{- end }}
77 initContainers:
78{{ tuple $envAll "pod_dependency" $mounts_neutron_lb_agent_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
79 - name: neutron-lb-agent-kernel-modules
80{{ tuple $envAll "neutron_linuxbridge_agent" | include "helm-toolkit.snippets.image" | indent 10 }}
81{{ dict "envAll" $envAll "application" "neutron_lb_agent" "container" "neutron_lb_agent_kernel_modules" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
82 command:
83 - /tmp/neutron-linuxbridge-agent-init-modules.sh
84 volumeMounts:
85 - name: neutron-bin
86 mountPath: /tmp/neutron-linuxbridge-agent-init-modules.sh
87 subPath: neutron-linuxbridge-agent-init-modules.sh
88 readOnly: true
89 - name: host-rootfs
90 mountPath: /mnt/host-rootfs
91 mountPropagation: HostToContainer
92 readOnly: true
93 - name: neutron-lb-agent-init
94{{ tuple $envAll "neutron_linuxbridge_agent" | include "helm-toolkit.snippets.image" | indent 10 }}
95{{ tuple $envAll $envAll.Values.pod.resources.agent.lb | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
96{{ dict "envAll" $envAll "application" "neutron_lb_agent" "container" "neutron_lb_agent_init" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
97 command:
98 - /tmp/neutron-linuxbridge-agent-init.sh
99 volumeMounts:
100 - name: pod-tmp
101 mountPath: /tmp
102 - name: neutron-bin
103 mountPath: /tmp/neutron-linuxbridge-agent-init.sh
104 subPath: neutron-linuxbridge-agent-init.sh
105 readOnly: true
106 - name: pod-shared
107 mountPath: /tmp/pod-shared
108 - name: neutron-etc
109 mountPath: /etc/neutron/neutron.conf
110 subPath: neutron.conf
111 readOnly: true
112 - name: neutron-etc
113 mountPath: /etc/neutron/plugins/ml2/ml2_conf.ini
114 subPath: ml2_conf.ini
115 readOnly: true
116 - name: neutron-etc
117 mountPath: /etc/neutron/plugins/ml2/linuxbridge_agent.ini
118 subPath: linuxbridge_agent.ini
119 readOnly: true
120 - name: neutron-etc
121 # NOTE (Portdirect): We mount here to override Kollas
122 # custom sudoers file when using Kolla images, this
123 # location will also work fine for other images.
124 mountPath: /etc/sudoers.d/kolla_neutron_sudoers
125 subPath: neutron_sudoers
126 readOnly: true
127 - name: neutron-etc
128 mountPath: /tmp/auto_bridge_add
129 subPath: auto_bridge_add
130 readOnly: true
131 - name: neutron-etc
132 mountPath: /etc/neutron/rootwrap.conf
133 subPath: rootwrap.conf
134 readOnly: true
135 {{- range $key, $value := $envAll.Values.conf.rootwrap_filters }}
136 {{- if ( has "lb_agent" $value.pods ) }}
137 {{- $filePrefix := replace "_" "-" $key }}
138 {{- $rootwrapFile := printf "/etc/neutron/rootwrap.d/%s.filters" $filePrefix }}
139 - name: neutron-etc
140 mountPath: {{ $rootwrapFile }}
141 subPath: {{ base $rootwrapFile }}
142 readOnly: true
143 {{- end }}
144 {{- end }}
145 - name: run
146 mountPath: /run
147{{ if $mounts_neutron_lb_agent.volumeMounts }}{{ toYaml $mounts_neutron_lb_agent.volumeMounts | indent 12 }}{{ end }}
148 containers:
149 - name: neutron-lb-agent
150{{ tuple $envAll "neutron_linuxbridge_agent" | include "helm-toolkit.snippets.image" | indent 10 }}
151{{ tuple $envAll $envAll.Values.pod.resources.agent.lb | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
152{{ dict "envAll" $envAll "application" "neutron_lb_agent" "container" "neutron_lb_agent" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
153{{ dict "envAll" $envAll "component" "lb_agent" "container" "lb_agent" "type" "readiness" "probeTemplate" (include "lbAgentReadinessProbeTemplate" $envAll | fromYaml) | include "helm-toolkit.snippets.kubernetes_probe" | indent 10 }}
154 command:
155 - /tmp/neutron-linuxbridge-agent.sh
156 volumeMounts:
157 - name: pod-tmp
158 mountPath: /tmp
159 - name: pod-var-neutron
160 mountPath: {{ .Values.conf.neutron.DEFAULT.state_path }}
161 - name: neutron-bin
162 mountPath: /tmp/neutron-linuxbridge-agent.sh
163 subPath: neutron-linuxbridge-agent.sh
164 readOnly: true
165 - name: pod-shared
166 mountPath: /tmp/pod-shared
167 - name: neutron-etc
168 mountPath: /etc/neutron/neutron.conf
169 subPath: neutron.conf
170 readOnly: true
171 {{- if .Values.conf.neutron.DEFAULT.log_config_append }}
172 - name: neutron-etc
173 mountPath: {{ .Values.conf.neutron.DEFAULT.log_config_append }}
174 subPath: {{ base .Values.conf.neutron.DEFAULT.log_config_append }}
175 readOnly: true
176 {{- end }}
177 - name: neutron-etc
178 mountPath: /etc/neutron/plugins/ml2/ml2_conf.ini
179 subPath: ml2_conf.ini
180 readOnly: true
181 - name: neutron-etc
182 mountPath: /etc/neutron/plugins/ml2/linuxbridge_agent.ini
183 subPath: linuxbridge_agent.ini
184 readOnly: true
185 - name: neutron-etc
186 # NOTE (Portdirect): We mount here to override Kollas
187 # custom sudoers file when using Kolla images, this
188 # location will also work fine for other images.
189 mountPath: /etc/sudoers.d/kolla_neutron_sudoers
190 subPath: neutron_sudoers
191 readOnly: true
192 - name: neutron-etc
193 mountPath: /etc/neutron/rootwrap.conf
194 subPath: rootwrap.conf
195 readOnly: true
196 {{- range $key, $value := $envAll.Values.conf.rootwrap_filters }}
197 {{- if ( has "lb_agent" $value.pods ) }}
198 {{- $filePrefix := replace "_" "-" $key }}
199 {{- $rootwrapFile := printf "/etc/neutron/rootwrap.d/%s.filters" $filePrefix }}
200 - name: neutron-etc
201 mountPath: {{ $rootwrapFile }}
202 subPath: {{ base $rootwrapFile }}
203 readOnly: true
204 {{- end }}
205 {{- end }}
206 - name: run
207 mountPath: /run
208{{- dict "enabled" $envAll.Values.manifests.certificates "name" $envAll.Values.endpoints.oslo_messaging.auth.admin.secret.tls.internal "path" "/etc/rabbitmq/certs" | include "helm-toolkit.snippets.tls_volume_mount" | indent 12 }}
209{{ if $mounts_neutron_lb_agent.volumeMounts }}{{ toYaml $mounts_neutron_lb_agent.volumeMounts | indent 12 }}{{ end }}
210 volumes:
211 - name: pod-tmp
212 emptyDir: {}
213 - name: pod-var-neutron
214 emptyDir: {}
215 - name: pod-shared
216 emptyDir: {}
217 - name: neutron-bin
218 configMap:
219 name: neutron-bin
220 defaultMode: 0555
221 - name: neutron-etc
222 secret:
223 secretName: {{ $configMapName }}
224 defaultMode: 0444
225 - name: run
226 hostPath:
227 path: /run
228 - name: host-rootfs
229 hostPath:
230 path: /
231{{- dict "enabled" $envAll.Values.manifests.certificates "name" $envAll.Values.endpoints.oslo_messaging.auth.admin.secret.tls.internal | include "helm-toolkit.snippets.tls_volume" | indent 8 }}
232{{ if $mounts_neutron_lb_agent.volumes }}{{ toYaml $mounts_neutron_lb_agent.volumes | indent 8 }}{{ end }}
233{{- end }}
234{{- end }}
235
236{{- if and .Values.manifests.daemonset_lb_agent ( has "linuxbridge" .Values.network.backend ) }}
237{{- $envAll := . }}
238{{- $daemonset := "lb-agent" }}
239{{- $configMapName := "neutron-etc" }}
240{{- $serviceAccountName := "neutron-lb-agent" }}
241{{- $dependencyOpts := dict "envAll" $envAll "dependencyMixinParam" $envAll.Values.network.backend "dependencyKey" "lb_agent" -}}
242{{- $_ := include "helm-toolkit.utils.dependency_resolver" $dependencyOpts | toString | fromYaml }}
243{{ tuple $envAll "pod_dependency" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
244{{- $daemonset_yaml := list $daemonset $configMapName $serviceAccountName . | include "neutron.lb_agent.daemonset" | toString | fromYaml }}
245{{- $configmap_yaml := "neutron.configmap.etc" }}
246{{- list $daemonset $daemonset_yaml $configmap_yaml $configMapName . | include "helm-toolkit.utils.daemonset_overrides" }}
247{{- end }}