fix(role_binding): use namespace lookup to build role bindings

!8
This commit is contained in:
2024-02-05 13:37:10 +09:30
parent f08cba1dfb
commit efd6d15dc4
2 changed files with 3 additions and 3 deletions

View File

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

View File

@ -308,7 +308,7 @@ nfc_monitoring:
# Deploy a generate policy for kyverno to create Role and RoleBindings # Deploy a generate policy for kyverno to create Role and RoleBindings
# for the prometheus service account so it can monitor # for the prometheus service account so it can monitor
# new/existing namespaces # new/existing namespaces
kyverno_role_policy: true kyverno_role_policy: false
storage: storage:
volumeClaimTemplate: volumeClaimTemplate: