Skip to content

Allow setting temporary max_instances overrides #4078

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nemacysts
Copy link
Member

Just as setting temporary min_instances overrides is useful, so would being able to do the same for max_instances.

Just as setting temporary min_instances overrides is useful, so would
being able to do the same for max_instances.
@nemacysts nemacysts requested a review from a team as a code owner June 9, 2025 18:48
@@ -156,19 +156,24 @@ def set_autoscaling_override(request):

json_body = request.swagger_data.get("json_body", {})
min_instances_override = json_body.get("min_instances")
max_instances_override = json_body.get("max_instances")
Copy link
Member

Choose a reason for hiding this comment

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

Nit, but should we add max_instances to the docstring?

if not expire_after:
raise ApiFailure("expire_after is required", 400)

max_instances = instance_config.get_max_instances()
min_instances = min_instances_override or instance_config.get_min_instances()
max_instances = max_instances_override or instance_config.get_max_instances()
if max_instances is None:
Copy link
Member

Choose a reason for hiding this comment

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

Is this check dead given the previous validation?

Copy link
Member

Choose a reason for hiding this comment

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

This may or may not be based on my misunderstanding of how this falls back...

Copy link
Member Author

Choose a reason for hiding this comment

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

yes and no - max_instances can still be None here: but I think we need to move this around a bit so that we can't use this command to start autoscaling something that's not autoscaled (since most of the time we don't actually want cpu autoscaling)

...and i also just realized that maybe I should add an cleanup cronjob first or something - if you set a min_instances override N days in the past and then go to set a max_instances override later one, the min_instances override will kick in as well.

@@ -75,6 +75,14 @@ def add_subparser(subparsers):
else autoscale_parser.error("Minimum instances must be >= 1"),
default=None,
)
override_group.add_argument(
Copy link
Member

Choose a reason for hiding this comment

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

Do we want a max max to avoid some edge case where a typo + some bad behaviour overloads a cluster? Or is that too paranoid?

Copy link
Member Author

Choose a reason for hiding this comment

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

we talked a little bit in our 1:1 - a max max is probably fine to obviate, but we might want some sort of similar concept for min (probably just ask for confirmation rather than hard-block things)

if int(x) >= 1
else autoscale_parser.error("Maximum instances must be >= 1"),
default=None,
)
override_group.add_argument(
Copy link
Member

Choose a reason for hiding this comment

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

Super nit, but --for applies to both set-min and set-max now, right?

@nemacysts nemacysts marked this pull request as draft June 12, 2025 17:40
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