[ATMOSPHERE-563] [stable/2023.1] chart/ovn: make vector config as customizable (#2092)
This is an automated cherry-pick of #2086
/assign okozachenko1203
diff --git a/charts/ovn/templates/secret-vector.yaml b/charts/ovn/templates/secret-vector.yaml
index 028e8a9..989f3af 100644
--- a/charts/ovn/templates/secret-vector.yaml
+++ b/charts/ovn/templates/secret-vector.yaml
@@ -13,6 +13,7 @@
*/}}
{{- if .Values.pod.sidecars.vector }}
+{{- $envAll := . }}
---
apiVersion: v1
@@ -20,37 +21,6 @@
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"
- encoding = "json"
-
- [transforms.parse_log_message]
- type = "remap"
- inputs = ["ovn_log_parser_out"]
- source = '''
- del(.source_type)
- del(.path)
- '''
-
- [sinks.loki_sink]
- type = "loki"
- labels.event_source = "network_logs"
- inputs = ["parse_log_message"]
- endpoint = "http://loki.monitoring:3100"
- encoding.codec = "json"
- tenant_id = "{{`{{ project_id }}`}}"
+data:
+{{- include "helm-toolkit.snippets.values_template_renderer" (dict "envAll" $envAll "template" .Values.conf.vector "key" "vector.toml" "format" "Secret" ) | indent 2 }}
{{- end }}
diff --git a/charts/ovn/values.yaml b/charts/ovn/values.yaml
index 8c99d50..3ffdece 100644
--- a/charts/ovn/values.yaml
+++ b/charts/ovn/values.yaml
@@ -102,6 +102,38 @@
thunder-lock: true
worker-reload-mercy: 80
wsgi-file: /var/lib/openstack/bin/neutron-ovn-network-logging-parser-wsgi
+ vector: |
+ [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"
+ encoding = "json"
+
+ [transforms.parse_log_message]
+ type = "remap"
+ inputs = ["ovn_log_parser_out"]
+ source = '''
+ del(.source_type)
+ del(.path)
+ '''
+
+ [sinks.loki_sink]
+ type = "loki"
+ labels.event_source = "network_logs"
+ inputs = ["parse_log_message"]
+ endpoint = "http://loki.monitoring:3100"
+ encoding.codec = "json"
+ tenant_id = "{{`{{ project_id }}`}}"
pod:
# NOTE: should be same as nova.pod.use_fqdn.compute
diff --git a/charts/patches/ovn/0002-add-logging-parser.patch b/charts/patches/ovn/0002-add-logging-parser.patch
index 69a74a0..376a924 100644
--- a/charts/patches/ovn/0002-add-logging-parser.patch
+++ b/charts/patches/ovn/0002-add-logging-parser.patch
@@ -70,12 +70,12 @@
{{- end }}
diff --git a/ovn/templates/daemonset-controller.yaml b/ovn/templates/daemonset-controller.yaml
-index e421794f..843cbeaa 100644
+index 6c240213..82b70f78 100644
--- a/ovn/templates/daemonset-controller.yaml
+++ b/ovn/templates/daemonset-controller.yaml
@@ -156,6 +156,52 @@ spec:
mountPath: /var/log/ovn
- - name: run-ovn
+ - name: run-openvswitch
mountPath: /run/ovn
+ {{- if .Values.pod.sidecars.vector }}
+ - name: vector
@@ -126,7 +126,7 @@
volumes:
- name: ovn-bin
configMap:
-@@ -225,4 +225,17 @@
+@@ -179,4 +225,17 @@ spec:
type: DirectoryOrCreate
- name: gw-enabled
emptyDir: {}
@@ -146,10 +146,10 @@
{{- end }}
diff --git a/ovn/templates/secret-vector.yaml b/ovn/templates/secret-vector.yaml
new file mode 100644
-index 00000000..028e8a9a
+index 00000000..989f3afa
--- /dev/null
+++ b/ovn/templates/secret-vector.yaml
-@@ -0,0 +1,56 @@
+@@ -0,0 +1,26 @@
+{{/*
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
@@ -165,6 +165,7 @@
+*/}}
+
+{{- if .Values.pod.sidecars.vector }}
++{{- $envAll := . }}
+
+---
+apiVersion: v1
@@ -172,8 +173,44 @@
+metadata:
+ name: ovn-vector-config
+type: Opaque
-+stringData:
-+ vector.toml: |
++data:
++{{- include "helm-toolkit.snippets.values_template_renderer" (dict "envAll" $envAll "template" .Values.conf.vector "key" "vector.toml" "format" "Secret" ) | indent 2 }}
++{{- end }}
+diff --git a/ovn/values.yaml b/ovn/values.yaml
+index 8459e33a..3ffdecec 100644
+--- a/ovn/values.yaml
++++ b/ovn/values.yaml
+@@ -27,6 +27,8 @@ images:
+ ovn_controller_kubectl: docker.io/openstackhelm/ceph-config-helper:latest-ubuntu_jammy
+ dep_check: quay.io/airshipit/kubernetes-entrypoint:latest-ubuntu_focal
+ image_repo_sync: docker.io/library/docker:17.07.0
++ vector: docker.io/timberio/vector:0.39.0-debian
++ ovn_logging_parser: docker.io/openstackhelm/neutron:2024.1-ubuntu_jammy
+ pull_policy: "IfNotPresent"
+ local_registry:
+ active: false
+@@ -83,6 +85,56 @@ conf:
+ # br-public: eth1
+ auto_bridge_add: {}
+
++ ovn_network_logging_parser_uwsgi:
++ uwsgi:
++ add-header: "Connection: close"
++ buffer-size: 65535
++ die-on-term: true
++ enable-threads: true
++ exit-on-reload: false
++ hook-master-start: unix_signal:15 gracefully_kill_them_all
++ lazy-apps: true
++ log-x-forwarded-for: true
++ master: true
++ processes: 1
++ 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-ovn-network-logging-parser-wsgi
++ vector: |
+ [sources.file_logs]
+ type = "file"
+ include = [ "/logs/ovn-controller.log" ]
@@ -205,45 +242,11 @@
+ endpoint = "http://loki.monitoring:3100"
+ encoding.codec = "json"
+ tenant_id = "{{`{{ project_id }}`}}"
-+{{- end }}
-diff --git a/ovn/values.yaml b/ovn/values.yaml
-index b07a0f5a..79fde2c2 100644
---- a/ovn//values.yaml
-+++ b/ovn//values.yaml
-@@ -26,5 +26,7 @@ images:
- dep_check: quay.io/airshipit/kubernetes-entrypoint:latest-ubuntu_focal
- image_repo_sync: docker.io/library/docker:17.07.0
-+ vector: docker.io/timberio/vector:0.39.0-debian
-+ ovn_logging_parser: docker.io/openstackhelm/neutron:2024.1-ubuntu_jammy
- pull_policy: "IfNotPresent"
- local_registry:
- active: false
-@@ -82,6 +84,24 @@ conf:
- # br-public: eth1
- auto_bridge_add: {}
-
-+ ovn_network_logging_parser_uwsgi:
-+ uwsgi:
-+ add-header: "Connection: close"
-+ buffer-size: 65535
-+ die-on-term: true
-+ enable-threads: true
-+ exit-on-reload: false
-+ hook-master-start: unix_signal:15 gracefully_kill_them_all
-+ lazy-apps: true
-+ log-x-forwarded-for: true
-+ master: true
-+ processes: 1
-+ 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-ovn-network-logging-parser-wsgi
+
pod:
# NOTE: should be same as nova.pod.use_fqdn.compute
use_fqdn:
-@@ -109,6 +129,12 @@ pod:
+@@ -102,6 +154,12 @@ pod:
controller:
readOnlyRootFilesystem: true
privileged: true
@@ -256,7 +259,7 @@
tolerations:
ovn_ovsdb_nb:
enabled: false
-@@ -237,6 +263,20 @@ pod:
+@@ -217,6 +275,20 @@ pod:
limits:
memory: "1024Mi"
cpu: "2000m"
@@ -277,8 +280,7 @@
jobs:
image_repo_sync:
requests:
-@@ -245,7 +286,11 @@ pod:
- limits:
+@@ -226,6 +298,10 @@ pod:
memory: "1024Mi"
cpu: "2000m"
@@ -289,7 +291,7 @@
secrets:
oci_image_registry:
ovn: ovn-oci-image-registry-key
-@@ -304,6 +349,22 @@ endpoints:
+@@ -284,6 +360,22 @@ endpoints:
default: 6642
raft:
default: 6644