feat(role): dynamically add roles to all available namesapces

!8
This commit is contained in:
2024-02-05 10:38:28 +09:30
parent 6a20b69910
commit 36ee3a10ff
2 changed files with 2 additions and 20 deletions

View File

@ -2,7 +2,7 @@
apiVersion: rbac.authorization.k8s.io/v1
items:
{{ range .Values.nfc_monitoring.prometheus.monitor_namespaces }}
{{ range $index, $namespace := (lookup "v1" "Namespace" "" "").items }}
- apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
@ -13,7 +13,7 @@ items:
app.kubernetes.io/managed-by: {{ $.Release.Service }}
app.kubernetes.io/version: {{ $.Chart.Version }}
name: prometheus-{{ $.Release.Name }}
namespace: {{ . | quote }}
namespace: {{ $namespace.metadata.name | quote }}
rules:
- apiGroups:
- ""

View File

@ -304,24 +304,6 @@ nfc_monitoring:
topologyKey: kubernetes.io/hostname
weight: 10
# List of namespaces that prometheus is to monitor
# used to create Roles and RoleBindings
# type: list
monitor_namespaces:
- alerting
- default
- calico-system
# - ceph
#- grafana
- monitoring
# - kube-dashboard
# - kube-metrics
- kube-policy
- kube-system
- logging
# - mariadb
# - olm
# - operators
# Deploy a generate policy for kyverno to create Role and RoleBindings
# for the prometheus service account so it can monitor