Skip to content

[Backport release-1.4] fix(kubernetes): make node group resources optional when instanceType is set - #3157

Merged
myasnikovdaniil merged 1 commit into
release-1.4from
backport-3121-to-release-1.4
Jul 3, 2026
Merged

[Backport release-1.4] fix(kubernetes): make node group resources optional when instanceType is set#3157
myasnikovdaniil merged 1 commit into
release-1.4from
backport-3121-to-release-1.4

Conversation

@myasnikovdaniil

Copy link
Copy Markdown
Contributor

What this PR does

Backport of #3121 to release-1.4.

Makes node group resources optional, so a node group sized purely by instanceType (with resources omitted) passes values.schema.json validation and installs. When a group sets both instanceType and explicit resources (both cpu and memory), the explicit resources take precedence: the instancetype is omitted from the rendered VM and the per-group instancetype lookup is skipped, so KubeVirt does not reject a VM that references an instancetype while overriding domain.cpu/memory. A partial spec (only one of cpu/memory) alongside an instanceType fails fast at render time.

Cherry-picked from a349c753; conflicts resolved against the release-1.4 tree (the management-cluster Talos worker bootstrap stack present on main is not on this branch, so the schema/template/test layout differ). Generated files (values.schema.json, README.md, cozyrds, API types) regenerated with make generate to match. helm unittest passes (130 tests), including the four new node-group sizing cases adapted to this branch's document layout.

Release note

fix(kubernetes): make node group resources optional when instanceType is set

…ver instanceType

A node group is sized either by instanceType or by explicit resources, but the
generated values schema required resources on every node group. A node group
with instanceType and no resources — or an empty resources dropped during
typed-CR to HelmRelease translation — failed schema validation with "missing
property 'resources'" even though sizing was fully specified.

Mark resources optional in the node group definition and regenerate the schema,
API types, README, and ApplicationDefinition. The chart template emits
domain.cpu/memory only when resources is present, so a node group sized purely
by instanceType now passes validation and installs.

When a node group sets both instanceType and explicit resources, explicit
resources take precedence: the instancetype is omitted from the rendered VM and
the per-group instancetype lookup is skipped, so KubeVirt accepts the explicit
domain.cpu/memory with no instancetype to conflict with. instanceType stays
required and defaulted (no schema change), so the console's required
instanceType dropdown keeps working — sending the default instanceType plus
explicit resources simply sizes the VM by resources. This replaces an earlier
render-time hard failure on the both-set case, which was unreachable to clear
from the dashboard (the required dropdown cannot be emptied).

Explicit resources are all-or-nothing alongside an instanceType: a partial spec
(only cpu, or only memory) on a group that carries a non-empty instanceType
would emit one domain override next to the instancetype — which KubeVirt rejects
— so it now fails at render time with a clear error. Partial resources on a
group without an instanceType (used to tune kubelet reservations) are unaffected.

Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
(cherry picked from commit a349c75)
@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 040fa425-e1de-4f03-a425-6bcb8ae8fec2

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch backport-3121-to-release-1.4

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

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added area/kubernetes Issues or PRs related to the tenant Kubernetes app area/release Issues or PRs related to release tooling (changelog, backport, release pipeline) kind/bug Categorizes issue or PR as related to a bug size/L This PR changes 100-499 lines, ignoring generated files labels Jun 30, 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 backports changes from the main branch to the release-1.4 branch to improve node group configuration flexibility. By making the resources field optional, users can now size node groups using only an instanceType. The changes also introduce logic to handle cases where both instanceType and explicit resources are defined, ensuring that explicit resources take precedence and that the resulting configuration is valid for KubeVirt. These updates include necessary schema adjustments and new unit tests to guarantee stability.

Highlights

  • Optional Node Group Resources: Modified the node group configuration to make the resources field optional, allowing node groups to be sized exclusively by instanceType.
  • Resource Precedence: Implemented logic where explicit resources (CPU and memory) take precedence over instanceType when both are provided, ensuring KubeVirt compatibility by omitting the instanceType from the rendered VM.
  • Validation Improvements: Added render-time validation to ensure that if resources are provided, both cpu and memory must be set, preventing partial specifications that would lead to admission failures.
  • Documentation and Testing: Updated values.schema.json, README.md, and values.yaml to reflect the new optionality and added comprehensive helm unittest cases to verify the new sizing behavior.
New Features

🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

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

@dosubot dosubot Bot added the backport Should change be backported on previous release label Jun 30, 2026

@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 makes the resources field optional in the Kubernetes node group configuration, allowing node groups to be sized either by instanceType or by explicit resources (CPU and memory). When both cpu and memory are set, they take precedence and the instanceType is ignored. The changes update the API types, Helm chart templates, values schema, documentation, and include comprehensive unit tests to validate the new sizing logic and error handling for partial resource specifications. I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@myasnikovdaniil
myasnikovdaniil merged commit 9369e61 into release-1.4 Jul 3, 2026
11 of 12 checks passed
@myasnikovdaniil
myasnikovdaniil deleted the backport-3121-to-release-1.4 branch July 3, 2026 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/kubernetes Issues or PRs related to the tenant Kubernetes app area/release Issues or PRs related to release tooling (changelog, backport, release pipeline) backport Should change be backported on previous release kind/bug Categorizes issue or PR as related to a bug size/L This PR changes 100-499 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants