Skip to content

Commit

Permalink
feat(base-cluster/monitoring): monitor all namespaces by default (#545)
Browse files Browse the repository at this point in the history
  • Loading branch information
cwrau authored Nov 22, 2023
1 parent f195a84 commit fd8168b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,17 @@ prometheusSpec:
probeSelector:
matchLabels: {{- .Values.monitoring.labels | toYaml | nindent 6 }}
additionalAlertRelabelConfigs:
{{- if not .Values.monitoring.monitorAllNamespaces }}
{{- $namespaces := list .Release.Namespace "kube-node-lease" "kube-public" "kube-system" -}}
{{- range $name := include "base-cluster.enabled-namespaces" . | fromYaml | keys -}}
{{- $namespaces = append $namespaces $name -}}
{{- end }}
- # TODO: Needs alternative
source_labels:
- namespace
action: keep
regex: (cert-manager|flux-system|ingress-nginx|kube-node-lease|kube-public|kube-system|kyverno|monitoring)
regex: {{ printf "(%s)" ($namespaces | sortAlpha | uniq | join "|") }}
{{- end }}
- source_labels:
- __address__
target_label: clustertype
Expand Down
5 changes: 4 additions & 1 deletion charts/base-cluster/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@
},
"namespaces": {
"type": "object",
"description": "Namespaces to create. AND *delete* if removed",
"description": "Namespaces to create. AND *delete* if removed. These will also be the only ones, including the builtin namespaces, for which alerts will be sent if `monitoring.monitorAllNamespaces=false`",
"additionalProperties": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -310,6 +310,9 @@
"monitoring": {
"type": "object",
"properties": {
"monitorAllNamespaces": {
"type": "boolean"
},
"labels": {
"type": "object",
"description": "The labels to set on ServiceMonitors, ... and which the prometheus uses to search for",
Expand Down
1 change: 1 addition & 0 deletions charts/base-cluster/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ kyverno:
validationFailureAction: audit

monitoring:
monitorAllNamespaces: true
labels:
managed.by/monitoring: teutonet
grafana:
Expand Down

0 comments on commit fd8168b

Please sign in to comment.