From 1287fac18293ba305387b5fca903c6ee9579c8d9 Mon Sep 17 00:00:00 2001 From: okozachenko1203 Date: Thu, 4 Jul 2024 00:20:54 +1000 Subject: [PATCH] update ovn chart patch file --- .../patches/ovn/0002-add-logging-parser.patch | 119 ++++++++++++++++-- 1 file changed, 111 insertions(+), 8 deletions(-) diff --git a/charts/patches/ovn/0002-add-logging-parser.patch b/charts/patches/ovn/0002-add-logging-parser.patch index 6b60ba5adf..07535af74f 100644 --- a/charts/patches/ovn/0002-add-logging-parser.patch +++ b/charts/patches/ovn/0002-add-logging-parser.patch @@ -1,3 +1,37 @@ +diff --git a/ovn/templates/bin/_ovn-network-logging-parser.sh.tpl b/ovn/templates/bin/_ovn-network-logging-parser.sh.tpl +new file mode 100644 +index 00000000..06eaaa7f +--- /dev/null ++++ b/ovn/templates/bin/_ovn-network-logging-parser.sh.tpl +@@ -0,0 +1,28 @@ ++#!/bin/bash ++ ++{{/* ++Licensed under the Apache License, Version 2.0 (the "License"); ++you may not use this file except in compliance with the License. ++You may obtain a copy of the License at ++ ++ http://www.apache.org/licenses/LICENSE-2.0 ++ ++Unless required by applicable law or agreed to in writing, software ++distributed under the License is distributed on an "AS IS" BASIS, ++WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++See the License for the specific language governing permissions and ++limitations under the License. ++*/}} ++ ++set -ex ++COMMAND="${@:-start}" ++ ++function start () { ++ exec uwsgi --ini /etc/neutron/neutron-ovn-network-logging-parser-uwsgi.ini ++} ++ ++function stop () { ++ kill -TERM 1 ++} ++ ++$COMMAND diff --git a/ovn/templates/configmap-bin.yaml b/ovn/templates/configmap-bin.yaml index 82001f99..77547470 100644 --- a/ovn/templates/configmap-bin.yaml @@ -36,10 +70,10 @@ index 47b84be8..0d221f19 100644 {{- end }} diff --git a/ovn/templates/daemonset-controller-gw.yaml b/ovn/templates/daemonset-controller-gw.yaml -index eb309c5e..b667b4f1 100644 +index eb309c5e..3ecd81dc 100644 --- a/ovn/templates/daemonset-controller-gw.yaml +++ b/ovn/templates/daemonset-controller-gw.yaml -@@ -112,6 +112,40 @@ spec: +@@ -112,6 +112,54 @@ spec: mountPath: /var/run/ovn - name: run-openvswitch mountPath: /var/run/openvswitch @@ -50,11 +84,17 @@ index eb309c5e..b667b4f1 100644 +{{ tuple $envAll "vector" | include "helm-toolkit.snippets.image" | indent 10 }} +{{ tuple $envAll $envAll.Values.pod.resources.ovn_controller_gw.vector | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} +{{ dict "envAll" $envAll "application" "ovn_controller_gw" "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: shared + mountPath: /logs ++ - name: vector-data ++ mountPath: /var/lib/vector + {{- end }} + {{- if .Values.pod.sidecars.ovn_logging_parser }} + - name: log-parser @@ -66,7 +106,7 @@ index eb309c5e..b667b4f1 100644 + - start + env: + - name: VECTOR_HTTP_ENDPOINT -+ value: localhost:5001 ++ value: http://localhost:5001 + ports: + - name: http + containerPort: {{ tuple "ovn_logging_parser" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} @@ -76,11 +116,19 @@ index eb309c5e..b667b4f1 100644 + 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: -@@ -125,4 +159,17 @@ spec: +@@ -125,4 +173,19 @@ spec: secret: secretName: {{ $configMapName }} defaultMode: 0444 @@ -90,6 +138,8 @@ index eb309c5e..b667b4f1 100644 + - name: vector-config + secret: + secretName: ovn-vector-config ++ - name: vector-data ++ emptyDir: {} + {{- end }} + {{- if .Values.pod.sidecars.ovn_logging_parser }} + - name: neutron-etc @@ -98,8 +148,61 @@ index eb309c5e..b667b4f1 100644 + defaultMode: 0444 + {{- end }} {{- end }} +diff --git a/ovn/templates/secret-vector.yaml b/ovn/templates/secret-vector.yaml +new file mode 100644 +index 00000000..2d6ab2d1 +--- /dev/null ++++ b/ovn/templates/secret-vector.yaml +@@ -0,0 +1,46 @@ ++{{/* ++Licensed under the Apache License, Version 2.0 (the "License"); ++you may not use this file except in compliance with the License. ++You may obtain a copy of the License at ++ ++ http://www.apache.org/licenses/LICENSE-2.0 ++ ++Unless required by applicable law or agreed to in writing, software ++distributed under the License is distributed on an "AS IS" BASIS, ++WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++See the License for the specific language governing permissions and ++limitations under the License. ++*/}} ++ ++{{- if .Values.pod.sidecars.vector }} ++ ++--- ++apiVersion: v1 ++kind: Secret ++metadata: ++ name: ovn-vector-config ++type: Opaque ++stringData: ++ vector.toml: | ++ [sources.file_logs] ++ type = "file" ++ include = [ "/logs/ovn-controller.log" ] ++ ++ [sinks.ovn_log_parser_in] ++ type = "http" ++ inputs = ["file_logs"] ++ uri = "{{ tuple "ovn_logging_parser" "default" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup" }}" ++ encoding.codec = "json" ++ method = "post" ++ ++ [sources.ovn_log_parser_out] ++ type = "http_server" ++ address = "0.0.0.0:5001" ++ ++ [sinks.loki_sink] ++ type = "loki" ++ labels.job = "ovn-log-parser" ++ inputs = ["ovn_log_parser_out"] ++ endpoint = "http://loki.monitoring:3100" ++ encoding.codec = "json" ++{{- end }} +\ No newline at end of file diff --git a/ovn/values.yaml b/ovn/values.yaml -index 214dd16f..63baa34e 100644 +index 214dd16f..d0f2406b 100644 --- a/ovn/values.yaml +++ b/ovn/values.yaml @@ -26,6 +26,8 @@ images: @@ -107,7 +210,7 @@ index 214dd16f..63baa34e 100644 dep_check: quay.io/airshipit/kubernetes-entrypoint:v1.0.0 image_repo_sync: docker.io/library/docker:17.07.0 + vector: docker.io/timberio/vector:0.39.0-debian -+ ovn_logging_parser: docker.io/vexxhost/neutron-ovn-network-logging-parser:latest ++ ovn_logging_parser: docker.io/openstackhelm/neutron:2024.1-ubuntu_jammy pull_policy: "IfNotPresent" local_registry: active: false @@ -127,11 +230,11 @@ index 214dd16f..63baa34e 100644 + log-x-forwarded-for: true + master: true + processes: 1 -+ procname-prefix-spaced: "neutron-policy-server:" ++ procname-prefix-spaced: "neutron-ovn-network-logging-parser:" + route-user-agent: '^kube-probe.* donotlog:' + thunder-lock: true + worker-reload-mercy: 80 -+ wsgi-file: /var/lib/openstack/bin/neutron-policy-server-wsgi ++ wsgi-file: /var/lib/openstack/bin/neutron-ovn-network-logging-parser-wsgi + pod: security_context: