Skip to content

Commit

Permalink
fix: update ovn chart close to upstream (#2023)
Browse files Browse the repository at this point in the history
Reviewed-by: Mohammed Naser <[email protected]>
  • Loading branch information
okozachenko1203 authored Oct 25, 2024
1 parent d89be1b commit 7963525
Show file tree
Hide file tree
Showing 11 changed files with 183 additions and 785 deletions.
4 changes: 4 additions & 0 deletions .charts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@ charts:
version: 0.1.13
repository: *openstack_helm_infra_repository
dependencies: *openstack_helm_dependencies
patches:
gerrit:
review.opendev.org:
- 933333
- name: placement
version: 0.3.9
repository: *openstack_helm_repository
Expand Down
8 changes: 7 additions & 1 deletion charts/ovn/templates/bin/_ovn-controller-init.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,13 @@ ovs-vsctl set open . external-ids:rundir="/var/run/openvswitch"
ovs-vsctl set open . external-ids:ovn-encap-type="{{ .Values.conf.ovn_encap_type }}"
ovs-vsctl set open . external-ids:ovn-bridge="{{ .Values.conf.ovn_bridge }}"
ovs-vsctl set open . external-ids:ovn-bridge-mappings="{{ .Values.conf.ovn_bridge_mappings }}"
ovs-vsctl set open . external-ids:ovn-cms-options="${OVN_CMS_OPTIONS}"

GW_ENABLED=$(cat /tmp/gw-enabled/gw-enabled)
if [[ ${GW_ENABLED} == {{ .Values.labels.ovn_controller_gw.node_selector_value }} ]]; then
ovs-vsctl set open . external-ids:ovn-cms-options={{ .Values.conf.ovn_cms_options_gw_enabled }}
else
ovs-vsctl set open . external-ids:ovn-cms-options={{ .Values.conf.ovn_cms_options }}
fi

{{ if .Values.conf.ovn_bridge_datapath_type -}}
ovs-vsctl set open . external-ids:ovn-bridge-datapath-type="{{ .Values.conf.ovn_bridge_datapath_type }}"
Expand Down
190 changes: 0 additions & 190 deletions charts/ovn/templates/daemonset-controller-gw.yaml

This file was deleted.

120 changes: 111 additions & 9 deletions charts/ovn/templates/daemonset-controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,33 @@ exec:

{{- $configMapName := "ovn-etc" }}
{{- $serviceAccountName := "ovn-controller" }}
{{- $serviceAccountNamespace := $envAll.Release.Namespace }}
{{ tuple $envAll "ovn_controller" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}

---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: ovn-controller-list-nodes-role-{{ $serviceAccountNamespace }}
rules:
- apiGroups: [""]
resources: ["nodes"]
verbs: ["list", "get"]

---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: ovn-controller-list-nodes-rolebinding-{{ $serviceAccountNamespace }}
subjects:
- kind: ServiceAccount
name: {{ $serviceAccountName }}
namespace: {{ $serviceAccountNamespace }}
roleRef:
kind: ClusterRole
name: ovn-controller-list-nodes-role-{{ $serviceAccountNamespace }}
apiGroup: rbac.authorization.k8s.io

---
kind: DaemonSet
apiVersion: apps/v1
Expand All @@ -36,15 +62,15 @@ metadata:
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }}
labels:
{{ tuple $envAll "ovn" "ovn_controller" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
{{ tuple $envAll "ovn" "ovn-controller" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
spec:
selector:
matchLabels:
{{ tuple $envAll "ovn" "ovn_controller" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }}
{{ tuple $envAll "ovn" "ovn-controller" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }}
template:
metadata:
labels:
{{ tuple $envAll "ovn" "ovn_controller" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
{{ tuple $envAll "ovn" "ovn-controller" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
annotations:
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }}
configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }}
Expand All @@ -59,14 +85,28 @@ spec:
{{ .Values.labels.ovn_controller.node_selector_key }}: {{ .Values.labels.ovn_controller.node_selector_value }}
initContainers:
{{- tuple $envAll "ovn_controller" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
- name: get-gw-enabled
{{ tuple $envAll "ovn_controller_kubectl" | include "helm-toolkit.snippets.image" | indent 10 }}
command:
- /bin/bash
- -c
- |
kubectl get node ${NODENAME} -o jsonpath='{.metadata.labels.{{ .Values.labels.ovn_controller_gw.node_selector_key }}}' > /tmp/gw-enabled/gw-enabled
env:
- name: NODENAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
volumeMounts:
- name: gw-enabled
mountPath: /tmp/gw-enabled
readOnly: false
- name: controller-init
{{ dict "envAll" $envAll "application" "ovn_controller" "container" "controller_init" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
{{ tuple $envAll "ovn_controller" | include "helm-toolkit.snippets.image" | indent 10 }}
command:
- /tmp/ovn-controller-init.sh
env:
- name: OVN_CMS_OPTIONS
value: {{ .Values.conf.ovn_cms_options | quote }}
- name: NODE_NAME
valueFrom:
fieldRef:
Expand All @@ -82,6 +122,9 @@ spec:
mountPath: /tmp/auto_bridge_add
subPath: auto_bridge_add
readOnly: true
- name: gw-enabled
mountPath: /tmp/gw-enabled
readOnly: true
containers:
- name: controller
{{ tuple $envAll "ovn_controller" | include "helm-toolkit.snippets.image" | indent 10 }}
Expand All @@ -108,13 +151,57 @@ spec:
value: "no"
volumeMounts:
- name: run-openvswitch
mountPath: /var/run/ovn
- name: run-openvswitch
mountPath: /var/run/openvswitch
mountPath: /run/openvswitch
- name: logs
mountPath: /var/log/ovn
- name: run-ovn
- name: run-openvswitch
mountPath: /run/ovn
{{- if .Values.pod.sidecars.vector }}
- name: vector
{{ tuple $envAll "vector" | include "helm-toolkit.snippets.image" | indent 10 }}
{{ tuple $envAll $envAll.Values.pod.resources.vector | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
{{ dict "envAll" $envAll "application" "ovn_controller" "container" "vector" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
command:
- vector
- --config
- /etc/vector/vector.toml
volumeMounts:
- name: vector-config
mountPath: /etc/vector
- name: logs
mountPath: /logs
- name: vector-data
mountPath: /var/lib/vector
{{- end }}
{{- if .Values.pod.sidecars.ovn_logging_parser }}
- name: log-parser
{{ tuple $envAll "ovn_logging_parser" | include "helm-toolkit.snippets.image" | indent 10 }}
{{ tuple $envAll $envAll.Values.pod.resources.ovn_logging_parser | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
{{ dict "envAll" $envAll "application" "ovn_controller" "container" "ovn_logging_parser" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
command:
- /tmp/ovn-network-logging-parser.sh
- start
env:
- name: VECTOR_HTTP_ENDPOINT
value: http://localhost:5001
ports:
- name: http
containerPort: {{ tuple "ovn_logging_parser" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
protocol: TCP
volumeMounts:
- name: neutron-etc
mountPath: /etc/neutron/neutron.conf
subPath: neutron.conf
readOnly: true
- name: ovn-bin
mountPath: /tmp/ovn-network-logging-parser.sh
subPath: ovn-network-logging-parser.sh
readOnly: true
- name: ovn-etc
mountPath: /etc/neutron/neutron-ovn-network-logging-parser-uwsgi.ini
subPath: neutron-ovn-network-logging-parser-uwsgi.ini
readOnly: true
{{- end }}
volumes:
- name: ovn-bin
configMap:
Expand All @@ -136,4 +223,19 @@ spec:
hostPath:
path: /run/ovn
type: DirectoryOrCreate
- name: gw-enabled
emptyDir: {}
{{- if .Values.pod.sidecars.vector }}
- name: vector-config
secret:
secretName: ovn-vector-config
- name: vector-data
emptyDir: {}
{{- end }}
{{- if .Values.pod.sidecars.ovn_logging_parser }}
- name: neutron-etc
secret:
secretName: neutron-etc
defaultMode: 0444
{{- end }}
{{- end }}
Loading

0 comments on commit 7963525

Please sign in to comment.