Skip to content
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

in Job.Scale, ensure that new count is within [min,max] configured in scaling policy #9761

Merged
merged 4 commits into from
Jan 8, 2021

Conversation

cgbaker
Copy link
Contributor

@cgbaker cgbaker commented Jan 8, 2021

the Job.Scale endpoint did not enforce min/max from the group scaling policy. this PR addresses that with a simple check. unit tested the RPC; I had to make a small tweak to one of the api scaling tests because it was previously (incorrectly) scaling outside of bounds.

resolves #9758

@cgbaker cgbaker requested a review from lgfa29 January 8, 2021 19:25
@vercel vercel bot temporarily deployed to Preview – nomad January 8, 2021 19:26 Inactive
@vercel vercel bot temporarily deployed to Preview – nomad-storybook-and-ui January 8, 2021 19:26 Inactive
@vercel vercel bot temporarily deployed to Preview – nomad-storybook-and-ui January 8, 2021 19:38 Inactive
@vercel vercel bot temporarily deployed to Preview – nomad January 8, 2021 19:38 Inactive
@@ -53,7 +53,7 @@ func testJobWithScalingPolicy() *Job {
job.TaskGroups[0].Scaling = &ScalingPolicy{
Policy: map[string]interface{}{},
Min: int64ToPtr(1),
Max: int64ToPtr(1),
Max: int64ToPtr(5),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixing the bug meant that a test which had previously (incorrectly) passed started to fail. this makes room for that test to properly succeed.

Copy link
Contributor

@lgfa29 lgfa29 left a comment

Choose a reason for hiding this comment

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

LGTM 👍

$ nomad job scale example 1
Error submitting scaling request: Unexpected response code: 400 (new scaling count cannot be less than the scaling policy minimum)

$ nomad job scale example 100
Error submitting scaling request: Unexpected response code: 400 (new scaling count cannot be greater than the scaling policy maximum)

A small suggestion would be to have the min/max value in the error message (and maybe call it group count instead of scaling count?)

@vercel vercel bot temporarily deployed to Preview – nomad-storybook-and-ui January 8, 2021 21:13 Inactive
@vercel vercel bot temporarily deployed to Preview – nomad January 8, 2021 21:13 Inactive
@cgbaker cgbaker merged commit d234000 into master Jan 8, 2021
@cgbaker cgbaker deleted the b-9758-enforce-policy-on-scale branch January 8, 2021 21:49
@github-actions
Copy link

github-actions bot commented Dec 4, 2022

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

job.scale endpoint does not enforce policy min/max
2 participants