From c6179f0196ae7fd022d8b7edb562daedeb8f320b Mon Sep 17 00:00:00 2001 From: Travis Nielsen Date: Mon, 16 May 2022 14:28:29 -0600 Subject: [PATCH 1/2] helm: only copy relevant monitoring settings The cephcluster CR monitoring schema should be honored. The helm chart was creating extra values that didn't match the schema by copying the values such as createPrometheusRules that are only used for template evaluation. Now only the monitoring values from the schema will be added to the template. Signed-off-by: Travis Nielsen (cherry picked from commit 36f59bd527a24e649c6dbfed379ff6374e9b2ef9) --- .../charts/rook-ceph-cluster/templates/cephcluster.yaml | 9 ++++++++- deploy/charts/rook-ceph-cluster/values.yaml | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/deploy/charts/rook-ceph-cluster/templates/cephcluster.yaml b/deploy/charts/rook-ceph-cluster/templates/cephcluster.yaml index 74c352026..57babea97 100644 --- a/deploy/charts/rook-ceph-cluster/templates/cephcluster.yaml +++ b/deploy/charts/rook-ceph-cluster/templates/cephcluster.yaml @@ -5,6 +5,13 @@ metadata: name: {{ default .Release.Namespace .Values.clusterName }} spec: monitoring: -{{ toYaml .Values.monitoring | indent 4 }} + enabled: {{ .Values.monitoring.enabled | default false }} +{{- if .Values.monitoring.externalMgrEndpoints }} + externalMgrEndpoints: +{{ toYaml .Values.monitoring.externalMgrEndpoints | indent 6 }} +{{- end }} +{{- if .Values.monitoring.externalMgrPrometheusPort }} + externalMgrPrometheusPort: {{ toYaml .Values.monitoring.externalMgrPrometheusPort }} +{{- end }} {{ toYaml .Values.cephClusterSpec | indent 2 }} diff --git a/deploy/charts/rook-ceph-cluster/values.yaml b/deploy/charts/rook-ceph-cluster/values.yaml index 287031407..378257509 100644 --- a/deploy/charts/rook-ceph-cluster/values.yaml +++ b/deploy/charts/rook-ceph-cluster/values.yaml @@ -44,6 +44,9 @@ monitoring: # If you have multiple rook-ceph clusters in the same k8s cluster, choose the same namespace (ideally, namespace with prometheus # deployed) to set rulesNamespace for all the clusters. Otherwise, you will get duplicate alerts with multiple alert definitions. rulesNamespaceOverride: + # Monitoring settings for external clusters: + # externalMgrEndpoints: + # externalMgrPrometheusPort: # If true, create & use PSP resources. Set this to the same value as the rook-ceph chart. pspEnable: true From 46e442917d66f7ab228c575783f8a1ea46849ecf Mon Sep 17 00:00:00 2001 From: Travis Nielsen Date: Tue, 17 May 2022 15:28:04 -0600 Subject: [PATCH 2/2] helm: only add monitoring to cluster if specified If the monitoring settings are not specified in the values.yaml, avoid a helm chart install error by skipping the monitoring section of the cephcluster CR altogether. Signed-off-by: Travis Nielsen (cherry picked from commit a3d65b3f93400d8c585565dcee040615c4f752a6) --- deploy/charts/rook-ceph-cluster/templates/cephcluster.yaml | 2 ++ deploy/charts/rook-ceph-cluster/templates/prometheusrules.yaml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/deploy/charts/rook-ceph-cluster/templates/cephcluster.yaml b/deploy/charts/rook-ceph-cluster/templates/cephcluster.yaml index 57babea97..3ff4b6525 100644 --- a/deploy/charts/rook-ceph-cluster/templates/cephcluster.yaml +++ b/deploy/charts/rook-ceph-cluster/templates/cephcluster.yaml @@ -4,6 +4,7 @@ kind: CephCluster metadata: name: {{ default .Release.Namespace .Values.clusterName }} spec: +{{- if .Values.monitoring }} monitoring: enabled: {{ .Values.monitoring.enabled | default false }} {{- if .Values.monitoring.externalMgrEndpoints }} @@ -13,5 +14,6 @@ spec: {{- if .Values.monitoring.externalMgrPrometheusPort }} externalMgrPrometheusPort: {{ toYaml .Values.monitoring.externalMgrPrometheusPort }} {{- end }} +{{- end }} {{ toYaml .Values.cephClusterSpec | indent 2 }} diff --git a/deploy/charts/rook-ceph-cluster/templates/prometheusrules.yaml b/deploy/charts/rook-ceph-cluster/templates/prometheusrules.yaml index 52de90ae4..09768359b 100644 --- a/deploy/charts/rook-ceph-cluster/templates/prometheusrules.yaml +++ b/deploy/charts/rook-ceph-cluster/templates/prometheusrules.yaml @@ -1,3 +1,4 @@ +{{- if .Values.monitoring }} {{- if .Values.monitoring.createPrometheusRules }} --- apiVersion: monitoring.coreos.com/v1 @@ -29,3 +30,4 @@ spec: {{- end }} {{- end }} {{- end }} +{{- end }}