diff --git a/config/rbac/role.yaml b/config/rbac/role.yaml index 1b82c6b0..1eef8334 100644 --- a/config/rbac/role.yaml +++ b/config/rbac/role.yaml @@ -182,6 +182,7 @@ rules: - events verbs: - create + - delete - get - list - patch diff --git a/pkg/templates/charts/toggle/cluster-lifecycle/templates/metrics-clusterrole.yaml b/pkg/templates/charts/toggle/cluster-lifecycle/templates/metrics-clusterrole.yaml index 78e7ebb6..af1b72ce 100644 --- a/pkg/templates/charts/toggle/cluster-lifecycle/templates/metrics-clusterrole.yaml +++ b/pkg/templates/charts/toggle/cluster-lifecycle/templates/metrics-clusterrole.yaml @@ -51,5 +51,15 @@ rules: - apiGroups: ["work.open-cluster-management.io"] resources: ["manifestworks"] verbs: ["get","list","watch"] +# Allow hub to patch manifestwroks annotation +- apiGroups: ["work.open-cluster-management.io"] + resources: ["manifestworks"] + verbs: ["patch"] +- apiGroups: ["coordination.k8s.io"] + resources: ["leases"] + verbs: ["get","create","update","patch","delete"] +- apiGroups: [""] + resources: ["events"] + verbs: ["get","create","update","patch","delete"] - nonResourceURLs: ["/metrics"] - verbs: ["get"] \ No newline at end of file + verbs: ["get"] diff --git a/pkg/templates/rbac_gen.go b/pkg/templates/rbac_gen.go index a3864e7d..b9c30fbe 100644 --- a/pkg/templates/rbac_gen.go +++ b/pkg/templates/rbac_gen.go @@ -42,6 +42,7 @@ package main //+kubebuilder:rbac:groups="",resources=events,verbs=create;patch //+kubebuilder:rbac:groups="",resources=events,verbs=create;patch //+kubebuilder:rbac:groups="",resources=events,verbs=create;patch +//+kubebuilder:rbac:groups="",resources=events,verbs=get;create;update;patch;delete //+kubebuilder:rbac:groups="",resources=namespaces,verbs=create;get;list;watch //+kubebuilder:rbac:groups="",resources=namespaces,verbs=delete //+kubebuilder:rbac:groups="",resources=namespaces,verbs=get @@ -298,6 +299,7 @@ package main //+kubebuilder:rbac:groups=coordination.k8s.io,resources=leases,verbs=get;create;update //+kubebuilder:rbac:groups=coordination.k8s.io,resources=leases,verbs=get;create;update //+kubebuilder:rbac:groups=coordination.k8s.io,resources=leases,verbs=get;create;update;patch +//+kubebuilder:rbac:groups=coordination.k8s.io,resources=leases,verbs=get;create;update;patch;delete //+kubebuilder:rbac:groups=coordination.k8s.io,resources=leases,verbs=get;list;watch;create;update;patch;delete //+kubebuilder:rbac:groups=coordination.k8s.io,resources=leases,verbs=get;list;watch;create;update;patch;delete //+kubebuilder:rbac:groups=coordination.k8s.io,resources=leases,verbs=get;list;watch;create;update;patch;delete @@ -455,5 +457,6 @@ package main //+kubebuilder:rbac:groups=work.open-cluster-management.io,resources=manifestworks,verbs=get;list;watch;create;update;delete;deletecollection;patch;execute-as //+kubebuilder:rbac:groups=work.open-cluster-management.io,resources=manifestworks,verbs=get;list;watch;create;update;patch;delete //+kubebuilder:rbac:groups=work.open-cluster-management.io,resources=manifestworks,verbs=get;list;watch;update +//+kubebuilder:rbac:groups=work.open-cluster-management.io,resources=manifestworks,verbs=patch //+kubebuilder:rbac:groups=work.open-cluster-management.io,resources=manifestworks/status;manifestworkreplicasets/status,verbs=update;patch //+kubebuilder:rbac:groups=work.open-cluster-management.io,resources=manifestworks;manifestworks/finalizers,verbs=create;delete;get;list;patch;update;watch