Mohammed Naser | 54ee992 | 2023-07-22 18:40:25 +0000 | [diff] [blame] | 1 | {{/* |
| 2 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 3 | you may not use this file except in compliance with the License. |
| 4 | You may obtain a copy of the License at |
| 5 | |
| 6 | http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | |
| 8 | Unless required by applicable law or agreed to in writing, software |
| 9 | distributed under the License is distributed on an "AS IS" BASIS, |
| 10 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 11 | See the License for the specific language governing permissions and |
| 12 | limitations under the License. |
| 13 | */}} |
| 14 | |
Mohammed Naser | 1220717 | 2024-02-05 18:49:35 -0500 | [diff] [blame] | 15 | {{- define "controllerReadinessProbeTemplate" }} |
| 16 | exec: |
| 17 | command: |
| 18 | - /usr/bin/ovn-kube-util |
| 19 | - readiness-probe |
| 20 | - -t |
| 21 | - ovn-controller |
| 22 | {{- end }} |
| 23 | |
okozachenko1203 | 17930d4 | 2023-09-06 00:24:05 +1000 | [diff] [blame] | 24 | {{- if .Values.manifests.daemonset_ovn_controller }} |
Mohammed Naser | 54ee992 | 2023-07-22 18:40:25 +0000 | [diff] [blame] | 25 | {{- $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. | 7963525 | 2024-10-25 16:42:49 +0200 | [diff] [blame] | 30 | |
| 31 | --- |
Mohammed Naser | 54ee992 | 2023-07-22 18:40:25 +0000 | [diff] [blame] | 32 | kind: DaemonSet |
| 33 | apiVersion: apps/v1 |
| 34 | metadata: |
| 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. | 7963525 | 2024-10-25 16:42:49 +0200 | [diff] [blame] | 40 | {{ tuple $envAll "ovn" "ovn-controller" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} |
Mohammed Naser | 54ee992 | 2023-07-22 18:40:25 +0000 | [diff] [blame] | 41 | spec: |
| 42 | selector: |
| 43 | matchLabels: |
Oleksandr K. | 7963525 | 2024-10-25 16:42:49 +0200 | [diff] [blame] | 44 | {{ tuple $envAll "ovn" "ovn-controller" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }} |
Mohammed Naser | 54ee992 | 2023-07-22 18:40:25 +0000 | [diff] [blame] | 45 | template: |
| 46 | metadata: |
| 47 | labels: |
Oleksandr K. | 7963525 | 2024-10-25 16:42:49 +0200 | [diff] [blame] | 48 | {{ tuple $envAll "ovn" "ovn-controller" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} |
Mohammed Naser | 54ee992 | 2023-07-22 18:40:25 +0000 | [diff] [blame] | 49 | 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 Naser | d6db245 | 2023-07-23 14:34:59 +0000 | [diff] [blame] | 55 | hostNetwork: true |
Oleksandr K. | e4e8316 | 2024-10-23 22:09:30 +0200 | [diff] [blame] | 56 | hostPID: true |
| 57 | hostIPC: true |
Mohammed Naser | d6db245 | 2023-07-23 14:34:59 +0000 | [diff] [blame] | 58 | dnsPolicy: {{ .Values.pod.dns_policy }} |
Mohammed Naser | 54ee992 | 2023-07-22 18:40:25 +0000 | [diff] [blame] | 59 | 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. | 7963525 | 2024-10-25 16:42:49 +0200 | [diff] [blame] | 63 | - 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 Naser | 54ee992 | 2023-07-22 18:40:25 +0000 | [diff] [blame] | 79 | - name: controller-init |
Oleksandr K. | e4e8316 | 2024-10-23 22:09:30 +0200 | [diff] [blame] | 80 | {{ dict "envAll" $envAll "application" "ovn_controller" "container" "controller_init" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }} |
Mohammed Naser | 54ee992 | 2023-07-22 18:40:25 +0000 | [diff] [blame] | 81 | {{ tuple $envAll "ovn_controller" | include "helm-toolkit.snippets.image" | indent 10 }} |
Mohammed Naser | 54ee992 | 2023-07-22 18:40:25 +0000 | [diff] [blame] | 82 | command: |
| 83 | - /tmp/ovn-controller-init.sh |
okozachenko1203 | 6ba3690 | 2023-07-27 23:05:13 +1000 | [diff] [blame] | 84 | env: |
Mohammed Naser | 19d6312 | 2024-01-08 17:10:05 -0500 | [diff] [blame] | 85 | - name: NODE_NAME |
| 86 | valueFrom: |
| 87 | fieldRef: |
| 88 | fieldPath: spec.nodeName |
Mohammed Naser | 54ee992 | 2023-07-22 18:40:25 +0000 | [diff] [blame] | 89 | 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. | 7963525 | 2024-10-25 16:42:49 +0200 | [diff] [blame] | 100 | - name: gw-enabled |
| 101 | mountPath: /tmp/gw-enabled |
| 102 | readOnly: true |
Mohammed Naser | 54ee992 | 2023-07-22 18:40:25 +0000 | [diff] [blame] | 103 | containers: |
| 104 | - name: controller |
| 105 | {{ tuple $envAll "ovn_controller" | include "helm-toolkit.snippets.image" | indent 10 }} |
Rico Lin | 60f9d37 | 2025-01-14 14:07:43 +0800 | [diff] [blame] | 106 | {{ tuple $envAll $envAll.Values.pod.resources.ovn_controller | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} |
Mohammed Naser | 54ee992 | 2023-07-22 18:40:25 +0000 | [diff] [blame] | 107 | {{ dict "envAll" $envAll "application" "ovn_controller" "container" "controller" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }} |
Oleksandr K. | e4e8316 | 2024-10-23 22:09:30 +0200 | [diff] [blame] | 108 | command: |
| 109 | - /root/ovnkube.sh |
| 110 | - ovn-controller |
Mohammed Naser | 1220717 | 2024-02-05 18:49:35 -0500 | [diff] [blame] | 111 | {{ 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 Naser | 54ee992 | 2023-07-22 18:40:25 +0000 | [diff] [blame] | 127 | volumeMounts: |
Mohammed Naser | 54ee992 | 2023-07-22 18:40:25 +0000 | [diff] [blame] | 128 | - name: run-openvswitch |
Oleksandr K. | 7963525 | 2024-10-25 16:42:49 +0200 | [diff] [blame] | 129 | mountPath: /run/openvswitch |
Oleksandr K. | e4e8316 | 2024-10-23 22:09:30 +0200 | [diff] [blame] | 130 | - name: logs |
| 131 | mountPath: /var/log/ovn |
Oleksandr K. | 7963525 | 2024-10-25 16:42:49 +0200 | [diff] [blame] | 132 | - name: run-openvswitch |
Oleksandr K. | e4e8316 | 2024-10-23 22:09:30 +0200 | [diff] [blame] | 133 | mountPath: /run/ovn |
Oleksandr K. | 7963525 | 2024-10-25 16:42:49 +0200 | [diff] [blame] | 134 | {{- 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 Naser | 54ee992 | 2023-07-22 18:40:25 +0000 | [diff] [blame] | 180 | 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. | e4e8316 | 2024-10-23 22:09:30 +0200 | [diff] [blame] | 193 | - 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. | 7963525 | 2024-10-25 16:42:49 +0200 | [diff] [blame] | 201 | - 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 Naser | 54ee992 | 2023-07-22 18:40:25 +0000 | [diff] [blame] | 216 | {{- end }} |