Skip to content

[snapshot-controller] Set resources requests/limits on controller and webhook - #2633

Open
Matthieu ROBIN (matthieu-robin) wants to merge 1 commit into
cozystack:mainfrom
matthieu-robin:fix/snapshot-controller-cpu-limit
Open

Matthieu ROBIN (matthieu-robin) wants to merge 1 commit into
cozystack:mainfrom
matthieu-robin:fix/snapshot-controller-cpu-limit

Conversation

@matthieu-robin

@matthieu-robin Matthieu ROBIN (matthieu-robin) commented May 12, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The piraeusdatastore snapshot-controller chart (which deploys kubernetes-csi/external-snapshotter) ships with resources: {} for both the controller and the validation webhook, triggering no CPU limit conformance warnings on the two Deployments in cozy-snapshot-controller.

Upstream doesn't publish official sizing either — manifests in the kubernetes-csi repo and the OpenShift fork both leave resources unset. Sized based on a production reference:

Container requests cpu/mem limits cpu/mem
snapshot-controller 100m / 128Mi 500m / 512Mi
snapshot-validation-webhook 10m / 32Mi 100m / 128Mi

Webhook stays light (HTTP admission validation, same sizing as cert-manager-webhook in #2616); controller gets the production-recommended envelope.

Test plan

  • helm template . --namespace cozy-snapshot-controller from packages/system/snapshot-controller/ renders resources blocks on both snapshot-controller and snapshot-validation-webhook Deployments (verified locally)
  • Re-run the conformance/lint tool — both no CPU limit warnings should be gone
  • CI passes

Release note

```release-note
Set CPU/memory requests and limits on the snapshot-controller and snapshot-validation-webhook Deployments to clear "no CPU limit" conformance warnings.
```

Summary by CodeRabbit

  • Chores
    • Added CPU and memory resource limits and requests for the snapshot-controller to enable proper resource allocation across the system.

Review Change Stack

… webhook

The piraeusdatastore snapshot-controller chart (which deploys
kubernetes-csi/external-snapshotter) ships with resources: {} for both
the controller and the validation webhook, triggering 'no CPU limit'
conformance warnings. The upstream manifests don't ship recommendations
either, so size based on the production reference at
oneuptime.com/blog/2026-02-09-csi-snapshot-controller:

  snapshot-controller         limits 500m/512Mi, requests 100m/128Mi
  snapshot-validation-webhook limits 100m/128Mi, requests 10m/32Mi

Webhook stays light (HTTP admission, matches the cert-manager-webhook
sizing in cozystack#2616); controller gets the production-recommended envelope.

Signed-off-by: Matthieu <[email protected]>

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@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 updates the Helm chart configuration for the snapshot-controller to include resource requests and limits. By defining these values for both the controller and the validation webhook, the changes ensure better resource management and satisfy cluster conformance requirements regarding CPU limits.

Highlights

  • Resource Configuration: Added CPU and memory requests and limits to the snapshot-controller deployment.
  • Webhook Optimization: Added CPU and memory requests and limits to the snapshot-validation-webhook deployment.
  • Conformance Compliance: Resolved 'no CPU limit' conformance warnings by defining explicit resource constraints.
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. ↩

@coderabbitai

coderabbitai Bot commented May 12, 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: 24fa7d4f-4f50-4abd-88c4-d18b26248767

📥 Commits

Reviewing files that changed from the base of the PR and between 5f83ae7 and 190daac.

📒 Files selected for processing (1)
  • packages/system/snapshot-controller/values.yaml

📝 Walkthrough

Walkthrough

This pull request adds Kubernetes resource constraints to the snapshot-controller Helm values. CPU and memory limits and requests are specified for both the controller component and the webhook component, with the webhook receiving lower resource allocations than the controller.

Changes

Snapshot Controller Resource Configuration

Layer / File(s) Summary
Resource limits and requests for controller and webhook
packages/system/snapshot-controller/values.yaml
Controller resources specify 500m/512Mi limits and 100m/128Mi requests; webhook resources specify 100m/128Mi limits and 10m/32Mi requests.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Poem

🐰 A controller needs its bounds,
Five hundred millicores, memory pound,
The webhook, nimble, lighter still,
Just crumbs to spare—a Kubernetes fill! ✨

🚥 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 clearly and accurately summarizes the main change: adding resource requests and limits to the snapshot-controller and webhook components.
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

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.

@github-actions github-actions Bot added area/uncategorized PR auto-labeler could not map title scope to a known area/*; please review size/S This PR changes 10-29 lines, ignoring generated files labels May 12, 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 adds resource requests and limits for the snapshot-controller's controller and webhook components. Feedback includes the need to update the values.schema.json file via make generate, ensuring the PR title and commits adhere to Conventional Commits and sign-off requirements, and adding securityContext configurations for both components to align with security standards.

Comment on lines +5 to +11
resources:
limits:
cpu: 500m
memory: 512Mi
requests:
cpu: 100m
memory: 128Mi

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.

medium

When adding or modifying fields in values.yaml, the values.schema.json file should be updated to ensure the dashboard UI and input validation are in sync. Please run make generate and include the resulting changes in this pull request.

References
  1. values.schema.json is used for dashboard UI and input validation and is regenerated by make generate.

controller:
replicaCount: 2
revisionHistoryLimit: 10
resources:

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.

low

The PR title and the release note do not follow the Conventional Commits format required by the repository style guide. Additionally, ensure all commits include a Signed-off-by: trailer. The PR title should be in the format type(scope): description (e.g., feat(snapshot-controller): set resources requests/limits), and the release note should also follow the type(scope): description format.

References
  1. Each commit must follow Conventional Commits format: type(scope): brief description.
  2. PR body must contain a release note block following the type(scope): human-readable changelog entry format.

controller:
replicaCount: 2
revisionHistoryLimit: 10
resources:

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.

low

The repository style guide recommends flagging missing securityContext configurations. Consider defining podSecurityContext and containerSecurityContext for the controller to enhance the security posture of the deployment.

References
  1. Flag missing securityContext, containers running as root without justification, and other security-related omissions.

certManagerIssuerRef:
name: selfsigned-cluster-issuer
kind: ClusterIssuer
resources:

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.

low

Similar to the controller, the webhook deployment is missing a securityContext. It is recommended to add one to adhere to the project's security standards.

References
  1. Flag missing securityContext, containers running as root without justification, and other security-related omissions.

@lexfrei Aleksei Sviridkin (lexfrei) added kind/cleanup Categorizes issue or PR as related to cleanup of code, process, or technical debt area/storage Issues or PRs related to storage (linstor, seaweedfs, bucket, velero, harbor) and removed area/uncategorized PR auto-labeler could not map title scope to a known area/*; please review labels May 25, 2026

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.

Both resource blocks are placed correctly under the existing controller and webhook keys, the webhook/controller split is sensible, and E2E passes. The automated make generate / schema reminder doesn't apply — this package has no values.schema.json and no cozyvalues-gen step, and pre-commit is green — and the commit is already signed off. The remaining item is the Conventional Commits title; please retitle to something like chore(snapshot-controller): set resource requests/limits on controller and webhook. The securityContext suggestion is out of scope for a resources-only change and can be a separate PR.

@myasnikovdaniil

Copy link
Copy Markdown
Contributor

I would take the memory half of this.

The CPU limits I would rather drop, and the webhook's 100m specifically. That path is synchronous admission, so a ceiling that binds there turns into snapshot creation timeouts rather than into a slow controller. The controller half does not scale with anything so its ceiling is harmless, but I would keep the two consistent rather than explain the difference later.

Drop the two limits.cpu and I will approve.

@lexfrei

Copy link
Copy Markdown
Contributor

Matthieu ROBIN (@matthieu-robin) myasnikovdaniil asked on 2026-08-15 to drop the two limits.cpu and said he would approve after that. Are you OK with removing them?

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

Labels

area/storage Issues or PRs related to storage (linstor, seaweedfs, bucket, velero, harbor) kind/cleanup Categorizes issue or PR as related to cleanup of code, process, or technical debt quality-of-life QoL improvements size/S This PR changes 10-29 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants