Skip to content

feat(vpa): separate-crds - #781

Merged
klinch0 merged 1 commit into
mainfrom
feat(vpa)--separate-crds
Apr 10, 2025
Merged

feat(vpa): separate-crds#781
klinch0 merged 1 commit into
mainfrom
feat(vpa)--separate-crds

Conversation

@klinch0

@klinch0 klinch0 commented Apr 9, 2025

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features
    • Improved autoscaling deployment by integrating an additional component for managing custom resource definitions.
    • Enhanced dependency management now ensures critical prerequisites are deployed in the correct order.
    • Introduced an automated update mechanism to keep resource definitions current.
    • Added a new configuration option, giving users the flexibility to enable or disable custom resource definitions as needed.
    • Introduced two new Custom Resource Definitions: VerticalPodAutoscalerCheckpoint and VerticalPodAutoscaler.

@coderabbitai

coderabbitai Bot commented Apr 9, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

The changes add a new release configuration for the vertical-pod-autoscaler-crds component in both the paas-full.yaml and paas-hosted.yaml bundles. The existing monitoring-agents release has been updated to include a dependency on the new CRDs release. Additionally, a new Helm chart, Makefile, and CRD templates have been added under the system directory, while a new configuration option (crds.enabled: false) has been introduced in the values file for the vertical pod autoscaler.

Changes

File(s) Change Summary
packages/core/.../paas-full.yaml, packages/core/.../paas-hosted.yaml Added new release vertical-pod-autoscaler-crds with properties (name, release name, chart, namespace, privileged, dependsOn: [cilium, kubeovn]) and updated the monitoring-agents release to depend on this new release.
packages/system/.../Chart.yaml New Helm chart file for cozy-vertical-pod-autoscaler-crds with API version v2 and a placeholder version 0.0.0.
packages/system/.../Makefile New Makefile exporting NAME and NAMESPACE variables and defining an update target to download the CRD YAML via curl.
packages/system/.../templates/vpa-v1-crd-gen.yaml Added two CRDs: VerticalPodAutoscalerCheckpoint and VerticalPodAutoscaler, defining properties for checkpoint storage and autoscaler configuration.
packages/system/vertical-pod-autoscaler/values.yaml Introduced a new configuration option crds.enabled set to false under the vertical pod autoscaler section.

Sequence Diagram(s)

sequenceDiagram
    participant D as Deployment Manager
    participant C as Cilium
    participant K as Kubeovn
    participant CR as VPA-CRDs
    participant MA as Monitoring Agents
    participant V as VPA

    D->>C: Ensure dependency is installed
    D->>K: Ensure dependency is installed
    D->>CR: Deploy CRDs (waiting on C & K)
    D->>MA: Deploy Monitoring Agents
    D->>V: Deploy VPA (requires MA and CR)
Loading

Poem

I’m hopping through code in the moonlight so bright,
New CRDs and releases making everything right.
Dependencies set like carrots in a row,
A clever new helm chart helps our project grow.
With a skip and a hop, I celebrate this flight,
CodeRabbit’s magic shining through the night! 🐰✨


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 plan to trigger planning for file edits and PR creation.
  • @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.

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

Actionable comments posted: 0

🧹 Nitpick comments (7)
packages/system/vertical-pod-autoscaler/values.yaml (1)

2-3: New CRDs Configuration Option Added

The addition of the crds.enabled: false option under vertical-pod-autoscaler provides a clean and explicit way to control the deployment behavior of CRDs. Make sure that any component consuming this configuration properly handles the flag.

packages/system/vertical-pod-autoscaler-crds/Makefile (1)

6-7: Enhance the CRD Update Target

The Makefile target for updating the CRD template is well structured. However, to improve robustness, consider adding the --fail flag to the curl command so that download errors are caught and reported.

-curl -o ./templates/vpa-v1-crd-gen.yaml https://raw.githubusercontent.com/kubernetes/autoscaler/refs/heads/master/vertical-pod-autoscaler/deploy/vpa-v1-crd-gen.yaml
+curl --fail -o ./templates/vpa-v1-crd-gen.yaml https://raw.githubusercontent.com/kubernetes/autoscaler/refs/heads/master/vertical-pod-autoscaler/deploy/vpa-v1-crd-gen.yaml
packages/core/platform/bundles/paas-hosted.yaml (1)

258-263: New CRDs Release Configuration – Privileged Mode Review

The new vertical-pod-autoscaler-crds release is defined correctly with dependencies on cilium and kubeovn. However, it is marked as privileged: true. Verify whether elevated privileges are truly necessary for deploying CRDs, as following the principle of least privilege is recommended.

packages/core/platform/bundles/paas-full.yaml (1)

402-407: Review Privileged Flag on CRDs Release

Similar to the hosted bundle, the vertical-pod-autoscaler-crds release in this file is also configured with privileged: true. Consider evaluating if this elevated security context is necessary solely for the CRD definitions.

packages/system/vertical-pod-autoscaler-crds/templates/vpa-v1-crd-gen.yaml (3)

1-121: Comprehensive CRD for VerticalPodAutoscalerCheckpoint.
The definition for the VerticalPodAutoscalerCheckpoint CRD is very detailed and follows Kubernetes API conventions. The schema properly declares the metadata, spec, and status sections and includes helpful descriptions and types.

Consider generating or validating these schemas via automated tooling (e.g., controller-gen) to ease long-term maintenance if the API evolves.


78-80: Typo in Property Description.
In the description for the firstSampleStart field, "fist sample" appears instead of "first sample." A quick fix here will improve clarity.


585-835: Properly Marked Deprecated v1beta2 Version.
The deprecated v1beta2 version of the VerticalPodAutoscaler CRD is correctly annotated with a deprecation warning and its served/storage flags set to false. This is a sound strategy to guide users toward the more stable v1 version. Consider planning for its removal in a future release once migration is confirmed.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 785898b and 4b0a1d3.

📒 Files selected for processing (6)
  • packages/core/platform/bundles/paas-full.yaml (1 hunks)
  • packages/core/platform/bundles/paas-hosted.yaml (1 hunks)
  • packages/system/vertical-pod-autoscaler-crds/Chart.yaml (1 hunks)
  • packages/system/vertical-pod-autoscaler-crds/Makefile (1 hunks)
  • packages/system/vertical-pod-autoscaler-crds/templates/vpa-v1-crd-gen.yaml (1 hunks)
  • packages/system/vertical-pod-autoscaler/values.yaml (1 hunks)
🔇 Additional comments (5)
packages/system/vertical-pod-autoscaler-crds/Chart.yaml (1)

1-3: Helm Chart Configuration Looks Correct

The Chart file is concise and correctly defines a Helm v2 chart with a placeholder version. Ensure that your build process reliably replaces the placeholder version as intended.

packages/core/platform/bundles/paas-hosted.yaml (1)

251-257: Update to Vertical Pod Autoscaler Dependency

The vertical-pod-autoscaler release has been updated to include a dependency on vertical-pod-autoscaler-crds in its dependsOn list. This change should ensure that the CRDs are deployed before the autoscaler.

packages/core/platform/bundles/paas-full.yaml (1)

395-401: Consistent Update for Vertical Pod Autoscaler Dependency

The vertical-pod-autoscaler release now depends on vertical-pod-autoscaler-crds along with monitoring-agents. This update aligns with the separation-of-concerns introduced in this PR. Please ensure that this new dependency order is intentional across all deployment bundles.

packages/system/vertical-pod-autoscaler-crds/templates/vpa-v1-crd-gen.yaml (2)

222-224: Effective Use of Document Separator.
The use of the YAML document separator (--- on line 222) clearly divides the two CRD definitions, enhancing readability and logical structure.


223-584: Robust VerticalPodAutoscaler CRD (v1) Definition.
The VerticalPodAutoscaler CRD for version v1 is defined with extensive details—including additional printer columns, explicit enumeration for update modes, and a well-structured schema for both spec and status sections. Everything appears compliant with Kubernetes API conventions.

@klinch0
klinch0 force-pushed the feat(vpa)--separate-crds branch from d21bc81 to 4efd842 Compare April 9, 2025 22:41

@kvaps Andrei Kvapil (kvaps) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@kvaps Andrei Kvapil (kvaps) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please add vertical-pod-autoscaler-crds dependency for monitoring-agents

Signed-off-by: kklinch0 <kklinch0@gmail.com>
@klinch0
klinch0 force-pushed the feat(vpa)--separate-crds branch from 4efd842 to c31a771 Compare April 10, 2025 07:57

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/system/vertical-pod-autoscaler-crds/templates/vpa-v1-crd-gen.yaml (1)

1-222: New CRD: VerticalPodAutoscalerCheckpoint

This new CustomResourceDefinition for VerticalPodAutoscalerCheckpoint is comprehensive and leverages OpenAPI v3 schema validation effectively. A couple of points for improvement:

  • The v1 version is marked as served and storage while the v1beta2 version is not; if v1beta2 is not intended for active use, consider adding an explicit deprecation note.
  • There is a typographical error in the description for the firstSampleStart property ("fist sample" should be "first sample").
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 4efd842 and c31a771.

📒 Files selected for processing (6)
  • packages/core/platform/bundles/paas-full.yaml (2 hunks)
  • packages/core/platform/bundles/paas-hosted.yaml (2 hunks)
  • packages/system/vertical-pod-autoscaler-crds/Chart.yaml (1 hunks)
  • packages/system/vertical-pod-autoscaler-crds/Makefile (1 hunks)
  • packages/system/vertical-pod-autoscaler-crds/templates/vpa-v1-crd-gen.yaml (1 hunks)
  • packages/system/vertical-pod-autoscaler/values.yaml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • packages/system/vertical-pod-autoscaler/values.yaml
  • packages/system/vertical-pod-autoscaler-crds/Makefile
  • packages/system/vertical-pod-autoscaler-crds/Chart.yaml
  • packages/core/platform/bundles/paas-hosted.yaml
🔇 Additional comments (3)
packages/core/platform/bundles/paas-full.yaml (2)

114-120: Updated Dependency for monitoring-agents Release

The dependency list for the monitoring-agents release has been updated to include vertical-pod-autoscaler-crds and remove cilium and kubeovn. This change appears to be intentional for ensuring that the new CRDs are deployed before monitoring components run.


402-408: New Release Configuration: vertical-pod-autoscaler-crds

A new release configuration for vertical-pod-autoscaler-crds is added with the expected fields: releaseName, chart, namespace, privileged, and a dependency on [cilium, kubeovn]. Please verify that these dependency choices and the chosen namespace align with the overall deployment order and environment consistency.

packages/system/vertical-pod-autoscaler-crds/templates/vpa-v1-crd-gen.yaml (1)

223-835: New CRD: VerticalPodAutoscaler

The CRD defining VerticalPodAutoscaler is detailed and follows Kubernetes API standards. Key points include:

  • The inclusion of additional printer columns improves usability when inspecting resources.
  • The v1 version is properly set as served and storage, with the v1beta2 version clearly marked as deprecated and accompanied by a deprecation warning.
  • The schema makes good use of OpenAPI validations and flexible types (via x-kubernetes-preserve-unknown-fields) where necessary.

Overall, this definition aligns well with best practices.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants