From 58becf2886282fee1122c8f9861081a25a6d845b Mon Sep 17 00:00:00 2001 From: root Date: Fri, 20 Aug 2021 16:51:18 +0200 Subject: [PATCH] Add libvirt exporter as a sidecar in the libvirt chart Users can enable the libvirt exporter sidecar by set values.sidecars.libvirt_exporter as true. Change-Id: I7451aa278982bced3178ac3e001eaad3b63d005d --- libvirt/Chart.yaml | 2 +- libvirt/templates/daemonset-libvirt.yaml | 24 ++++++++++++++++++++++++ libvirt/values.yaml | 17 +++++++++++++++++ releasenotes/notes/libvirt.yaml | 1 + 4 files changed, 43 insertions(+), 1 deletion(-) diff --git a/libvirt/Chart.yaml b/libvirt/Chart.yaml index f5355a9fe..462c56afb 100644 --- a/libvirt/Chart.yaml +++ b/libvirt/Chart.yaml @@ -15,7 +15,7 @@ apiVersion: v1 appVersion: v1.0.0 description: OpenStack-Helm libvirt name: libvirt -version: 0.1.11 +version: 0.1.12 home: https://libvirt.org sources: - https://libvirt.org/git/?p=libvirt.git;a=summary diff --git a/libvirt/templates/daemonset-libvirt.yaml b/libvirt/templates/daemonset-libvirt.yaml index 4853d0c2f..6836e0670 100644 --- a/libvirt/templates/daemonset-libvirt.yaml +++ b/libvirt/templates/daemonset-libvirt.yaml @@ -229,6 +229,30 @@ spec: {{- end }} {{- end }} {{ if $mounts_libvirt.volumeMounts }}{{ toYaml $mounts_libvirt.volumeMounts | indent 12 }}{{ end }} + {{- if .Values.pod.sidecars.libvirt_exporter }} + - 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 }} + ports: + - name: metrics + protocol: TCP + containerPort: {{ tuple "libvirt_exporter" "direct" "metrics" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} + livenessProbe: + httpGet: + path: / + port: metrics + readinessProbe: + httpGet: + path: / + port: metrics + volumeMounts: + - name: run + mountPath: /run + {{- if or ( gt .Capabilities.KubeVersion.Major "1" ) ( ge .Capabilities.KubeVersion.Minor "10" ) }} + mountPropagation: Bidirectional + {{- end }} + {{- end }} volumes: {{ dict "enabled" $ssl_enabled "secretName" $envAll.Values.secrets.tls.client "name" "ssl-client" "path" "/etc/pki/libvirt" "certs" (tuple "clientcert.pem" "clientkey.pem" ) | include "helm-toolkit.snippets.tls_volume" | indent 8 }} {{ dict "enabled" $ssl_enabled "secretName" $envAll.Values.secrets.tls.server "name" "ssl-server-cert" "path" "/etc/pki/libvirt" "certs" (tuple "servercert.pem" ) | include "helm-toolkit.snippets.tls_volume" | indent 8 }} diff --git a/libvirt/values.yaml b/libvirt/values.yaml index e0f1700d5..53ea05a0b 100644 --- a/libvirt/values.yaml +++ b/libvirt/values.yaml @@ -27,6 +27,7 @@ labels: images: tags: libvirt: docker.io/openstackhelm/libvirt:latest-ubuntu_focal + libvirt_exporter: vexxhost/libvirtd-exporter:latest ceph_config_helper: 'docker.io/openstackhelm/ceph-config-helper:ubuntu_bionic-20200217' dep_check: quay.io/airshipit/kubernetes-entrypoint:v1.0.0 image_repo_sync: docker.io/library/docker:17.07.0 @@ -57,6 +58,10 @@ endpoints: port: registry: node: 5000 + libvirt_exporter: + port: + metrics: + default: 9474 network_policy: libvirt: @@ -129,6 +134,11 @@ pod: libvirt: privileged: true readOnlyRootFilesystem: false + libvirt_exporter: + privileged: true + sidecars: + libvirt_exporter: false + affinity: anti: type: @@ -174,6 +184,13 @@ pod: limits: memory: "1024Mi" cpu: "2000m" + libvirt_exporter: + requests: + memory: "128Mi" + cpu: "100m" + limits: + memory: "256Mi" + cpu: "500m" dependencies: dynamic: diff --git a/releasenotes/notes/libvirt.yaml b/releasenotes/notes/libvirt.yaml index 7bcdd4a6a..cba980311 100644 --- a/releasenotes/notes/libvirt.yaml +++ b/releasenotes/notes/libvirt.yaml @@ -12,4 +12,5 @@ libvirt: - 0.1.9 Exec libvirt instead of forking from bash - 0.1.10 Enable taint toleration for Openstack services jobs - 0.1.11 Remove unused overrides and update default image + - 0.1.12 Add libvirt exporter as a sidecar ...