From d2e8cfcfec8a22aa3e8c8de27945cd967441d6d1 Mon Sep 17 00:00:00 2001 From: Roman Sysoev <36233932+hardcoretime@users.noreply.github.com> Date: Sat, 6 Jul 2024 16:21:44 +0300 Subject: [PATCH] feat(observability): add logLevel option to module config (#194) Sets a logLevel for this components: - virtualization-api - virtualization-controller - kube-api-proxy - vmi-router Signed-off-by: Roman Sysoev --- openapi/config-values.yaml | 15 +++++++++++++++ openapi/doc-ru-config-values.yaml | 10 ++++++++++ templates/_kube_api_rewriter.tpl | 4 ++-- templates/kubevirt/vmi-router/daemonset.yaml | 4 ++++ templates/virtualization-api/deployment.yaml | 4 ++++ templates/virtualization-controller/_helpers.tpl | 4 ++++ 6 files changed, 39 insertions(+), 2 deletions(-) diff --git a/openapi/config-values.yaml b/openapi/config-values.yaml index d0d0f49a4..f0b0aec7d 100644 --- a/openapi/config-values.yaml +++ b/openapi/config-values.yaml @@ -184,3 +184,18 @@ properties: properties: type: enum: ["ObjectStorage"] + logLevel: + type: string + description: | + Sets a logging level. + + Working for this components: + - `virtualization-api` + - `virtualization-controller` + - `kube-api-proxy` + - `vmi-router` + enum: + - "debug" + - "info" + - "warning" + - "error" diff --git a/openapi/doc-ru-config-values.yaml b/openapi/doc-ru-config-values.yaml index 5b3ccbe5e..ccad5f064 100644 --- a/openapi/doc-ru-config-values.yaml +++ b/openapi/doc-ru-config-values.yaml @@ -91,3 +91,13 @@ properties: bucket: description: | Контейнер, в котором вы можете хранить свои файлы и объекты данных. + logLevel: + type: string + description: | + Устанавливает уровень логирования. + + Работает для следующих компонентов: + - `virtualization-api` + - `virtualization-controller` + - `kube-api-proxy` + - `vmi-router` diff --git a/templates/_kube_api_rewriter.tpl b/templates/_kube_api_rewriter.tpl index 680ba665a..5502ebd91 100644 --- a/templates/_kube_api_rewriter.tpl +++ b/templates/_kube_api_rewriter.tpl @@ -1,6 +1,6 @@ {{- define "kube_api_rewriter.env" -}} - name: LOG_LEVEL - value: Debug + value: {{ .Values.virtualization.logLevel }} {{- end -}} {{- define "kubeproxy_resources" -}} @@ -31,7 +31,7 @@ spec: image: {{ $proxyImage }} imagePullPolicy: IfNotPresent env: - {{- include "kube_api_rewriter.env" . | nindent 8 }} + {{- include "kube_api_rewriter.env" $ctx | nindent 8 }} resources: requests: {{- include "helm_lib_module_ephemeral_storage_only_logs" . | nindent 12 }} diff --git a/templates/kubevirt/vmi-router/daemonset.yaml b/templates/kubevirt/vmi-router/daemonset.yaml index 23950c035..f28aaebed 100644 --- a/templates/kubevirt/vmi-router/daemonset.yaml +++ b/templates/kubevirt/vmi-router/daemonset.yaml @@ -65,6 +65,10 @@ spec: valueFrom: fieldRef: fieldPath: spec.nodeName + {{- if eq .Values.virtualization.logLevel "debug" }} + - name: VERBOSITY + value: "10" + {{- end }} resources: requests: {{- include "helm_lib_module_ephemeral_storage_only_logs" . | nindent 14 }} diff --git a/templates/virtualization-api/deployment.yaml b/templates/virtualization-api/deployment.yaml index 5d9a39840..d2aff333c 100644 --- a/templates/virtualization-api/deployment.yaml +++ b/templates/virtualization-api/deployment.yaml @@ -65,7 +65,11 @@ spec: - --kubevirt-cabundle=/etc/virt-api/certificates/ca.crt - --kubevirt-endpoint=virt-api.d8-{{ .Chart.Name}}.svc - --secure-port=8443 + {{- if eq .Values.virtualization.logLevel "debug" }} + - --v=10 + {{- else }} - --v=3 + {{- end }} - --tls-cert-file=/etc/virtualziation-api/certificates/tls.crt - --tls-private-key-file=/etc/virtualziation-api/certificates/tls.key - --proxy-client-cert-file=/etc/virtualziation-api-proxy/certificates/tls.crt diff --git a/templates/virtualization-controller/_helpers.tpl b/templates/virtualization-controller/_helpers.tpl index 529e96ec1..896f316b8 100644 --- a/templates/virtualization-controller/_helpers.tpl +++ b/templates/virtualization-controller/_helpers.tpl @@ -3,7 +3,11 @@ - name: KUBECONFIG value: "/kubeconfig.local/proxy.kubeconfig" - name: VERBOSITY + {{- if eq .Values.virtualization.logLevel "debug" }} + value: "10" + {{- else }} value: "3" + {{- end }} - name: FORCE_BRIDGE_NETWORK_BINDING value: "1" - name: DISABLE_HYPERV_SYNIC