Skip to content

feat(teams): enable token request for team service account#2046

Open
Zaggy21 wants to merge 16 commits into
mainfrom
feat/enable-token-request-for-team-service-account
Open

feat(teams): enable token request for team service account#2046
Zaggy21 wants to merge 16 commits into
mainfrom
feat/enable-token-request-for-team-service-account

Conversation

@Zaggy21

@Zaggy21 Zaggy21 commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Description

  • Support-group teams can now request tokens for their ServiceAccount, enabling CI/CD pipelines to authenticate against the Greenhouse API using the team's identity
  • Greenhouse automatically creates the necessary RBAC (Role + RoleBinding) alongside the existing ServiceAccount when a team is marked as a support-group
  • A mutating webhook caps all token requests for Greenhouse-managed ServiceAccounts at 90 days

What type of PR is this? (check all applicable)

  • 🍕 Feature
  • 🐛 Bug Fix
  • 📝 Documentation Update
  • 🎨 Style
  • 🧑‍💻 Code Refactor
  • 🔥 Performance Improvements
  • ✅ Test
  • 🤖 Build
  • 🔁 CI
  • 📦 Chore (Release)
  • ⏩ Revert

Related Tickets & Documents

Added tests?

  • 👍 yes
  • 🙅 no, because they aren't needed
  • 🙋 no, because I need help
  • Separate ticket for tests # (issue/pr)

Added unit tests.

Added to documentation?

  • 📜 README.md
  • 🤝 Documentation pages updated
  • 🙅 no documentation needed
  • (if applicable) generated OpenAPI docs for CRD changes

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • New and existing unit tests pass locally with my changes

Zaggy21 added 2 commits June 1, 2026 15:51
…equests

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>
@Zaggy21 Zaggy21 linked an issue Jun 1, 2026 that may be closed by this pull request
4 tasks
On-behalf-of: @SAP krzysztof.zagorski@sap.com
Signed-off-by: Zaggy21 <k.zaggy@gmail.com>
@github-actions github-actions Bot added size/L documentation Improvements or additions to documentation labels Jun 1, 2026
@Zaggy21 Zaggy21 marked this pull request as ready for review June 1, 2026 16:30
Copilot AI review requested due to automatic review settings June 1, 2026 16:30
@Zaggy21 Zaggy21 requested review from a team as code owners June 1, 2026 16:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Role permitting create on serviceaccounts/token for the team ServiceAccount, plus a RoleBinding binding that role to both the support-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.

Comment thread charts/manager/templates/rbac/manager-role.yaml
On-behalf-of: @SAP krzysztof.zagorski@sap.com
Signed-off-by: Zaggy21 <k.zaggy@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Comment thread internal/controller/team/team_controller.go Outdated
Comment thread internal/controller/team/team_controller.go
Comment thread internal/controller/team/team_controller.go
Comment thread internal/controller/team/team_controller.go
…s for role, rolebinding and sa removal

On-behalf-of: @SAP krzysztof.zagorski@sap.com
Signed-off-by: Zaggy21 <k.zaggy@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Comment thread internal/controller/team/team_controller.go
Comment thread internal/controller/team/team_controller.go Outdated
On-behalf-of: @SAP krzysztof.zagorski@sap.com
Signed-off-by: Zaggy21 <k.zaggy@gmail.com>
Comment thread internal/controller/team/team_controller.go Outdated
Comment thread internal/controller/team/team_controller.go Outdated
Comment thread internal/controller/team/team_controller.go
Comment thread docs/user-guides/team/authorization.md Outdated
Zaggy21 added 4 commits June 10, 2026 11:41
…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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Comment thread internal/webhook/v1alpha1/tokenrequest_webhook.go
Zaggy21 added 2 commits June 10, 2026 15:21
…bhook

On-behalf-of: @SAP krzysztof.zagorski@sap.com
Signed-off-by: Zaggy21 <k.zaggy@gmail.com>
…amespaceSelector

On-behalf-of: @SAP krzysztof.zagorski@sap.com
Signed-off-by: Zaggy21 <k.zaggy@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Comment thread internal/webhook/v1alpha1/tokenrequest_webhook.go
Zaggy21 added 2 commits June 10, 2026 17:40
… TokenRequest webhook

On-behalf-of: @SAP krzysztof.zagorski@sap.com
Signed-off-by: Zaggy21 <k.zaggy@gmail.com>
@Zaggy21

Zaggy21 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

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.

@Zaggy21 Zaggy21 requested a review from abhijith-darshan June 11, 2026 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation feature helm-charts size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] - Enable token request for Team Service account

3 participants