Skip to content

fix(cluster-api): fix kamaji OOM and set limits on unset providers - #2708

Merged
myasnikovdaniil merged 1 commit into
mainfrom
fix-capi-resources
May 21, 2026
Merged

myasnikovdaniil merged 1 commit into
mainfrom
fix-capi-resources

Conversation

@myasnikovdaniil

@myasnikovdaniil myasnikovdaniil commented May 21, 2026 •

Copy link
Copy Markdown
Contributor

What this PR does

Fixes resource specs on CAPI provider pods in cozy-cluster-api.

Kamaji control-plane-provider — fix OOMKilled crashloop.
The override in packages/system/capi-providers-cpprovider/templates/providers.yaml targeted containers[name=manager], but the upstream container in docker.io/clastix/cluster-api-control-plane-provider-kamaji is named controller. The CAPI operator merges container overrides by container name, so the intended cpu: 1 / memory: 1024Mi limits were silently dropped and the upstream default of memory: 128Mi was used. The kamaji controller pod therefore restarts repeatedly with exit code 137 (OOMKilled), even at idle.

Core / bootstrap / kubevirt providers — add limits.
Upstream *-components.yaml for these three providers ships with no resources: block, and cozystack added no override. The pods run BestEffort and are first to evict under memory pressure. Set modest limits (500m / 256Mi) and requests (10m / 64Mi) matching typical CAPI controller-manager footprint.

Release note

fix(cluster-api): fix the resource override for the kamaji control-plane-provider (was silently ignored due to a wrong container name, causing OOMKilled restarts) and set requests/limits for the core, kubeadm-bootstrap, and kubevirt-infrastructure providers (were running BestEffort).

Summary by CodeRabbit

  • Chores
    • Updated provider deployment configurations to establish resource management parameters (CPU/memory requests and limits) for container deployments across multiple provider types, improving scheduling optimization and resource predictability
    • Standardized container naming conventions in provider templates for consistency

Review Change Stack

The kamaji control-plane-provider override in templates/providers.yaml
targeted containers[name=manager], but the upstream container is named
"controller". The CAPI operator merges container overrides by name, so
the intended cpu: 1 / memory: 1024Mi limits were silently dropped and
the upstream default of memory: 128Mi was used, producing repeated
OOMKilled restarts of the kamaji controller (exit code 137).

The other three providers (core, bootstrap, infraprovider/kubevirt)
ship upstream with no resources block and have no cozystack override,
so they run BestEffort and are first to evict under memory pressure.
Set modest limits (500m / 256Mi) and requests (10m / 64Mi) matching
typical CAPI controller-manager footprint.

Assisted-By: Claude <[email protected]>
Signed-off-by: Myasnikov Daniil <[email protected]>
@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 improves the stability and reliability of Cluster API provider pods within the cozy-cluster-api system. By correcting a misnamed container override and establishing explicit resource constraints for previously unconfigured providers, the changes prevent unnecessary OOMKilled events and ensure more predictable scheduling behavior under memory pressure.

Highlights

  • Kamaji Provider Fix: Corrected the container name from 'manager' to 'controller' in the Kamaji control-plane-provider to ensure resource limits are correctly applied, preventing OOMKilled crashloops.
  • Resource Limits for CAPI Providers: Added standard resource requests and limits (500m CPU / 256Mi RAM) to the core, bootstrap, and KubeVirt infrastructure providers to move them from BestEffort to Guaranteed/Burstable QoS classes.
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. ↩

@github-actions github-actions Bot added size/M This PR changes 30-99 lines, ignoring generated files area/platform Issues or PRs related to platform infrastructure (bundle, flux, talos, installer) kind/bug Categorizes issue or PR as related to a bug labels May 21, 2026
@coderabbitai

coderabbitai Bot commented May 21, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 994e3a2c-2b24-484d-9ac6-527db0419e4d

📥 Commits

Reviewing files that changed from the base of the PR and between 9c87996 and 6ae66f7.

📒 Files selected for processing (4)
  • packages/system/capi-providers-bootstrap/templates/providers.yaml
  • packages/system/capi-providers-core/templates/providers.yaml
  • packages/system/capi-providers-cpprovider/templates/providers.yaml
  • packages/system/capi-providers-infraprovider/templates/providers.yaml

📝 Walkthrough

Walkthrough

This PR updates Kubernetes cluster-api provider templates across four packages, adding standardized resource requests and limits for manager containers in three providers (bootstrap, core, infrastructure) and renaming the container in the cpp provider from manager to controller for clarity.

Changes

Provider Configuration Standardization

Layer / File(s) Summary
Resource allocation standardization
packages/system/capi-providers-bootstrap/templates/providers.yaml, packages/system/capi-providers-core/templates/providers.yaml, packages/system/capi-providers-infraprovider/templates/providers.yaml
Bootstrap, Core, and InfrastructureProvider templates each add CPU/memory resource requests (10m/64Mi) and limits (500m/256Mi) for the manager container in the deployment spec.
Container naming alignment
packages/system/capi-providers-cpprovider/templates/providers.yaml
The CPProvider template's deployment container name is changed from manager to controller.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Four templates sprout anew,
Resources defined with limits true,
Bootstrap, core, and infra agree,
One controller wears a new ID,
Consistency blooms in the cluster tree! 🌿

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main changes: fixing Kamaji OOM issues and setting resource limits on previously unset providers.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-capi-resources

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 and usage tips.

@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 updates the Cluster API provider templates across several system packages by defining resource requests and limits for the manager containers in the bootstrap, core, and infrastructure providers. Additionally, the container name in the control plane provider template was updated from manager to controller. I have no feedback to provide as the changes follow the project's standards for resource management.

@myasnikovdaniil myasnikovdaniil added kind/backport Categorizes issue or PR as requiring a backport to the current release line kind/backport-previous Categorizes issue or PR as requiring a backport to the previous release line labels May 21, 2026
@myasnikovdaniil
myasnikovdaniil merged commit 243d20e into main May 21, 2026
13 of 14 checks passed
@myasnikovdaniil
myasnikovdaniil deleted the fix-capi-resources branch May 21, 2026 10:14
@github-actions

Copy link
Copy Markdown

Successfully created backport PR for release-1.4:

@github-actions

Copy link
Copy Markdown

Successfully created backport PR for release-1.3:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/platform Issues or PRs related to platform infrastructure (bundle, flux, talos, installer) kind/backport Categorizes issue or PR as requiring a backport to the current release line kind/backport-previous Categorizes issue or PR as requiring a backport to the previous release line kind/bug Categorizes issue or PR as related to a bug size/M This PR changes 30-99 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants