From da56582a0ca5f2fb5e4ddf3b9b1931d6810f9aaf Mon Sep 17 00:00:00 2001 From: caoxianfei1 <18251716983@163.com> Date: Fri, 9 Jun 2023 11:37:23 +0800 Subject: [PATCH] add rbac for curve role can visit batch cronjob --- config/deploy/manifests.yaml | 12 ++++++++++++ config/rbac/role.yaml | 12 ++++++++++++ pkg/controllers/curvecluster_controller.go | 1 + pkg/controllers/curvefs_controller.go | 1 + 4 files changed, 26 insertions(+) diff --git a/config/deploy/manifests.yaml b/config/deploy/manifests.yaml index b60b0cfc..58c0793d 100644 --- a/config/deploy/manifests.yaml +++ b/config/deploy/manifests.yaml @@ -570,6 +570,18 @@ rules: - patch - update - watch +- apiGroups: + - batch + resources: + - cronjobs + verbs: + - create + - delete + - get + - list + - patch + - update + - watch - apiGroups: - batch resources: diff --git a/config/rbac/role.yaml b/config/rbac/role.yaml index 2c964968..159a19dd 100644 --- a/config/rbac/role.yaml +++ b/config/rbac/role.yaml @@ -18,6 +18,18 @@ rules: - patch - update - watch +- apiGroups: + - batch + resources: + - cronjobs + verbs: + - create + - delete + - get + - list + - patch + - update + - watch - apiGroups: - batch resources: diff --git a/pkg/controllers/curvecluster_controller.go b/pkg/controllers/curvecluster_controller.go index 9f636dd3..1e46a443 100644 --- a/pkg/controllers/curvecluster_controller.go +++ b/pkg/controllers/curvecluster_controller.go @@ -80,6 +80,7 @@ func NewCurveClusterReconciler( // +kubebuilder:rbac:groups=core,resources=events,verbs=get;list;watch;create;update;patch // +kubebuilder:rbac:groups=apps,resources=deployments,verbs=get;list;watch;create;update;patch;delete // +kubebuilder:rbac:groups=batch,resources=jobs,verbs=get;list;watch;create;update;patch;delete +// +kubebuilder:rbac:groups=batch,resources=cronjobs,verbs=get;list;watch;create;update;patch;delete func (r *CurveClusterReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) { ctx := context.Background() diff --git a/pkg/controllers/curvefs_controller.go b/pkg/controllers/curvefs_controller.go index 10b7495c..cd83aa83 100644 --- a/pkg/controllers/curvefs_controller.go +++ b/pkg/controllers/curvefs_controller.go @@ -72,6 +72,7 @@ func NewCurvefsReconciler( // +kubebuilder:rbac:groups=core,resources=events,verbs=get;list;watch;create;update;patch // +kubebuilder:rbac:groups=apps,resources=deployments,verbs=get;list;watch;create;update;patch;delete // +kubebuilder:rbac:groups=batch,resources=jobs,verbs=get;list;watch;create;update;patch;delete +// +kubebuilder:rbac:groups=batch,resources=cronjobs,verbs=get;list;watch;create;update;patch;delete func (r *CurvefsReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) { ctx := context.Background()