feat(teams): enable token request for team service account#2046
feat(teams): enable token request for team service account#2046Zaggy21 wants to merge 16 commits into
Conversation
On-behalf-of: @SAP krzysztof.zagorski@sap.com Signed-off-by: Zaggy21 <k.zaggy@gmail.com>
There was a problem hiding this comment.
Pull request overview
This PR enables support-group Teams to request Kubernetes ServiceAccount tokens for their auto-created team ServiceAccount, allowing CI/CD pipelines to authenticate to the Greenhouse API as the team identity. It extends the Team controller to create and clean up the necessary namespace-scoped RBAC (Role + RoleBinding) alongside the existing support-group ServiceAccount.
Changes:
- Team controller now creates a
Rolepermittingcreateonserviceaccounts/tokenfor the team ServiceAccount, plus aRoleBindingbinding that role to both thesupport-group:<team>group and the team ServiceAccount. - Cleanup logic updated to delete the ServiceAccount, Role, and RoleBinding when the support-group label is removed.
- Added unit tests for RBAC creation/deletion, and updated user documentation with token request guidance.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
internal/controller/team/team_controller.go |
Creates/deletes support-group token-request RBAC (Role/RoleBinding) along with the team ServiceAccount. |
internal/controller/team/team_controller_test.go |
Adds tests asserting RBAC resources are created and deleted appropriately. |
docs/user-guides/team/authorization.md |
Documents how to request a token via kubectl create token and notes expiration capping. |
charts/manager/templates/rbac/manager-role.yaml |
Updates manager ClusterRole permissions related to RBAC resources. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
On-behalf-of: @SAP krzysztof.zagorski@sap.com Signed-off-by: Zaggy21 <k.zaggy@gmail.com>
…s for role, rolebinding and sa removal On-behalf-of: @SAP krzysztof.zagorski@sap.com Signed-off-by: Zaggy21 <k.zaggy@gmail.com>
On-behalf-of: @SAP krzysztof.zagorski@sap.com Signed-off-by: Zaggy21 <k.zaggy@gmail.com>
…ccount On-behalf-of: @SAP krzysztof.zagorski@sap.com Signed-off-by: Zaggy21 <k.zaggy@gmail.com>
…deletion helper On-behalf-of: @SAP krzysztof.zagorski@sap.com Signed-off-by: Zaggy21 <k.zaggy@gmail.com>
…tion at 90 days, add tests On-behalf-of: @SAP krzysztof.zagorski@sap.com Signed-off-by: Zaggy21 <k.zaggy@gmail.com>
On-behalf-of: @SAP krzysztof.zagorski@sap.com Signed-off-by: Zaggy21 <k.zaggy@gmail.com>
…ccount On-behalf-of: @SAP krzysztof.zagorski@sap.com Signed-off-by: Zaggy21 <k.zaggy@gmail.com>
… TokenRequest webhook On-behalf-of: @SAP krzysztof.zagorski@sap.com Signed-off-by: Zaggy21 <k.zaggy@gmail.com>
|
I've checked that Helm templating works and that token expiration capping works correctly in local env. Also I considered setting an admission warning message about shortened token expiration (which would require validating webhook for create), but, as agreed with Abhi, the documentation and log message in webhook pod is enough. |
Description
What type of PR is this? (check all applicable)
Related Tickets & Documents
Added tests?
Added unit tests.
Added to documentation?
Checklist