blob: a6180aaac14ac5d260ffbdb35add0c825bb0784a [file] [log] [blame]
Mohammed Naser1d75a922023-07-23 19:24:49 +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 "ovnsbReadinessProbeTemplate" }}
16exec:
17 command:
18 - /usr/bin/ovn-kube-util
19 - readiness-probe
20 - -t
21{{- if gt (int .Values.pod.replicas.ovn_ovsdb_sb) 1 }}
22 - ovnsb-db-raft
23{{- else }}
24 - ovnsb-db
25{{- end }}
26{{- end }}
27
Mohammed Naser1d75a922023-07-23 19:24:49 +000028{{- if .Values.manifests.statefulset_ovn_ovsdb_sb }}
29{{- $envAll := . }}
30
31{{- $serviceAccountName := "ovn-ovsdb-sb" }}
32{{ tuple $envAll "ovn_ovsdb_sb" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
33---
34apiVersion: apps/v1
35kind: StatefulSet
36metadata:
37 name: ovn-ovsdb-sb
38 annotations:
39 {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
40 labels:
41{{ tuple $envAll "ovn" "ovn-ovsdb-sb" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
42spec:
43 serviceName: {{ tuple "ovn-ovsdb-sb" "direct" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
Mohammed Naser12207172024-02-05 18:49:35 -050044 podManagementPolicy: Parallel
Mohammed Naser1d75a922023-07-23 19:24:49 +000045 replicas: {{ .Values.pod.replicas.ovn_ovsdb_sb }}
46 selector:
47 matchLabels:
48{{ tuple $envAll "ovn" "ovn-ovsdb-sb" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }}
49 template:
50 metadata:
51 labels:
52{{ tuple $envAll "ovn" "ovn-ovsdb-sb" | 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 spec:
57 serviceAccountName: {{ $serviceAccountName }}
58 affinity:
59{{- tuple $envAll "ovn" "ovn-ovsdb-sb" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }}
60 nodeSelector:
61 {{ .Values.labels.ovn_ovsdb_sb.node_selector_key }}: {{ .Values.labels.ovn_ovsdb_sb.node_selector_value }}
62 initContainers:
63{{- tuple $envAll "ovn_ovsdb_sb" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
64 containers:
65 - name: ovsdb
Mohammed Naser12207172024-02-05 18:49:35 -050066 command:
67 - /root/ovnkube.sh
68{{- if gt (int .Values.pod.replicas.ovn_ovsdb_sb) 1 }}
69 - sb-ovsdb-raft
70{{- else }}
71 - sb-ovsdb
72{{- end }}
Mohammed Naser1d75a922023-07-23 19:24:49 +000073{{ tuple $envAll "ovn_ovsdb_sb" | include "helm-toolkit.snippets.image" | indent 10 }}
Rico Lin60f9d372025-01-14 14:07:43 +080074{{ tuple $envAll $envAll.Values.pod.resources.ovn_ovsdb_sb | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
Mohammed Naser12207172024-02-05 18:49:35 -050075{{ dict "envAll" . "component" "ovn_ovsdb_sb" "container" "ovsdb" "type" "readiness" "probeTemplate" (include "ovnsbReadinessProbeTemplate" . | fromYaml) | include "helm-toolkit.snippets.kubernetes_probe" | indent 10 }}
Mohammed Naser1d75a922023-07-23 19:24:49 +000076 ports:
77 - containerPort: {{ tuple "ovn-ovsdb-sb" "internal" "ovsdb" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
78 - containerPort: {{ tuple "ovn-ovsdb-sb" "internal" "raft" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
79 env:
Mohammed Naser12207172024-02-05 18:49:35 -050080 - name: OVN_DAEMONSET_VERSION
81 value: "3"
82 - name: OVN_LOGLEVEL_SB
83 value: "-vconsole:info -vfile:info"
84 - name: OVN_KUBERNETES_NAMESPACE
85 valueFrom:
86 fieldRef:
87 fieldPath: metadata.namespace
88 - name: OVN_KUBERNETES_STATEFULSET
89 value: ovn-ovsdb-sb
90 - name: POD_NAME
91 valueFrom:
92 fieldRef:
93 fieldPath: metadata.name
94 - name: OVN_SSL_ENABLE
95 value: "no"
96 - name: ENABLE_IPSEC
97 value: "false"
98 - name: OVN_SB_RAFT_ELECTION_TIMER
99 value: "1000"
100 - name: OVN_SB_PORT
okozachenko1203a4c99352023-07-27 23:10:45 +1000101 value: {{ tuple "ovn-ovsdb-sb" "internal" "ovsdb" . | include "helm-toolkit.endpoints.endpoint_port_lookup" | quote }}
Mohammed Naser12207172024-02-05 18:49:35 -0500102 - name: OVN_SB_RAFT_PORT
103 value: {{ tuple "ovn-ovsdb-sb" "internal" "raft" . | include "helm-toolkit.endpoints.endpoint_port_lookup" | quote }}
Mohammed Naser1d75a922023-07-23 19:24:49 +0000104 volumeMounts:
Mohammed Naser1d75a922023-07-23 19:24:49 +0000105 - name: run-openvswitch
Mohammed Naser12207172024-02-05 18:49:35 -0500106 mountPath: /var/run/openvswitch
107 - name: run-openvswitch
108 mountPath: /var/run/ovn
Mohammed Naser1d75a922023-07-23 19:24:49 +0000109 - name: data
Oleksandr Ke192c9e2024-04-02 18:54:58 +0200110 mountPath: /etc/ovn
Mohammed Naser1d75a922023-07-23 19:24:49 +0000111 volumes:
112 - name: run-openvswitch
Oleksandr K.e4e83162024-10-23 22:09:30 +0200113 hostPath:
114 path: /run/openvswitch
115 type: DirectoryOrCreate
Mohammed Naser1d75a922023-07-23 19:24:49 +0000116{{- if not .Values.volume.ovn_ovsdb_sb.enabled }}
117 - name: data
118 emptyDir: {}
119{{- else }}
120 volumeClaimTemplates:
121 - metadata:
122 name: data
123 spec:
124 accessModes: ["ReadWriteOnce"]
Mohammed Naser12207172024-02-05 18:49:35 -0500125 storageClassName: {{ $envAll.Values.volume.ovn_ovsdb_sb.class_name }}
Mohammed Naser1d75a922023-07-23 19:24:49 +0000126 resources:
127 requests:
128 storage: {{ $envAll.Values.volume.ovn_ovsdb_sb.size }}
Mohammed Naser1d75a922023-07-23 19:24:49 +0000129{{- end }}
130
131{{- end }}