Skip to content

feat: Dynamic Slicing: Install Kueue Slice Controller and set default resources - #5794

Merged
SwarnaBharathiMantena merged 11 commits into
GoogleCloudPlatform:developfrom
jamOne-:ct-kueue-slice-controller
Jun 20, 2026
Merged

feat: Dynamic Slicing: Install Kueue Slice Controller and set default resources#5794
SwarnaBharathiMantena merged 11 commits into
GoogleCloudPlatform:developfrom
jamOne-:ct-kueue-slice-controller

Conversation

@jamOne-

@jamOne- jamOne- commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Description

This PR integrates the Kueue Slice Controller into the kubectl-apply module to support GKE dynamic slicing for TPUs.

The controller is automatically deployed when kueue.enable_dynamic_slicing_for_tpus is enabled.

Key Changes

  • Slice Controller Deployment: Extracted the slice-controller.yaml manifest directly from the GKE Dynamic Slicing Documentation. It is natively applied via the internal raw-config-chart.
  • Namespace Handling: The slice-controller-system namespace is managed explicitly within the manifest rather than through Helm release tracking, avoiding tracking collisions.
  • Resource Parameterization: Converted the slice controller manifest to a Terraform template (slice-controller.yaml.tftpl). Users can now override the massive default resource requirements via the kueue variable block if deploying on smaller node pools. It defaults to the upstream recommended limits (12000m cpu, 32Gi memory).
  • Jobset & Kueue Recommended Defaults: When dynamic slicing is enabled, the module automatically defaults the core jobset and kueue controller resources to the higher capacities recommended in the GKE docs (Jobset: 4 cpu / 16Gi memory, Kueue: 16 cpu / 64Gi memory / 3 replicas) unless explicitly overridden by the user.
  • Failsafe Validations: Added a Terraform lifecycle precondition that explicitly throws an error if a user attempts to enable dynamic slicing while Kueue installation is disabled.

@github-actions github-actions Bot added the external PR from external contributor label Jun 16, 2026
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request integrates the Kueue slice-controller into the cluster toolkit to support GKE Dynamic Slicing for TPUs. By leveraging a raw YAML manifest deployment strategy, the changes ensure the controller is installed without Helm ownership issues, maintaining clean namespace management.

Highlights

  • Dynamic Slicing Support: Introduced the Kueue slice-controller to enable GKE Dynamic Slicing for TPUs.
  • Native Manifest Deployment: Utilized the raw-config-chart Helm wrapper to deploy the controller manifest directly, avoiding Helm ownership conflicts.
  • Configuration Toggle: Added a conditional installation module triggered by the enable_dynamic_slicing_for_tpus configuration.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request introduces the installation of a slice controller under the kubectl-apply management module, including its Kubernetes manifests and a Terraform module definition. The review feedback highlights several critical improvements: pinning the container image to a stable version from an official registry instead of using a personal Docker Hub repository with the :latest tag, adding a Terraform lifecycle precondition to ensure Kueue is installed when slicing is enabled, lowering the excessively high CPU and memory resource requests/limits to prevent scheduling failures, and explicitly setting the Helm release namespace to kube-system for consistency.

Comment thread modules/management/kubectl-apply/kueue/slice-controller.yaml.tftpl
Comment thread modules/management/kubectl-apply/main.tf
Comment thread modules/management/kubectl-apply/kueue/slice-controller.yaml Outdated
Comment thread modules/management/kubectl-apply/main.tf
@jamOne-
jamOne- marked this pull request as ready for review June 16, 2026 13:05
@jamOne-
jamOne- requested a review from a team as a code owner June 16, 2026 13:05
jamOne- added 4 commits June 16, 2026 15:23
- Added a precondition in variables.tf to explicitly fail if kueue.enable_dynamic_slicing_for_tpus is true but kueue.install is false.
- Wrapped manifest.source expressions in try() within main.tf to fix terraform validation crashes when manifest.source is null.
- Converted slice-controller.yaml to a Terraform template.
- Added variables for cpu/memory limits and requests inside the kueue variable block, keeping the high default values from upstream docs.
- When dynamic slicing is enabled, automatically default Kueue and Jobset controller resources to the higher values recommended in the official GKE dynamic slicing documentation.
- Kueue defaults: 3 replicas, 16 cpu, 64Gi memory.
- Jobset defaults: 4 cpu, 16Gi memory.
- User-provided values will still override these defaults.
@jamOne- jamOne- changed the title feat: Install Kueue Slice Controller for Dynamic Slicing feat: Dynamic Slicing: Install Kueue Slice Controller and set default resources Jun 16, 2026
@jamOne-

jamOne- commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request adds support for dynamic TPU slicing by introducing a slice controller module, configuring resource allocations for Kueue and Jobset, and adding validation preconditions. The review feedback suggests addressing a potential startup race condition by making the slice controller depend on the Jobset installation, adding a validation precondition to ensure Jobset is installed when dynamic slicing is enabled, and pinning the slice controller container image to a specific version instead of using the ":latest" tag.

Comment thread modules/management/kubectl-apply/main.tf Outdated
Comment thread modules/management/kubectl-apply/variables.tf
Comment thread modules/management/kubectl-apply/kueue/slice-controller.yaml.tftpl
@jamOne-

jamOne- commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request introduces the Kueue slice controller to support dynamic slicing for TPUs, adding a new deployment template, updating the main configuration to conditionally install the controller, and adding input variables and preconditions. The review feedback highlights critical security improvements, including restricting cluster-wide secret access in the RBAC configuration to a namespaced Role, and parameterizing the hardcoded personal Docker Hub image with the ":latest" tag to allow configuring a pinned, official version. Additionally, the feedback recommends keeping the new variables nullable and using try() blocks to safely access attributes and prevent plan-time crashes.

Comment thread modules/management/kubectl-apply/kueue/slice-controller.yaml.tftpl
Comment thread modules/management/kubectl-apply/kueue/slice-controller.yaml.tftpl
Comment thread modules/management/kubectl-apply/kueue/slice-controller.yaml.tftpl
Comment thread modules/management/kubectl-apply/variables.tf
Comment thread modules/management/kubectl-apply/main.tf
@SwarnaBharathiMantena SwarnaBharathiMantena added the release-module-improvements Added to release notes under the "Module Improvements" heading. label Jun 17, 2026
@Neelabh94 Neelabh94 self-assigned this Jun 17, 2026
@jamOne-

jamOne- commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

Regarding the high priority comments in the PR, they are related to the manifest that is publicly available in the docs page. I don't think we should be fixing that?

@jamOne-

jamOne- commented Jun 18, 2026

Copy link
Copy Markdown
Contributor Author

@SwarnaBharathiMantena @Neelabh94 please run the e2e tests

@Neelabh94

Copy link
Copy Markdown
Contributor

/gcbrun

@Neelabh94 Neelabh94 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.

LGTM

@SwarnaBharathiMantena SwarnaBharathiMantena 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.

LGTM

@SwarnaBharathiMantena
SwarnaBharathiMantena merged commit e07d51c into GoogleCloudPlatform:develop Jun 20, 2026
15 of 88 checks passed
ep-nag pushed a commit to nagconsulting/cluster-toolkit that referenced this pull request Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external PR from external contributor release-module-improvements Added to release notes under the "Module Improvements" heading.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants