Skip to content

feat(t8s-cluster): add rbac for teuto staff#1498

Merged
cwrau merged 1 commit intomainfrom
feat/t8s-cluster/add-rbac-for-teuto-staff
Jun 5, 2025
Merged

feat(t8s-cluster): add rbac for teuto staff#1498
cwrau merged 1 commit intomainfrom
feat/t8s-cluster/add-rbac-for-teuto-staff

Conversation

@cwrau
Copy link
Copy Markdown
Member

@cwrau cwrau commented Jun 4, 2025

This allows the staff users to use OIDC kubeconfigs instead of the admin-conf

Summary by CodeRabbit

  • New Features
    • Added automatic mapping of JWT "groups" claims with a "teuto.net:" prefix for improved authentication integration.
    • Introduced a new RBAC configuration that grants cluster-admin privileges to the "teuto.net:staff" group.

This allows the staff users to use OIDC kubeconfigs instead of the admin-conf
Copilot AI review requested due to automatic review settings June 4, 2025 15:27
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 4, 2025

Walkthrough

A new JWT claim mapping for "groups" is added to the authentication configuration, prefixing each group with "teuto.net:". Additionally, a Helm template is introduced to create a ClusterRoleBinding that grants the "teuto.net:staff" group cluster-admin privileges in the workload cluster.

Changes

File(s) Change Summary
charts/t8s-cluster/templates/management-cluster/clusterClass/_authenticationConfig.yaml Added claim mapping to prefix JWT "groups" with "teuto.net:" in authentication configuration.
charts/t8s-cluster/templates/workload-cluster/rbac/teuto-clusterrolebinding.yaml Introduced Helm template for ClusterRoleBinding granting cluster-admin to "teuto.net:staff" group.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant API Server
    participant JWT Auth
    participant Kubernetes RBAC

    User->>API Server: Authenticate with JWT (groups claim)
    API Server->>JWT Auth: Map "groups" claim (prefix with "teuto.net:")
    API Server->>Kubernetes RBAC: Authorize access for "teuto.net:staff"
    Kubernetes RBAC-->>API Server: Grant cluster-admin if in "teuto.net:staff"
    API Server-->>User: Access granted/denied
Loading

Suggested labels

base-cluster

Poem

In clusters where teuto bunnies hop,
New group claims now wear a prefix top!
Staff in the net, with admin’s might,
Can leap through RBAC fields in flight.
🐇 With claims and bindings set anew,
The cluster’s safe—thanks to this crew!


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown

Copilot AI left a comment

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 adds RBAC support for Teuto staff by granting them access via OIDC group mappings instead of the admin kubeconfig.

  • Introduces a ClusterRoleBinding for the teuto.net:staff group
  • Extends the authenticationConfig to map OIDC claim groups into Kubernetes groups

Reviewed Changes

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

File Description
charts/t8s-cluster/templates/workload-cluster/rbac/teuto-clusterrolebinding.yaml Defines a ClusterRoleBinding named teuto-staff for the staff group
charts/t8s-cluster/templates/management-cluster/clusterClass/_authenticationConfig.yaml Adds a groups claim mapping using dyn(claims.groups)
Comments suppressed due to low confidence (2)

charts/t8s-cluster/templates/management-cluster/clusterClass/_authenticationConfig.yaml:13

  • There’s no test coverage for the new group mapping logic; consider adding unit or integration tests to verify that claims.groups is correctly mapped to the expected Kubernetes group names.
        expression: dyn(claims.groups).map(g, "teuto.net:" + g)

charts/t8s-cluster/templates/management-cluster/clusterClass/_authenticationConfig.yaml:12

  • [nitpick] It may help to add a brief comment explaining the use of dyn() and the mapping expression to clarify how OIDC claim groups are transformed into Kubernetes groups.
      groups:

@teutonet-bot
Copy link
Copy Markdown
Contributor

🤖 I have diffed this beep boop

"/$namespace/$kind/$name.yaml" for normal resources
"/$namespace/HelmRelease/$name/$namespace/$kind/$name.yaml" for HelmReleases <- this is recursive
'null' means it's either cluster-scoped or it's in the default namespace for the HelmRelease

charts/t8s-cluster/ci/artifacthub-values.yaml

charts/t8s-cluster/ci/cidrs-values.yaml

charts/t8s-cluster/ci/injectedCertificateAuthorities-values.yaml

charts/t8s-cluster/ci/hcp-values.yaml

charts/t8s-cluster/ci/securityGroups-values.yaml

charts/t8s-cluster/ci/calico-values.yaml

charts/t8s-cluster/ci/securityGroupRules-values.yaml

charts/t8s-cluster/ci/bastion-values.yaml

charts/t8s-cluster/values.yaml

charts/t8s-cluster/ci/gpu-flavor-values.yaml

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
charts/t8s-cluster/templates/workload-cluster/rbac/teuto-clusterrolebinding.yaml (1)

3-15: Explicitly specify apiGroup in subject and review privilege scope: To avoid ambiguity, add apiGroup: rbac.authorization.k8s.io under the Group subject. Also, granting cluster-admin is extremely permissive—verify this aligns with your security policy for the teuto.net:staff group:

subjects:
  - kind: Group
    apiGroup: rbac.authorization.k8s.io
    name: teuto.net:staff
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 372c92b and abd8b2c.

📒 Files selected for processing (2)
  • charts/t8s-cluster/templates/management-cluster/clusterClass/_authenticationConfig.yaml (1 hunks)
  • charts/t8s-cluster/templates/workload-cluster/rbac/teuto-clusterrolebinding.yaml (1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.37.1)
charts/t8s-cluster/templates/workload-cluster/rbac/teuto-clusterrolebinding.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

🔇 Additional comments (2)
charts/t8s-cluster/templates/management-cluster/clusterClass/_authenticationConfig.yaml (1)

12-13: Confirm groups claim mapping compatibility and defaulting: Good addition to prefix Teuto groups. Ensure your Helm/Sprig version supports the dyn and map functions. Consider safeguarding against missing claims.groups by defaulting to an empty list:

expression: (dyn(claims.groups) | default([])).map(g, "teuto.net:" + g)
charts/t8s-cluster/templates/workload-cluster/rbac/teuto-clusterrolebinding.yaml (1)

1-1: Check resource naming consistency in helper invocation: The resourceIntoCluster call uses "teuto-rbac" as the name, but the actual metadata.name in the rendered ClusterRoleBinding is teuto-staff. Confirm this discrepancy is intentional and that the helper correctly applies the intended manifest name.

🧰 Tools
🪛 YAMLlint (1.37.1)

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

@cwrau cwrau added this pull request to the merge queue Jun 5, 2025
Merged via the queue into main with commit 9e0a9e2 Jun 5, 2025
42 checks passed
@cwrau cwrau deleted the feat/t8s-cluster/add-rbac-for-teuto-staff branch June 5, 2025 08:05
github-merge-queue Bot pushed a commit that referenced this pull request Jun 6, 2025
🤖 I have created a release *beep* *boop*
---


##
[9.3.0](t8s-cluster-v9.2.1...t8s-cluster-v9.3.0)
(2025-06-06)


### Features

* **t8s-cluster:** add rbac for teuto staff
([#1498](#1498))
([9e0a9e2](9e0a9e2))
* **t8s-cluster:** enable audit logging
([#1440](#1440))
([dcb28ca](dcb28ca))
* **t8s-cluster:** make apiserver resources configurable
([#1485](#1485))
([3126661](3126661))
* **t8s-cluster:** use new pullPolicy template
([#1383](#1383))
([6b253bd](6b253bd))


### Miscellaneous Chores

* **t8s-cluster:** pin versions
([#1482](#1482))
([372c92b](372c92b))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
  - Added RBAC for Teuto staff.
  - Enabled audit logging.
  - Made apiserver resource configurations customizable.
  - Adopted a new pullPolicy template.

- **Enhancements**
- Updated OpenStack Cinder CSI plugin and related CSI component images
to newer versions.
- Improved documentation for control plane resource configuration and
security group rule options.

- **Chores**
  - Updated chart version to 9.3.0 and pinned image versions.
- Switched CSI image references and license entries from k8s.gcr.io to
registry.k8s.io.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Chris Werner Rau <cwr@teuto.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants