Skip to content

Commit e0c8b64

Browse files
authored
fix: add cluster/finalizers update permission (#465)
Add the required missing permission to operate in k8s environments where the Admission Controller Plugin "OwnerReferencesPermissionEnforcement" is enabled. Signed-off-by: Gabriele Fedi <gabriele.fedi@enterprisedb.com>
1 parent 3a77079 commit e0c8b64

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ help: ## Display this help.
4545

4646
.PHONY: manifests
4747
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
48-
$(CONTROLLER_GEN) rbac:roleName=plugin-barman-cloud crd webhook paths="./api/..." output:crd:artifacts:config=config/crd/bases
48+
$(CONTROLLER_GEN) rbac:roleName=plugin-barman-cloud crd webhook paths="./api/..." paths="./internal/controller/..." output:crd:artifacts:config=config/crd/bases
4949

5050
.PHONY: generate
5151
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.

config/rbac/role.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ rules:
4848
- get
4949
- list
5050
- watch
51+
- apiGroups:
52+
- postgresql.cnpg.io
53+
resources:
54+
- clusters/finalizers
55+
verbs:
56+
- update
5157
- apiGroups:
5258
- rbac.authorization.k8s.io
5359
resources:

internal/controller/objectstore_controller.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ type ObjectStoreReconciler struct {
3737
// +kubebuilder:rbac:groups=rbac.authorization.k8s.io,resources=rolebindings,verbs=create;patch;update;get;list;watch
3838
// +kubebuilder:rbac:groups=rbac.authorization.k8s.io,resources=roles,verbs=create;patch;update;get;list;watch
3939
// +kubebuilder:rbac:groups="",resources=secrets,verbs=create;list;get;watch;delete
40+
// +kubebuilder:rbac:groups=postgresql.cnpg.io,resources=clusters/finalizers,verbs=update
4041
// +kubebuilder:rbac:groups=postgresql.cnpg.io,resources=backups,verbs=get;list;watch
4142
// +kubebuilder:rbac:groups=barmancloud.cnpg.io,resources=objectstores,verbs=get;list;watch;create;update;patch;delete
4243
// +kubebuilder:rbac:groups=barmancloud.cnpg.io,resources=objectstores/status,verbs=get;update;patch

manifest.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,12 @@ rules:
807807
- get
808808
- list
809809
- watch
810+
- apiGroups:
811+
- postgresql.cnpg.io
812+
resources:
813+
- clusters/finalizers
814+
verbs:
815+
- update
810816
- apiGroups:
811817
- rbac.authorization.k8s.io
812818
resources:

0 commit comments

Comments
 (0)