Skip to content

Commit

Permalink
Merge pull request #3 from grafana/add_validation
Browse files Browse the repository at this point in the history
Add validation.yaml
  • Loading branch information
MichelHollands authored Jul 7, 2023
2 parents 39a1874 + a14b072 commit a1cd5d3
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 12 deletions.
5 changes: 1 addition & 4 deletions charts/meta-monitoring/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,4 @@ dependencies:
- name: minio
repository: https://charts.min.io
version: "5.0.11"
tags:
- local-logs
- local-metrics
- local-traces
condition: local.minio.enabled
39 changes: 39 additions & 0 deletions charts/meta-monitoring/templates/validate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{{- 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 -}}

{{- 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 -}}

{{- if empty .Values.namespacesToMonitor -}}
{{- fail "No namespaces have been specified in namespacesToMonitor" -}}
{{- end -}}
12 changes: 4 additions & 8 deletions charts/meta-monitoring/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,18 @@ 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
metrics:
enabled: false
traces:
enabled: false
minio:
enabled: false # This should be set to true if any of the previous is enabled


cloud:
logs:
Expand Down

0 comments on commit a1cd5d3

Please sign in to comment.