Skip to content

fix: clusteraccess lib deletes and recreates (Cluster)RoleBinding resources if roleRef changed#245

Merged
Diaphteiros merged 1 commit into
mainfrom
role-ref
Jun 15, 2026
Merged

fix: clusteraccess lib deletes and recreates (Cluster)RoleBinding resources if roleRef changed#245
Diaphteiros merged 1 commit into
mainfrom
role-ref

Conversation

@Diaphteiros

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:
The clusteraccess library has functions for creating and updating RoleBinding and ClusterRoleBinding resources. These did not consider the fact that the roleRef field of these resources is immutable, leading to a persistent error if the caller of the functions changes the role ref of an existing (Cluster)RoleBinding. This PR fixes that.

Which issue(s) this PR fixes:
Basically the fix for openmcp-project/cluster-provider-gardener#234.

Special notes for your reviewer:

Release note:

The `clusteraccess` library's `EnsureRoleBinding` and `EnsureClusterRoleBinding` functions now take into account that the `roleRef` field of a `RoleBinding`/`ClusterRoleBinding` is immutable. If a call would update this field on an existing resource, the resource is deleted and recreated instead. If the deletion does not immediately succeed (e.g. due to finalizers), the function returns an `WaitingForRecreationError`, indicating that it needs to be called again to finish updating the resource to the desired state.

…s if roleRef changed

Signed-off-by: Johannes Aubart <johannes.aubart@sap.com>
@Diaphteiros Diaphteiros merged commit 8d7175d into main Jun 15, 2026
7 checks passed
@Diaphteiros Diaphteiros deleted the role-ref branch June 15, 2026 06:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants