From 67b13388a7c2c6c46463591e2ab2d2538b2fb29c Mon Sep 17 00:00:00 2001 From: Michel Hollands Date: Thu, 6 Jul 2023 11:58:00 +0100 Subject: [PATCH 1/3] Add validation.yaml Signed-off-by: Michel Hollands --- charts/meta-monitoring/Chart.yaml | 5 +---- .../meta-monitoring/templates/validate.yaml | 21 +++++++++++++++++++ charts/meta-monitoring/values.yaml | 12 ++++------- 3 files changed, 26 insertions(+), 12 deletions(-) create mode 100644 charts/meta-monitoring/templates/validate.yaml diff --git a/charts/meta-monitoring/Chart.yaml b/charts/meta-monitoring/Chart.yaml index 0161152..bf3052c 100644 --- a/charts/meta-monitoring/Chart.yaml +++ b/charts/meta-monitoring/Chart.yaml @@ -42,7 +42,4 @@ dependencies: - name: minio repository: https://charts.min.io version: "5.0.11" - tags: - - local-logs - - local-metrics - - local-traces \ No newline at end of file + condition: local.minio.enabled \ No newline at end of file diff --git a/charts/meta-monitoring/templates/validate.yaml b/charts/meta-monitoring/templates/validate.yaml new file mode 100644 index 0000000..3711ee9 --- /dev/null +++ b/charts/meta-monitoring/templates/validate.yaml @@ -0,0 +1,21 @@ +{{- if not (eq .Values.local.minio.enabled (or .Values.local.traces.enabled (or .Values.local.logs.enabled .Values.local.metrics.enabled))) -}} + {{- fail "minio.enabled should be set to true if any of the the local databases is enabled " -}} +{{- end -}} + +{{- if eq .Values.cloud.logs.enabled true -}} + {{- if or (empty .Values.cloud.logs.endpoint) (or (empty .Values.cloud.logs.username) (empty .Values.cloud.logs.password)) -}} + {{- fail "if cloud.logs is enabled then the endpoint, username and password have to be filled in" -}} + {{- end -}} +{{- end -}} + +{{- if eq .Values.cloud.metrics.enabled true -}} + {{- if or (empty .Values.cloud.metrics.endpoint) (or (empty .Values.cloud.metrics.username) (empty .Values.cloud.metrics.password)) -}} + {{- fail "if cloud.metrics is enabled then the endpoint, username and password have to be filled in" -}} + {{- end -}} +{{- end -}} + +{{- if eq .Values.cloud.traces.enabled true -}} + {{- if or (empty .Values.cloud.traces.endpoint) (or (empty .Values.cloud.traces.username) (empty .Values.cloud.traces.password)) -}} + {{- fail "if cloud.traces is enabled then the endpoint, username and password have to be filled in" -}} + {{- end -}} +{{- end -}} diff --git a/charts/meta-monitoring/values.yaml b/charts/meta-monitoring/values.yaml index ac7ba5a..0eea3df 100644 --- a/charts/meta-monitoring/values.yaml +++ b/charts/meta-monitoring/values.yaml @@ -2,15 +2,8 @@ namespacesToMonitor: - loki - mimir - tempo -clusterName: "observability" # TODO check if this can be derived +clusterName: "meta-monitoring" # TODO check if this can be derived -# Turn on or off for local storing of metrics, logs or traces -tags: - local-logs: true - local-metrics: true - local-traces: true - -# Unfortunately this is duplicate as Helm's tags and conditions fro dependencies are limited local: logs: enabled: false @@ -18,6 +11,9 @@ local: enabled: false traces: enabled: false + minio: + enabled: false # This should be set to true if any of the previous is enabled + cloud: logs: From 116586e383749eed2cb635b16ed929b1b9864d6e Mon Sep 17 00:00:00 2001 From: Michel Hollands Date: Thu, 6 Jul 2023 14:08:15 +0100 Subject: [PATCH 2/3] Add check to if anything is enabled Signed-off-by: Michel Hollands --- charts/meta-monitoring/templates/validate.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/charts/meta-monitoring/templates/validate.yaml b/charts/meta-monitoring/templates/validate.yaml index 3711ee9..7b2b9a8 100644 --- a/charts/meta-monitoring/templates/validate.yaml +++ b/charts/meta-monitoring/templates/validate.yaml @@ -19,3 +19,17 @@ {{- fail "if cloud.traces is enabled then the endpoint, username and password have to be filled in" -}} {{- end -}} {{- end -}} + +{{- if eq .Values.cloud.traces.enabled false -}} +{{- if eq .Values.cloud.metrics.enabled false -}} +{{- if eq .Values.cloud.logs.enabled false -}} +{{- if eq .Values.local.traces.enabled false -}} +{{- if eq .Values.local.metrics.enabled false -}} +{{- if eq .Values.local.logs.enabled false -}} + {{- fail "nothing has been enabled" -}} +{{- end -}} +{{- end -}} +{{- end -}} +{{- end -}} +{{- end -}} +{{- end -}} From a14b07239b16bd79812a15ab47e971721314c9e5 Mon Sep 17 00:00:00 2001 From: Michel Hollands Date: Thu, 6 Jul 2023 14:11:08 +0100 Subject: [PATCH 3/3] Add check for empty list of namespaces to monitor Signed-off-by: Michel Hollands --- charts/meta-monitoring/templates/validate.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/charts/meta-monitoring/templates/validate.yaml b/charts/meta-monitoring/templates/validate.yaml index 7b2b9a8..767d6ed 100644 --- a/charts/meta-monitoring/templates/validate.yaml +++ b/charts/meta-monitoring/templates/validate.yaml @@ -33,3 +33,7 @@ {{- end -}} {{- end -}} {{- end -}} + +{{- if empty .Values.namespacesToMonitor -}} + {{- fail "No namespaces have been specified in namespacesToMonitor" -}} +{{- end -}}