Skip to content

Commit

Permalink
update ovn chart patch file
Browse files Browse the repository at this point in the history
  • Loading branch information
okozachenko1203 committed Jul 3, 2024
1 parent 4108400 commit 1287fac
Showing 1 changed file with 111 additions and 8 deletions.
119 changes: 111 additions & 8 deletions charts/patches/ovn/0002-add-logging-parser.patch
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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" }}
Expand All @@ -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
Expand All @@ -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
Expand All @@ -98,16 +148,69 @@ 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:
ovn_controller: docker.io/openstackhelm/ovn:latest-ubuntu_focal
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
Expand All @@ -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:
Expand Down

0 comments on commit 1287fac

Please sign in to comment.