From 6b0a8cadfc4fcfb51f6f60937563f0128e7e12d7 Mon Sep 17 00:00:00 2001 From: Cyril Jouve Date: Tue, 2 May 2023 20:53:49 +0200 Subject: [PATCH] helm: servicemonitor for rook-ceph csi drivers the ServiceMonitor depends on: * monitoring.enabled (availability of prometheus-operator) * csi.serviceMonitor.enabled, to create the ServiceMonitor * csi.enableGrpcMetrics and csi.enableLiveness to enable their respective endpoints in the ServiceMonitor Signed-off-by: Cyril Jouve --- Documentation/Helm-Charts/operator-chart.md | 2 ++ .../rook-ceph/templates/servicemonitor.yaml | 26 +++++++++++++++++++ deploy/charts/rook-ceph/values.yaml | 6 +++++ 3 files changed, 34 insertions(+) create mode 100644 deploy/charts/rook-ceph/templates/servicemonitor.yaml diff --git a/Documentation/Helm-Charts/operator-chart.md b/Documentation/Helm-Charts/operator-chart.md index 3cb5b2429..7bc02b102 100644 --- a/Documentation/Helm-Charts/operator-chart.md +++ b/Documentation/Helm-Charts/operator-chart.md @@ -117,6 +117,8 @@ The following table lists the configurable parameters of the rook-operator chart | `csi.readAffinity.enabled` | Enable read affinity for RBD volumes. Recommended to set to true if running kernel 5.8 or newer. | `false` | | `csi.registrar.image` | Kubernetes CSI registrar image | `registry.k8s.io/sig-storage/csi-node-driver-registrar:v2.7.0` | | `csi.resizer.image` | Kubernetes CSI resizer image | `registry.k8s.io/sig-storage/csi-resizer:v1.7.0` | +| `csi.serviceMonitor.enabled` | Enable ServiceMonitor for Ceph CSI drivers | `false` | +| `csi.serviceMonitor.interval` | Service monitor scrape interval | `"5s"` | | `csi.sidecarLogLevel` | Set logging level for Kubernetes-csi sidecar containers. Supported values from 0 to 5. 0 for general useful logs (the default), 5 for trace level verbosity. | `0` | | `csi.snapshotter.image` | Kubernetes CSI snapshotter image | `registry.k8s.io/sig-storage/csi-snapshotter:v6.2.1` | | `csi.topology.domainLabels` | domainLabels define which node labels to use as domains for CSI nodeplugins to advertise their domains | `nil` | diff --git a/deploy/charts/rook-ceph/templates/servicemonitor.yaml b/deploy/charts/rook-ceph/templates/servicemonitor.yaml new file mode 100644 index 000000000..77d59f508 --- /dev/null +++ b/deploy/charts/rook-ceph/templates/servicemonitor.yaml @@ -0,0 +1,26 @@ +{{- if and .Values.monitoring.enabled .Values.csi.serviceMonitor.enabled (or .Values.csi.enableLiveness .Values.csi.enableGrpcMetrics) }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: csi-metrics + namespace: {{ .Release.Namespace }} + labels: {{- include "library.rook-ceph.labels" . | nindent 4 }} +spec: + namespaceSelector: + matchNames: + - {{ .Release.Namespace }} + selector: + matchLabels: + app: csi-metrics + endpoints: + {{- if .Values.csi.enableLiveness }} + - port: csi-http-metrics + path: /metrics + interval: {{ .Values.csi.serviceMonitor.interval }} + {{- end }} + {{- if .Values.csi.enableGrpcMetrics }} + - port: csi-grpc-metrics + path: /metrics + interval: {{ .Values.csi.serviceMonitor.interval }} + {{- end }} +{{- end }} diff --git a/deploy/charts/rook-ceph/values.yaml b/deploy/charts/rook-ceph/values.yaml index 1f07be835..7b71ffeaa 100644 --- a/deploy/charts/rook-ceph/values.yaml +++ b/deploy/charts/rook-ceph/values.yaml @@ -458,6 +458,12 @@ csi: # @default -- `8080` rbdLivenessMetricsPort: + serviceMonitor: + # -- Enable ServiceMonitor for Ceph CSI drivers + enabled: false + # -- Service monitor scrape interval + interval: 5s + # -- Kubelet root directory path (if the Kubelet uses a different path for the `--root-dir` flag) # @default -- `/var/lib/kubelet` kubeletDirPath: