From 187d141a2d581012a39e4ac258d35ecab8683545 Mon Sep 17 00:00:00 2001 From: Mohammad Yosefpor Date: Mon, 28 Feb 2022 01:48:49 +0330 Subject: [PATCH] fix: add rbac --- config/rbac/role.yaml | 45 +++++++++++++++++++++++++++++ controllers/namespace_controller.go | 2 ++ 2 files changed, 47 insertions(+) create mode 100644 config/rbac/role.yaml diff --git a/config/rbac/role.yaml b/config/rbac/role.yaml new file mode 100644 index 0000000..8c3e2f3 --- /dev/null +++ b/config/rbac/role.yaml @@ -0,0 +1,45 @@ +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + creationTimestamp: null + name: manager-role +rules: +- apiGroups: + - "" + resources: + - namespaces + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - "" + resources: + - namespaces/finalizers + verbs: + - update +- apiGroups: + - "" + resources: + - namespaces/status + verbs: + - get + - patch + - update +- apiGroups: + - integreatly.org + resources: + - grafanadatasources + verbs: + - create + - delete + - get + - list + - patch + - update + - watch diff --git a/controllers/namespace_controller.go b/controllers/namespace_controller.go index ad4d187..755c959 100644 --- a/controllers/namespace_controller.go +++ b/controllers/namespace_controller.go @@ -46,6 +46,8 @@ type NamespaceReconciler struct { //+kubebuilder:rbac:groups=core,resources=namespaces/status,verbs=get;update;patch //+kubebuilder:rbac:groups=core,resources=namespaces/finalizers,verbs=update +//+kubebuilder:rbac:groups=integreatly.org,resources=grafanadatasources,verbs=get;list;watch;create;update;patch;delete + // Reconcile is part of the main kubernetes reconciliation loop which aims to // move the current state of the cluster closer to the desired state. // TODO(user): Modify the Reconcile function to compare the state specified by