charts/libvirt: add Prometheus libvirt exporter support

- Introduce ghcr.io/inovex/prometheus-libvirt-exporter image for libvirt metrics
- Compatible with Kolla-Ansible deployments for consistent monitoring

Change-Id: I6516693c989bfaac4d67d86e6b0b6144335eb2b7
Signed-off-by: Saeed Padari <sam137115@gmail.com>
This commit is contained in:
Saeed Padari
2025-08-14 01:19:10 +03:30
parent 72a656e3f4
commit 53a2ee99a0
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
{{- 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
{{ 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 }}
{{ 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:
- "--libvirt.nova"
{{- range .args }}
- {{ . | quote }}
{{- end }}
{{- end }}
{{- end }}
ports:
- name: metrics
protocol: TCP
@@ -310,10 +316,12 @@ spec:
httpGet:
path: /
port: metrics
timeoutSeconds: 5
readinessProbe:
httpGet:
path: /
port: metrics
timeoutSeconds: 5
volumeMounts:
- name: 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:
- ALL
sidecars:
libvirt_exporter: false
libvirt_exporter:
enabled: false
args:
- "--libvirt.nova"
affinity:
anti:
@@ -403,6 +406,7 @@ manifests:
network_policy: false
role_cert_manager: false
secret_registry: true
podmonitor: false
secrets:
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
...