blob: e2bd90b53f8c702ac20fd5bdb080672eb82e0608 [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 "bagpipeBgpLivenessProbeTemplate" }}
16tcpSocket:
17 port: {{ tuple "network" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
18{{- end }}
19
20{{- define "bagpipeBgpReadinessProbeTemplate" }}
21tcpSocket:
22 port: {{ tuple "network" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
23{{- end }}
24
25{{- define "neutron.bagpipe_bgp.daemonset" }}
26{{- $daemonset := index . 0 }}
27{{- $configMapName := index . 1 }}
28{{- $serviceAccountName := index . 2 }}
29{{- $envAll := index . 3 }}
30{{- with $envAll }}
31
32{{- $mounts_neutron_bagpipe_bgp := .Values.pod.mounts.bagpipe_bgp.bagpipe_bgp }}
33{{- $mounts_neutron_bagpipe_bgp_init := .Values.pod.mounts.bagpipe_bgp.init_container }}
34
35---
36apiVersion: apps/v1
37kind: DaemonSet
38metadata:
39 name: bagpipe-bgp
40 annotations:
41 {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
42 labels:
43{{ tuple $envAll "neutron" "bagpipe-bgp" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
44spec:
45 selector:
46 matchLabels:
47{{ tuple $envAll "neutron" "bagpipe-bgp" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }}
48{{ tuple $envAll "bagpipe_bgp" | include "helm-toolkit.snippets.kubernetes_upgrades_daemonset" | indent 2 }}
49 template:
50 metadata:
51 labels:
52{{ tuple $envAll "neutron" "bagpipe-bgp" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
53 annotations:
54{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }}
55 configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }}
56 configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }}
Rico Lin0e153482024-05-03 03:29:14 +080057{{ tuple "neutron_bagpipe_bgp" . | include "helm-toolkit.snippets.custom_pod_annotations" | indent 8 }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050058 spec:
59{{ dict "envAll" $envAll "application" "neutron_bagpipe_bgp" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }}
Dong Ma36b89222025-02-13 16:15:52 +000060{{ with .Values.pod.priorityClassName.bagpipe_bgp }}
Dong Mae5bd5a32025-02-11 11:03:48 +000061 priorityClassName: {{ . }}
62{{ end }}
Dong Ma36b89222025-02-13 16:15:52 +000063{{ with .Values.pod.runtimeClassName.bagpipe_bgp }}
Dong Mae5bd5a32025-02-11 11:03:48 +000064 runtimeClassName: {{ . }}
65{{ end }}
Mohammed Naserf3f59a72023-01-15 21:02:04 -050066 serviceAccountName: {{ $serviceAccountName }}
67{{ if $envAll.Values.pod.tolerations.neutron.enabled }}
68{{ tuple $envAll "neutron" | include "helm-toolkit.snippets.kubernetes_tolerations" | indent 6 }}
69{{ end }}
70 nodeSelector:
71 {{ .Values.labels.bagpipe_bgp.node_selector_key }}: {{ .Values.labels.bagpipe_bgp.node_selector_value }}
72 dnsPolicy: ClusterFirstWithHostNet
73 hostNetwork: true
74 {{- if or ( gt .Capabilities.KubeVersion.Major "1" ) ( ge .Capabilities.KubeVersion.Minor "10" ) }}
75 shareProcessNamespace: true
76 {{- else }}
77 hostPID: true
78 {{- end }}
79 initContainers:
80{{ tuple $envAll "pod_dependency" $mounts_neutron_bagpipe_bgp_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
81 - name: neutron-bagpipe-bgp-init
82{{ tuple $envAll "neutron_bagpipe_bgp" | include "helm-toolkit.snippets.image" | indent 10 }}
83 securityContext:
84 privileged: true
85 runAsUser: 0
86 command:
87 - /tmp/neutron-bagpipe-bgp-init.sh
88 volumeMounts:
89 - name: pod-tmp
90 mountPath: /tmp
91 - name: neutron-bin
92 mountPath: /tmp/neutron-bagpipe-bgp-init.sh
93 subPath: neutron-bagpipe-bgp-init.sh
94 readOnly: true
95 - name: run
96 mountPath: /run
97 containers:
98 - name: neutron-bagpipe-bgp
99{{ tuple $envAll "neutron_bagpipe_bgp" | include "helm-toolkit.snippets.image" | indent 10 }}
100{{ tuple $envAll $envAll.Values.pod.resources.agent.bagpipe_bgp | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
101{{ dict "envAll" $envAll "application" "neutron_bagpipe_bgp" "container" "neutron_bagpipe_bgp" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
102{{ dict "envAll" $envAll "component" "bagpipe_bgp" "container" "bagpipe_bgp" "type" "liveness" "probeTemplate" (include "bagpipeBgpLivenessProbeTemplate" $envAll | fromYaml) | include "helm-toolkit.snippets.kubernetes_probe" | indent 10 }}
103{{ dict "envAll" $envAll "component" "bagpipe_bgp" "container" "bagpipe_bgp" "type" "readiness" "probeTemplate" (include "bagpipeBgpReadinessProbeTemplate" $envAll | fromYaml) | include "helm-toolkit.snippets.kubernetes_probe" | indent 10 }}
104 command:
105 - /tmp/neutron-bagpipe-bgp.sh
106 volumeMounts:
107 - name: pod-tmp
108 mountPath: /tmp
109 - name: pod-var-neutron
110 mountPath: {{ .Values.conf.neutron.DEFAULT.state_path }}
111 - name: neutron-bin
112 mountPath: /tmp/neutron-bagpipe-bgp.sh
113 subPath: neutron-bagpipe-bgp.sh
114 readOnly: true
115 - name: neutron-bin
116 mountPath: /tmp/health-probe.py
117 subPath: health-probe.py
118 readOnly: true
119 - name: neutron-etc
120 mountPath: /tmp/auto_bridge_add
121 subPath: auto_bridge_add
122 readOnly: true
123 - name: neutron-etc
124 mountPath: /etc/bagpipe-bgp/bgp.conf
125 subPath: bagpipe_bgp.conf
126 readOnly: true
127 - name: neutron-etc
128 # NOTE (Portdirect): We mount here to override Kollas
129 # custom sudoers file when using Kolla images, this
130 # location will also work fine for other images.
131 mountPath: /etc/sudoers.d/kolla_neutron_sudoers
132 subPath: neutron_sudoers
133 readOnly: true
134 - name: neutron-etc
135 mountPath: /etc/neutron/rootwrap.conf
136 subPath: rootwrap.conf
137 readOnly: true
138 {{- range $key, $value := $envAll.Values.conf.rootwrap_filters }}
139 {{- if ( has "bagpipe_bgp" $value.pods ) }}
140 {{- $filePrefix := replace "_" "-" $key }}
141 {{- $rootwrapFile := printf "/etc/neutron/rootwrap.d/%s.filters" $filePrefix }}
142 - name: neutron-etc
143 mountPath: {{ $rootwrapFile }}
144 subPath: {{ base $rootwrapFile }}
145 readOnly: true
146 {{- end }}
147 {{- end }}
148 - name: libmodules
149 mountPath: /lib/modules
150 readOnly: true
151 - name: run
152 mountPath: /run
153{{ if $mounts_neutron_bagpipe_bgp.volumeMounts }}{{ toYaml $mounts_neutron_bagpipe_bgp.volumeMounts | indent 12 }}{{ end }}
154 volumes:
155 - name: pod-tmp
156 emptyDir: {}
157 - name: pod-var-neutron
158 emptyDir: {}
159 - name: neutron-bin
160 configMap:
161 name: neutron-bin
162 defaultMode: 0555
163 - name: neutron-etc
164 secret:
165 secretName: {{ $configMapName }}
166 defaultMode: 0444
167 - name: libmodules
168 hostPath:
169 path: /lib/modules
170 - name: run
171 hostPath:
172 path: /run
173{{ if $mounts_neutron_bagpipe_bgp.volumes }}{{ toYaml $mounts_neutron_bagpipe_bgp.volumes | indent 8 }}{{ end }}
174{{- end }}
175{{- end }}
176
177{{- if .Values.manifests.daemonset_bagpipe_bgp }}
178{{- $envAll := . }}
179{{- $daemonset := "bagpipe-bgp" }}
180{{- $configMapName := "neutron-etc" }}
181{{- $serviceAccountName := "neutron-bagpipe-bgp" }}
182{{- $dependencyOpts := dict "envAll" $envAll "dependencyMixinParam" $envAll.Values.network.backend "dependencyKey" "bagpipe_bgp" -}}
183{{- $_ := include "helm-toolkit.utils.dependency_resolver" $dependencyOpts | toString | fromYaml }}
184{{ tuple $envAll "pod_dependency" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
185{{- $daemonset_yaml := list $daemonset $configMapName $serviceAccountName . | include "neutron.bagpipe_bgp.daemonset" | toString | fromYaml }}
186{{- $configmap_yaml := "neutron.configmap.etc" }}
187{{- list $daemonset $daemonset_yaml $configmap_yaml $configMapName . | include "helm-toolkit.utils.daemonset_overrides" }}
188{{- end }}