From a94f702580d6cab7886104a20f3a1023c3e10677 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20de=20Saint=20Martin?= Date: Tue, 29 Aug 2023 18:27:14 +0200 Subject: [PATCH] cinder-csi-plugin Helm Chart: add metrics and Prometheus Operator support. --- charts/cinder-csi-plugin/Chart.yaml | 2 +- .../controllerplugin-deployment.yaml | 8 ++++++ .../controllerplugin-podmonitor.yaml | 25 +++++++++++++++++++ charts/cinder-csi-plugin/values.yaml | 9 +++++++ 4 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 charts/cinder-csi-plugin/templates/controllerplugin-podmonitor.yaml diff --git a/charts/cinder-csi-plugin/Chart.yaml b/charts/cinder-csi-plugin/Chart.yaml index f82136011c..6392eeacb9 100644 --- a/charts/cinder-csi-plugin/Chart.yaml +++ b/charts/cinder-csi-plugin/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v1 appVersion: v1.28.0 description: Cinder CSI Chart for OpenStack name: openstack-cinder-csi -version: 2.29.0-alpha.0 +version: 2.29.0-alpha.1 home: https://github.com/kubernetes/cloud-provider-openstack icon: https://github.com/kubernetes/kubernetes/blob/master/logo/logo.png maintainers: diff --git a/charts/cinder-csi-plugin/templates/controllerplugin-deployment.yaml b/charts/cinder-csi-plugin/templates/controllerplugin-deployment.yaml index 78422ee045..ed18ee5e44 100644 --- a/charts/cinder-csi-plugin/templates/controllerplugin-deployment.yaml +++ b/charts/cinder-csi-plugin/templates/controllerplugin-deployment.yaml @@ -158,6 +158,9 @@ spec: - "--endpoint=$(CSI_ENDPOINT)" - "--cloud-config=$(CLOUD_CONFIG)" - "--cluster=$(CLUSTER_NAME)" + {{- if .Values.csi.plugin.httpServer.enabled }} + - "--http-endpoint=:{{ .Values.csi.plugin.httpServer.port }}" + {{- end }} {{- if .Values.csi.plugin.extraArgs }} {{- with .Values.csi.plugin.extraArgs }} {{- tpl . $ | trim | nindent 12 }} @@ -174,6 +177,11 @@ spec: - containerPort: 9808 name: healthz protocol: TCP + {{- if .Values.csi.plugin.httpServer.enabled }} + - containerPort: {{ .Values.csi.plugin.httpServer.port }} + name: http + protocol: TCP + {{- end }} # The probe livenessProbe: failureThreshold: {{ .Values.csi.livenessprobe.failureThreshold }} diff --git a/charts/cinder-csi-plugin/templates/controllerplugin-podmonitor.yaml b/charts/cinder-csi-plugin/templates/controllerplugin-podmonitor.yaml new file mode 100644 index 0000000000..48e3b9d8a3 --- /dev/null +++ b/charts/cinder-csi-plugin/templates/controllerplugin-podmonitor.yaml @@ -0,0 +1,25 @@ +{{- if .Values.csi.plugin.podMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: PodMonitor +metadata: + labels: + {{- include "cinder-csi.controllerplugin.labels" . | nindent 4 }} + name: {{ include "cinder-csi.name" . }}-controllerplugin + namespace: {{ .Release.Namespace }} + annotations: + {{- with .Values.commonAnnotations }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + endpoints: + - bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token + interval: 30s + port: http + scheme: https + tlsConfig: + insecureSkipVerify: true + jobLabel: component + selector: + matchLabels: + {{- include "cinder-csi.controllerplugin.matchLabels" . | nindent 6 }} +{{- end }} diff --git a/charts/cinder-csi-plugin/values.yaml b/charts/cinder-csi-plugin/values.yaml index d2ba86ae8b..152d41c9df 100644 --- a/charts/cinder-csi-plugin/values.yaml +++ b/charts/cinder-csi-plugin/values.yaml @@ -5,6 +5,7 @@ fullnameOverride: "" timeout: 3m csi: + attacher: image: repository: registry.k8s.io/sig-storage/csi-attacher @@ -111,6 +112,14 @@ csi: nodeSelector: {} tolerations: [] resources: {} + # Enable http-server + httpServer: + enabled: false + port: 8080 + # Create Prometheus Operator PodMonitor. Requires http-server + # See https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#monitoring.coreos.com/v1.PodMonitor + podMonitor: + enabled: false extraArgs: {} # Log verbosity level.