8000 [platform]: add vpa for cozy etcd operator by klinch0 · Pull Request #850 · cozystack/cozystack · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[platform]: add vpa for cozy etcd operator #850

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 23, 2025

Conversation

klinch0
Copy link
Contributor
@klinch0 klinch0 commented Apr 22, 2025

Summary by CodeRabbit

  • New Features
    • Added support for Vertical Pod Autoscaler (VPA) configuration in the etcd-operator Helm chart, allowing automatic scaling of CPU and memory resources for both the operator and kube-rbac-proxy components.
    • Introduced new configuration options for enabling VPA, setting resource limits, and specifying update policies.
  • Documentation
    • Updated documentation to describe the new VPA configuration options and usage.
  • Chores
    • Incremented chart version to 0.4.2.

8000
@klinch0 klinch0 requested review from kvaps and lllamnyp as code owners April 22, 2025 19:48
Signed-off-by: kklinch0 <kklinch0@gmail.com>
Copy link
Contributor
coderabbitai bot commented Apr 22, 2025

Walkthrough

This update introduces Vertical Pod Autoscaler (VPA) support to the etcd-operator Helm chart. It adds new configuration options for enabling VPA and specifying resource limits for both the etcd-operator and kube-rbac-proxy containers. The deployment template is updated to conditionally omit static resource requests and limits when VPA is enabled. A new VPA manifest template is included, and the chart metadata, schema, and documentation are updated to reflect these changes.

Changes

Files/Paths Change Summary
.../etcd-operator/Chart.yaml Bumped chart and app version from 0.4.1 to 0.4.2.
.../etcd-operator/README.md Documented new VPA configuration options for etcdOperator and kubeRbacProxy, and added global VPA updatePolicy documentation.
.../etcd-operator/templates/workload/deployment.yml Conditionally excludes container resource requests/limits when VPA is enabled for etcd-operator or kube-rbac-proxy.
.../etcd-operator/templates/workload/vpa.yml Added new template for VerticalPodAutoscaler resource, conditionally created based on VPA enablement flags.
.../etcd-operator/values.schema.json Extended schema to define VPA configuration structure for etcdOperator, kubeRbacProxy, and global updatePolicy.
.../etcd-operator/values.yaml Added VPA configuration blocks for etcdOperator, kubeRbacProxy, and a global VPA updatePolicy setting.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Helm
    participant Kubernetes API
    participant etcd-operator Deployment
    participant VPA Controller

    User->>Helm: Install/Upgrade chart with VPA enabled
    Helm->>Kubernetes API: Deploy etcd-operator and VPA manifests
    Kubernetes API->>etcd-operator Deployment: Create/Update deployment
    Kubernetes API->>VPA Controller: Create VPA resource
    VPA Controller->>etcd-operator Deployment: Monitor and adjust resources
Loading

Possibly related PRs

  • cozystack/cozystack#781: Introduces a Helm chart and release configuration for the VPA CRDs, related as both PRs address VPA integration but focus on different components.

Suggested reviewers

  • kvaps
  • lllamnyp

Poem

In the garden of pods where resources grow,
A VPA breeze begins to blow.
Etcd-operator now scales with grace,
Adapting its needs in Kubernetes' space.
YAML and schema, all in a row,
The chart hops forward—onward we go!
🐇✨


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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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

@klinch0 klinch0 force-pushed the (platform)--add-vpa-for-cozy-etcd-operator branch from 5c4627a to e8cc444 Compare April 22, 2025 19:48
Copy link
Contributor
@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: 4

♻️ Duplicate comments (1)
packages/system/etcd-operator/charts/etcd-operator/values.schema.json (1)

260-290: 🛠️ Refactor suggestion

Duplicate VPA schema under kubeRbacProxy
This vpa schema is identical to the one under etcdOperator. Please see the above suggestion about extracting a common $ref from "$defs" to eliminate duplication and improve maintainability.

🧹 Nitpick comments (1)
packages/system/etcd-operator/charts/etcd-operator/values.schema.json (1)

333-341: Restrict and document updatePolicy values
The global vpa.updatePolicy is currently an unrestricted string. To help users choose valid options, add an "enum" (e.g., ["Off","Auto","Initial","Recreate"]), include a "description" explaining each mode, and consider a "default" value.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between d3a8a4a and e8cc444.

📒 Files selected for processing (6)
  • packages/system/etcd-operator/charts/etcd-operator/Chart.yaml (1 hunks)
  • packages/system/etcd-operator/charts/etcd-operator/README.md (3 hunks)
  • packages/system/etcd-operator/charts/etcd-operator/templates/workload/deployment.yml (2 hunks)
  • packages/system/etcd-operator/charts/etcd-operator/templates/workload/vpa.yml (1 hunks)
  • packages/system/etcd-operator/charts/etcd-operator/values.schema.json (3 hunks)
  • packages/system/etcd-operator/charts/etcd-operator/values.yaml (3 hunks)
🧰 Additional context used
🪛 YAMLlint (1.35.1)
packages/system/etcd-operator/charts/etcd-operator/templates/workload/vpa.yml

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

(syntax)

🔇 Additional comments (7)
packages/system/etcd-operator/charts/etcd-operator/Chart.yaml (1)

2-5: Chart version bump
The appVersion and chart version fields have been correctly incremented to 0.4.2 to align with the VPA support changes and release.

packages/system/etcd-operator/charts/etcd-operator/templates/workload/deployment.yml (2)

48-53: Conditional resource block for etcd-operator when VPA is enabled
The Helm template now omits the static resources section for the etcd-operator container if etcdOperator.vpa.enabled is true. This aligns with standard VPA best practices and looks correct.


92-97: Conditional resource block for kube-rbac-proxy when VPA is enabled
Similarly, the template skips the resources section for the kube-rbac-proxy container under kubeRbacProxy.vpa.enabled. The logic is consistent with the etcd-operator block.

packages/system/etcd-operator/charts/etcd-operator/values.yaml (3)

87-95: Verify default VPA enablement
You’ve set etcdOperator.vpa.enabled: true by default, which will remove all static resource requests/limits unless users opt out. Confirm this is the intended backward‑compatible default.


154-162: Verify default VPA enablement for kubeRbacProxy
The kubeRbacProxy.vpa.enabled flag is also on by default. Please verify that enabling VPA out‑of‑the‑box for the proxy is acceptable for existing deployments.


203-206: Global VPA updatePolicy default
The root‑level vpa.updatePolicy is set to "Auto", matching the template’s default. This looks good to drive the VPA updateMode.

packages/system/etcd-operator/charts/etcd-operator/templates/workload/vpa.yml (1)

1-41: New VPA manifest template
This template correctly wraps the VerticalPodAutoscaler resource in an if block checking either etcdOperator.vpa.enabled or kubeRbacProxy.vpa.enabled. Resource policies for each container are injected dynamically.
Please validate the rendered YAML for proper indentation and whitespace control ({{- ... }} vs {{ ... }}) to avoid templating‑induced syntax issues. The reported YAMLlint error can be safely ignored for Helm chart templates.

🧰 Tools
🪛 YAMLlint (1.35.1)

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

(syntax)

@@ -51,4 +61,5 @@
| serviceAccount.annotations | object | `{}` | Annotations to add to the service account |
| serviceAccount.create | bool | `true` | Specifies whether a service account should be created |
| tolerations | list | `[]` | ref: https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/ |
| vpa.updatePolicy | string | `"Auto"` | |
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Provide description for vpa.updatePolicy
The vpa.updatePolicy entry doesn’t describe allowed values or behavior. Please add text like “Controls VPA update mode (e.g., ‘Auto’, ‘Initial’, ‘Off’)”.

Comment on lines +29 to +33
| etcdOperator.vpa.enabled | bool | `true` | |
| etcdOperator.vpa.maxAllowed.cpu | string | `"1000m"` | |
| etcdOperator.vpa.maxAllowed.memory | string | `"1Gi"` | |
| etcdOperator.vpa.minAllowed.cpu | string | `"100m"` | |
| etcdOperator.vpa.minAllowed.memory | string | `"128Mi"` | |
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add descriptions for etcdOperator.vpa settings
The new table entries for etcdOperator.vpa.enabled, etcdOperator.vpa.minAllowed.*, and etcdOperator.vpa.maxAllowed.* lack user-facing descriptions. Please provide concise descriptions such as “Enable VPA for etcd-operator”, “Minimum resources VPA may allocate”, and “Maximum resources VPA may allocate”.

Comment on lines +49 to +53
| kubeRbacProxy.vpa.enabled | bool | `true` | |
| kubeRbacProxy.vpa.maxAllowed.cpu | string | `"500m"` | |
| kubeRbacProxy.vpa.maxAllowed.memory | string | `"256Mi"` | |
| kubeRbacProxy.vpa.minAllowed.cpu | string | `"50m"` | |
| kubeRbacProxy.vpa.minAllowed.memory | string | `"64Mi"` | |
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add descriptions for kubeRbacProxy.vpa settings
Likewise, the kubeRbacProxy.vpa.* table entries need clear descriptions (e.g., “Enable VPA for kube-rbac-proxy”, “Min/Max resource bounds for proxy VPA”).

Comment on lines +134 to 164
},
"vpa": {
"properties": {
"enabled": {
"type": "boolean"
},
"maxAllowed": {
"properties": {
"cpu": {
"type": "string"
},
"memory": {
"type": "string"
}
},
"type": "object"
},
"minAllowed": {
"properties": {
"cpu": {
"type": "string"
},
"memory": {
"type": "string"
}
},
"type": "object"
}
},
"type": "object"
}
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Extract and DRY the VPA schema for etcdOperator
The block defining "vpa" under etcdOperator duplicates the same structure used elsewhere. Consider moving this schema into a shared definition (e.g. under "$defs") and referencing it with $ref to avoid repetition and simplify future updates.

Copy link
Member
@kvaps kvaps left a comment

Choose a reason for hiding this comment

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

LGTM

@kvaps kvaps merged commit 16ee0f2 into main Apr 23, 2025
9 of 11 checks passed
@kvaps kvaps deleted the (platform)--add-vpa-for-cozy-etcd-operator branch April 23, 2025 11:58
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.

2 participants
0