Merge "charts/libvirt: add Prometheus libvirt exporter support"

This commit is contained in:
Zuul
2025-09-02 21:41:13 +00:00
committed by Gerrit Code Review
5 changed files with 53 additions and 3 deletions

View File

@@ -0,0 +1,7 @@
---
features:
- |
Make exporter container args configurable in values to make it possible to use
ghcr.io/inovex/prometheus-libvirt-exporter image which assumes
having no additional args.
...

View File

@@ -295,13 +295,19 @@ spec:
readOnly: true readOnly: true
{{- end }} {{- end }}
{{ if $mounts_libvirt.volumeMounts }}{{ toYaml $mounts_libvirt.volumeMounts | indent 12 }}{{ end }} {{ if $mounts_libvirt.volumeMounts }}{{ toYaml $mounts_libvirt.volumeMounts | indent 12 }}{{ end }}
{{- if .Values.pod.sidecars.libvirt_exporter }} {{- if .Values.pod.sidecars.libvirt_exporter.enabled }}
- name: libvirt-exporter - name: libvirt-exporter
{{ tuple $envAll "libvirt_exporter" | include "helm-toolkit.snippets.image" | indent 10 }} {{ tuple $envAll "libvirt_exporter" | include "helm-toolkit.snippets.image" | indent 10 }}
{{ tuple $envAll $envAll.Values.pod.resources.libvirt_exporter | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} {{ tuple $envAll $envAll.Values.pod.resources.libvirt_exporter | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
{{ dict "envAll" $envAll "application" "libvirt" "container" "libvirt_exporter" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }} {{ dict "envAll" $envAll "application" "libvirt" "container" "libvirt_exporter" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
{{- with .Values.pod.sidecars.libvirt_exporter }}
{{- if and (hasKey . "args") (gt (len .args) 0) }}
args: args:
- "--libvirt.nova" {{- range .args }}
- {{ . | quote }}
{{- end }}
{{- end }}
{{- end }}
ports: ports:
- name: metrics - name: metrics
protocol: TCP protocol: TCP
@@ -310,10 +316,12 @@ spec:
httpGet: httpGet:
path: / path: /
port: metrics port: metrics
timeoutSeconds: 5
readinessProbe: readinessProbe:
httpGet: httpGet:
path: / path: /
port: metrics port: metrics
timeoutSeconds: 5
volumeMounts: volumeMounts:
- name: run - name: run
mountPath: /run mountPath: /run

View File

@@ -0,0 +1,18 @@
{{- if .Values.manifests.podmonitor -}}
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: libvirt-exporter
spec:
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
podMetricsEndpoints:
- interval: 10s
path: /metrics
port: metrics
scheme: http
selector:
matchLabels:
app.kubernetes.io/name: libvirt-exporter
{{- end -}}

View File

@@ -291,7 +291,10 @@ pod:
drop: drop:
- ALL - ALL
sidecars: sidecars:
libvirt_exporter: false libvirt_exporter:
enabled: false
args:
- "--libvirt.nova"
affinity: affinity:
anti: anti:
@@ -403,6 +406,7 @@ manifests:
network_policy: false network_policy: false
role_cert_manager: false role_cert_manager: false
secret_registry: true secret_registry: true
podmonitor: false
secrets: secrets:
oci_image_registry: oci_image_registry:

View File

@@ -0,0 +1,13 @@
---
# NOTE: Use the inovex exporter image by default since 2026.1 release.
images:
tags:
libvirt_exporter: ghcr.io/inovex/prometheus-libvirt-exporter:2.2.0
pod:
sidecars:
libvirt_exporter:
enabled: true
args: []
manifests:
podmonitor: true
...