From 9358c86eb522a8e257f6cbe16e315ac7a4bbbbc6 Mon Sep 17 00:00:00 2001 From: Stephen Kitt Date: Thu, 16 Dec 2021 09:38:37 +0100 Subject: [PATCH] Add roles and privileges required for monitoring This replicates the RBAC changes applied to the operator in https://github.com/submariner-io/submariner-operator/pull/1416 Fixes: #191 Signed-off-by: Stephen Kitt --- submariner-operator/templates/rbac.yaml | 38 +++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/submariner-operator/templates/rbac.yaml b/submariner-operator/templates/rbac.yaml index bdf0933..2af3578 100644 --- a/submariner-operator/templates/rbac.yaml +++ b/submariner-operator/templates/rbac.yaml @@ -439,6 +439,21 @@ rules: verbs: - get - list + - apiGroups: + - "" + resources: + - namespaces + verbs: + - get + - list + - watch + - apiGroups: + - monitoring.coreos.com + resources: + - servicemonitors + verbs: + - get + - create --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding @@ -459,6 +474,29 @@ roleRef: name: {{ template "submariner.fullname" . }} --- apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: submariner-metrics-reader + namespace: {{ .Release.Namespace }} +rules: + - apiGroups: [""] + resources: ["pods", "services", "endpoints"] + verbs: ["get", "list", "watch"] +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: read-submariner-metrics +subjects: + - kind: ServiceAccount + name: prometheus-k8s + namespace: openshift-monitoring +roleRef: + kind: Role + name: submariner-metrics-reader + apiGroup: rbac.authorization.k8s.io +--- +apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: {{ template "submariner.fullname" . }}:gateway