Skip to content

Service autoscaling on both ram and cpu supported#474

Merged
ishaankalra merged 1 commit into
masterfrom
service-scale-on-both
Aug 28, 2025
Merged

Service autoscaling on both ram and cpu supported#474
ishaankalra merged 1 commit into
masterfrom
service-scale-on-both

Conversation

@anujhydrabadi

@anujhydrabadi anujhydrabadi commented Aug 28, 2025

Copy link
Copy Markdown
Collaborator

Description

Related issues

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist

  • I have created feat/bugfix branch out of develop branch
  • Code passes linting/formatting checks
  • Changes to resources have been tested in our dev environments
  • I have made corresponding changes to the documentation

Testing

Reviewer instructions

Summary by CodeRabbit

  • New Features
    • Added a new autoscaling option to scale based on both CPU and RAM.
    • Updated scaling settings UI to show CPU threshold when scaling on CPU or both, and RAM threshold when scaling on RAM or both.
    • Enables more flexible autoscaling configurations by combining resource signals.

@coderabbitai

coderabbitai Bot commented Aug 28, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

Adds a new BOTH option to autoscaling.scaling_on in deployment and statefulset facets. Updates UI visibility/validation so cpu_threshold shows for CPU/BOTH and ram_threshold shows for RAM/BOTH. No other fields or logic are changed.

Changes

Cohort / File(s) Summary
Autoscaling schema updates
modules/service/deployment/0.1/facets.yaml, modules/service/statefulset/0.1/facets.yaml
Add enum value BOTH to spec.runtime.autoscaling.scaling_on. Update x-ui-visible-if for cpu_threshold to trigger on CPU and BOTH; update x-ui-visible-if for ram_threshold to trigger on RAM and BOTH.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant User
  participant UI
  participant FacetSchema as Facet Schema

  User->>UI: Select scaling_on (CPU | RAM | BOTH)
  UI->>FacetSchema: Validate visibility rules
  alt scaling_on == CPU or BOTH
    UI->>User: Show cpu_threshold input
  end
  alt scaling_on == RAM or BOTH
    UI->>User: Show ram_threshold input
  end
  note over UI,FacetSchema: BOTH enables both threshold inputs
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I twitch my ears at BOTH’s debut,
CPU and RAM—now I watch two.
In fields of YAML, neat and bright,
Thresholds pop in shared daylight.
Hop, hop—schemas line in rows,
Scaling where the traffic grows. 🐇🚀


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between fd0908f and 7e43809.

📒 Files selected for processing (2)
  • modules/service/deployment/0.1/facets.yaml (3 hunks)
  • modules/service/statefulset/0.1/facets.yaml (3 hunks)
🔇 Additional comments (5)
modules/service/statefulset/0.1/facets.yaml (2)

559-564: Confirm support for conditional required logic
I didn’t find any existing x-ui-required-if usages in the repo—our current schema only recognizes x-ui-visible-if. Please verify that your UI framework supports x-ui-required-if. If it doesn’t, enforce “cpu_threshold” under the JSON Schema if/then construct or an equivalent mechanism to make it required when spec.runtime.autoscaling.scaling_on is CPU or BOTH.


572-577: Require RAM threshold when scaling_on is RAM or BOTH & confirm UI support for x-ui-required-if
Mirror the CPU threshold rule by adding the following to ram_threshold to prevent invalid BOTH configurations, then verify that the UI layer honors x-ui-required-if:

ram_threshold:
  x-ui-required-if:
    field: spec.runtime.autoscaling.scaling_on
    values:
    - RAM
    - BOTH
modules/service/deployment/0.1/facets.yaml (3)

544-551: Ensure HPA template supports "BOTH" for dual metrics

  • Verified scaling_on enum includes “BOTH” in the deployment UI schema (facets.yaml lines 559–572).
  • Manually confirm the deployment scaler/HPA renderer or template correctly emits both CPU and RAM metric sections when “BOTH” is selected.

569-573: Confirm or Add RAM Threshold Requirement

  • Add x-ui-required-if for RAM/BOTH under the size field to mirror CPU’s pattern if the UI supports it.
  • Verify that x-ui-required-if is recognized by the form-renderer (exists elsewhere in facets.yaml or in UI schema).

559-562: Confirm x-ui-required-if support
No occurrences of x-ui-required-if exist in the repository; verify that the UI framework recognizes and enforces this extension before adding it.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch service-scale-on-both

🪧 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.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbit in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbit 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:
    • @coderabbit gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbit read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbit help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbit ignore or @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbit summary or @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbit or @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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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.

@ishaankalra
ishaankalra merged commit 968b0a6 into master Aug 28, 2025
2 checks passed
@ishaankalra
ishaankalra deleted the service-scale-on-both branch August 28, 2025 12:58
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