8000 [monitoring] add vpa for users k8s clusters by klinch0 · Pull Request #806 · cozystack/cozystack · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[monitoring] add vpa for users k8s clusters #806

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 14, 2025

Conversation

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

Summary by CodeRabbit

  • Chores

    • Updated the application version to 0.18.0 with refined version tracking for improved deployment clarity.
  • New Features

    • Enhanced the monitoring agents integration with updated dependency management.
    • Introduced new deployment configurations for the vertical pod autoscaler and its custom resource definitions, offering customizable override options and improved reconciliation strategies.

@klinch0 klinch0 requested review from kvaps and lllamnyp as code owners April 11, 2025 11:52
Copy link
Contributor
coderabbitai bot commented Apr 11, 2025

Walkthrough

The changes update the Kubernetes Helm chart version from 0.17.1 to 0.18.0 and adjust HelmRelease dependencies. The monitoring agents configuration now removes a dependency on a legacy component and adds one for vertical pod autoscaler CRDs. Additionally, new HelmRelease configurations have been introduced for both the vertical pod autoscaler and its CRDs. A new section to override vertical pod autoscaler values has been added to the values file, and the versions map has been updated to reflect these changes.

Changes

File(s) Change Summary
packages/.../Chart.yaml Updated chart version from 0.17.1 to 0.18.0.
packages/.../helmreleases/monitoring-agents.yaml Removed HelmRelease dependency on {{ .Release.Name }}-cilium; added dependency on {{ .Release.Name }}-vertical-pod-autoscaler-crds.
packages/.../helmreleases/vertical-pod-autoscaler-crds.yaml
packages/.../helmreleases/vertical-pod-autoscaler.yaml
Added new HelmRelease configurations for vertical pod autoscaler CRDs and the vertical pod autoscaler.
packages/.../values.yaml Introduced new verticalPodAutoscaler section with parameter valuesOverride in the addons configuration.
packages/.../versions_map Updated version entry for kubernetes 0.17.1 (from HEAD to specific commit) and added a new entry for kubernetes 0.18.0 HEAD.

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant C as Chart
    participant MA as Monitoring Agents
    participant VCR as VPA CRDs
    participant VPA as Vertical Pod Autoscaler

    U->>C: Initiate deployment
    C->>MA: Deploy monitoring agents
    MA->>VCR: Trigger VPA CRDs dependency
    VCR->>VPA: Provide CRDs for deployment
    VPA->>C: Complete VPA deployment
Loading

Poem

I'm a hopping rabbit, swift and spry,
Chart version lifted high to the sky.
Dependencies shift with each little beat,
CRDs and VPA now join the fleet.
I dance with joy in YAML delight,
Celebrating change from morning till night!

Tip

⚡💬 Agentic Chat (Pro Plan, General Availability)
  • We're introducing multi-step agentic chat in review comments and issue comments, within and outside of PR's. This feature enhances review and issue discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments and add commits to existing pull requests.

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.

Signed-off-by: kklinch0 <kklinch0@gmail.com>
@klinch0 klinch0 force-pushed the (monitoring)--add-vpa-to-users-k8s-clusters branch from eab6c1b to da81009 Compare April 11, 2025 11:52
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: 0

🧹 Nitpick comments (4)
packages/apps/kubernetes/values.yaml (1)

73-78: Consider adding an enabled parameter for consistency.

All other addons have an enabled parameter, but this one is missing it. If the VerticalPodAutoscaler's enablement is controlled by monitoringAgents (as suggested by related changes), consider adding a comment to make this dependency clear, or add a separate enabled flag for consistency with other addons.

  verticalPodAutoscaler:
+   ## @param addons.verticalPodAutoscaler.enabled Enable Vertical Pod Autoscaler
+   ##
+   enabled: false
    ## @param addons.verticalPodAutoscaler.valuesOverride Custom values to override
    ##
    valuesOverride: {}
packages/apps/kubernetes/templates/helmreleases/vertical-pod-autoscaler-crds.yaml (2)

1-1: Helm Templating and YAML Lint Configuration
The use of Helm templating on line 1 (i.e. {{- if .Values.addons.monitoringAgents.enabled }}) is expected. However, YAML linters may flag this pattern as a syntax error. Please ensure your linter is configured to ignore or properly parse Helm directives.

🧰 Tools
🪛 YAMLlint (1.35.1)

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

(syntax)


34-41: Conditional Dependency Block Formatting
The dependency block (lines 34–41) first conditionally adds a dependency on the release itself (lines 35–38) and then unconditionally includes the dependency on {{ .Release.Name }}-cilium (lines 39–40). The formatting appears correct for Helm templating, but please double-check that the YAML indentation renders as expected once templating is processed.

packages/apps/kubernetes/templates/helmreleases/vertical-pod-autoscaler.yaml (1)

62-69: Dependency Configuration
In the dependsOn section (lines 62–69), a dependency is conditionally added for the current release (lines 63–66) and then unconditionally for {{ .Release.Name }}-monitoring-agents (lines 67–68). This dependency ordering aligns with the updated deployment requirements. Verify that this meets your release orchestration strategy.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between d7914ff and da81009.

📒 Files selected for processing (6)
  • packages/apps/kubernetes/Chart.yaml (1 hunks)
  • packages/apps/kubernetes/templates/helmreleases/monitoring-agents.yaml (1 hunks)
  • packages/apps/kubernetes/templates/helmreleases/vertical-pod-autoscaler-crds.yaml (1 hunks)
  • packages/apps/kubernetes/templates/helmreleases/vertical-pod-autoscaler.yaml (1 hunks)
  • packages/apps/kubernetes/values.yaml (1 hunks)
  • packages/apps/versions_map (1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.35.1)
packages/apps/kubernetes/templates/helmreleases/vertical-pod-autoscaler-crds.yaml

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

(syntax)

packages/apps/kubernetes/templates/helmreleases/vertical-pod-autoscaler.yaml

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

(syntax)

🔇 Additional comments (14)
packages/apps/kubernetes/Chart.yaml (1)

19-19: Version increment looks appropriate.

The increment from 0.17.1 to 0.18.0 correctly follows semantic versioning for the addition of new functionality (Vertical Pod Autoscaler).

packages/apps/versions_map (1)

60-61: Version mapping updated correctly.

The change properly pins the previous version (0.17.1) to a specific commit and adds the new version (0.18.0) as HEAD, following the established pattern in this file.

packages/apps/kubernetes/templates/helmreleases/monitoring-agents.yaml (1)

43-44:

✅ Verification successful

Dependency update for VPA integration.

The addition of a dependency on the vertical-pod-autoscaler-crds is appropriate for the monitoring agents, as it ensures that the VPA CRDs are installed before the monitoring agents are deployed.


🏁 Script executed:

#!/bin/bash
# Description: Verify the existence of vertical-pod-autoscaler-crds HelmRelease template

# Look for the vertical-pod-autoscaler-crds.yaml file in the templates directory
fd --type f "vertical-pod-autoscaler-crds.yaml" packages/apps/kubernetes/templates/helmreleases/

# Check for the vertical-pod-autoscaler.yaml file as well
fd --type f "vertical-pod-autoscaler.yaml" packages/apps/kubernetes/templates/helmreleases/

Length of output: 347


Verified VPA Integration Dependency

The verification confirms that the file packages/apps/kubernetes/templates/helmreleases/vertical-pod-autoscaler-crds.yaml exists (along with vertical-pod-autoscaler.yaml), ensuring that the VPA CRDs will be installed before the monitoring agents are deployed. The dependency update in the monitoring-agents.yaml file (lines 43–44) is therefore correct.

packages/apps/kubernetes/templates/helmreleases/vertical-pod-autoscaler-crds.yaml (4)

2-10: Metadata and Basic Specification
The metadata (lines 4–8) and top-level specification (lines 2–10) are correctly defined. The chart reference and repository details follow the project conventions.


11-20: Chart Source and KubeConfig Settings
The chart details (lines 12–19) along with the kubeConfig secret reference (lines 20–23) are correctly set. This configuration aligns with the standard HelmRelease deployment patterns in this repository.


24-32: Namespace and Remediation Configuration
The target and storage namespaces (lines 24–25) and the install/upgrade sections (lines 26–32) are configured to automatically create namespaces with unlimited retry remediation (retries: -1). Verify that using unlimited retries is an intentional design decision for critical deployments.


41-42: Closing the Conditional Block
The conditional block started on line 1 is correctly closed with {{- end }}. Ensure that the entire content is correctly encapsulated by this block as intended.

packages/apps/kubernetes/templates/helmreleases/vertical-pod-autoscaler.yaml (7)

1-3: Variable Setup and Conditional Checks
The template begins by looking up the namespace ($myNS) and extracting the "namespace.cozystack.io/monitoring" annotation into $targetTenant. Consider using Helm’s default function to provide a fallback value in case the annotation is missing, which can help avoid potential nil errors.

🧰 Tools
🪛 YAMLlint (1.35.1)

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

(syntax)


4-10: Metadata and Label Consistency
The metadata block (lines 6–10) is well formed. One note: while the repository label uses cozystack.io/repository, the target cluster label is set under coztstack.io/target-cluster-name. Please verify that this slight domain variation is intentional and not a typographical error.


11-27: Chart Details and KubeConfig
The chart specification (lines 11–21) and the kubeConfig setup (lines 22–25) are correctly defined and mirror the patterns used in similar configurations.


28-34: Installation and Upgrade Settings
The install and upgrade sections (lines 28–34) include namespace creation and unlimited retry settings (retries: -1). Confirm that these settings match your operational requirements, as unlimited retries might complicate troubleshooting in failure scenarios.


35-55: Vertical Pod Autoscaler Values Configuration
The nested values block (lines 35–55) provides detailed configuration for the vertical pod autoscaler recommender, including extra arguments and resource constraints. Ensure that the metric query in metric-for-pod-labels (line 45), which embeds Helm template variables, is correctly formed and returns the expected Prometheus data.


56-61: Conditional Values Override Block
The conditional block (lines 56–61) injects override values sourced from a secret when .Values.addons.verticalPodAutoscaler.valuesOverride is enabled. Please confirm that the referenced secret exists and that the key values contains the expected configuration data.


69-70: End of Conditional Block
The final closing ({{- end }} on line 69) ensures that the configuration is only applied when .Values.addons.monitoringAgents.enabled is true. This is correctly implemented.

@klinch0 klinch0 merged commit 685e50b into main Apr 14, 2025
5 of 6 checks passed
@klinch0 klinch0 deleted the (monitoring)--add-vpa-to-users-k8s-clusters branch April 14, 2025 11:07
kvaps pushed a commit that referenced this pull request Apr 15, 2025
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Chores**
- Updated the application version to 0.18.0 with refined version
tracking for improved deployment clarity.
  
- **New Features**
- Enhanced the monitoring agents integration with updated dependency
management.
- Introduced new deployment configurations for the vertical pod
autoscaler and its custom resource definitions, offering customizable
override options and improved reconciliation strategies.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
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.

2 participants
0