Skip to content

feat: allow maxReplicas=0 to completely disable workload - #3

Merged
dittops merged 1 commit into
mainfrom
feat/scale-to-zero
Jan 26, 2026
Merged

dittops merged 1 commit into
mainfrom
feat/scale-to-zero

Conversation

@dittops

@dittops dittops commented Jan 26, 2026

Copy link
Copy Markdown
Member

Setting maxReplicas to 0 acts as a manual "disable switch" to immediately scale to 0 and free all resources. Useful for maintenance windows or cost saving during off-hours.

Setting maxReplicas to 0 acts as a manual "disable switch" to
immediately scale to 0 and free all resources. Useful for
maintenance windows or cost saving during off-hours.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello @dittops, 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 introduces a significant enhancement to the BudAIScaler by allowing the maxReplicas field to be set to 0. This change provides users with a direct mechanism to completely disable a workload, effectively acting as a manual switch to scale down to zero replicas and release all allocated resources. This functionality is particularly useful for managing maintenance windows or optimizing costs during off-peak hours.

Highlights

  • MaxReplicas field modification: The MaxReplicas field in BudAIScalerSpec has been updated to allow a minimum value of 0, enabling complete workload disablement.
  • Documentation update: The description for MaxReplicas has been enhanced to clarify that setting it to 0 will completely disable the workload and free all associated resources.
  • CRD synchronization: The Custom Resource Definition (CRD) for BudAIScaler has been updated to reflect the new MaxReplicas validation rule and its expanded description.

🧠 New Feature in Public Preview: You can now enable Memory 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-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 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 counter productive. You can react with 👍 and 👎 on @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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

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

@dittops
dittops merged commit 1037191 into main Jan 26, 2026
5 checks passed

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request introduces a feature to allow setting maxReplicas: 0 to disable a workload. The changes in the BudAIScaler type definition and the main CRD YAML are correct. However, the implementation is incomplete. There is a critical issue in the controller's validation logic that prevents maxReplicas: 0 from being used. Additionally, several other CRD definition files in the repository have not been updated to reflect this change, which will lead to inconsistent behavior and validation errors. I've left a detailed comment with the required fixes.

// Set to 0 to completely disable the workload and free all resources.
// +kubebuilder:validation:Required
// +kubebuilder:validation:Minimum=1
// +kubebuilder:validation:Minimum=0

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

critical

While changing the validation here is correct, the implementation of this feature seems incomplete. The PR will not work as intended because of issues in other files:

  1. Controller Validation: The validation logic in the controller has not been updated to allow maxReplicas: 0. The reconciliation will fail for any BudAIScaler with maxReplicas: 0.
    In pkg/controller/budaiscaler/budaiscaler_controller.go, line 206:

    if scaler.Spec.MaxReplicas < 1 {
        return fmt.Errorf("maxReplicas must be at least 1")
    }

    This check should be changed to if scaler.Spec.MaxReplicas < 0 to allow 0 as a valid value.

  2. Inconsistent CRD Definitions: The CRD definitions in other parts of the repository have not been updated. This will cause validation failures at the API server level if those definitions are used.

    • config/crd/bases/scaler.bud.studio_budaiscalers.yaml
    • charts/scaler/crds/scaler.bud.studio_budaiscalers.yaml

    Both files still have minimum: 1 for maxReplicas. Please ensure all generated files are updated, perhaps by running make manifests or a similar command.

Without these changes, the feature to disable workloads with maxReplicas: 0 is not functional.

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.

1 participant