Skip to content

Fix RoleBinding ownership conflict for multi-function namespaces#107

Merged
creydr merged 1 commit intofunctions-dev:mainfrom
creydr:fix/rolebinding-ownership-conflict
Apr 29, 2026
Merged

Fix RoleBinding ownership conflict for multi-function namespaces#107
creydr merged 1 commit intofunctions-dev:mainfrom
creydr:fix/rolebinding-ownership-conflict

Conversation

@creydr
Copy link
Copy Markdown
Collaborator

@creydr creydr commented Apr 29, 2026

Summary

  • The shared deploy-function-default RoleBinding previously set a single Function as the controller owner (Controller: true), overwriting any prior owner reference. Deleting that Function would garbage-collect the RoleBinding, breaking deployments for other Functions in the same namespace.
  • Use controllerutil.SetOwnerReference to append each Function as a non-controller owner, so the RoleBinding is only cleaned up when all Functions in the namespace are deleted.
  • Extract the RoleBinding name into a deployFunctionRoleBindingName constant.
  • Add unit tests verifying that multiple Functions get separate owner references without overwriting, and that Subjects/RoleRef are set correctly.

The shared deploy-function RoleBinding previously set a single Function
as the controller owner, overwriting any prior owner. Deleting that
Function would garbage-collect the RoleBinding, breaking other Functions
in the same namespace.

Use controllerutil.SetOwnerReference to append each Function as a
non-controller owner so the RoleBinding is only cleaned up when all
Functions in the namespace are deleted.
@creydr creydr enabled auto-merge April 29, 2026 07:51
@creydr creydr added this pull request to the merge queue Apr 29, 2026
Merged via the queue into functions-dev:main with commit b688bb6 Apr 29, 2026
11 checks passed
@creydr creydr deleted the fix/rolebinding-ownership-conflict branch April 29, 2026 09:32
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.

1 participant