-
Notifications
You must be signed in to change notification settings - Fork 2k
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
scaling policy: use request namespace as target if unset in jobspec #24065
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tgross
changed the title
scaling: use request namespace as target if unset in jobspec
scaling policy: use request namespace as target if unset in jobspec
Sep 25, 2024
tgross
force-pushed
the
scaling-policy-namespace
branch
from
September 26, 2024 20:51
d3fe361
to
cfd10bf
Compare
When jobs are submitted with a scaling policy, the scaling policy's target only includes the job's namespace if the `namespace` field is set in the jobspec and not from the request. Normally jobs are canonicalized in the RPC handler before being written to Raft. But the scaling policy targets are instead written during the conversion from `api.Job` to `structs.Job`. We populate the `structs.Job` namespace from the request here as well, but only after the conversion has occurred. Swap the order of these operations so that the conversion is always happening with a correct namespace. Fixes: #24039
tgross
force-pushed
the
scaling-policy-namespace
branch
from
September 27, 2024 13:40
5ff4791
to
45adbba
Compare
tgross
added
type/bug
theme/autoscaling
Issues related to supporting autoscaling
labels
Sep 27, 2024
tgross
force-pushed
the
scaling-policy-namespace
branch
from
September 27, 2024 14:20
45adbba
to
b56ca83
Compare
tgross
added
backport/ent/1.7.x+ent
Changes are backported to 1.7.x+ent
backport/1.8.x
backport to 1.8.x release line
labels
Sep 27, 2024
shoenig
approved these changes
Oct 1, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
tgross
added a commit
that referenced
this pull request
Oct 1, 2024
…24065) When jobs are submitted with a scaling policy, the scaling policy's target only includes the job's namespace if the `namespace` field is set in the jobspec and not from the request. Normally jobs are canonicalized in the RPC handler before being written to Raft. But the scaling policy targets are instead written during the conversion from `api.Job` to `structs.Job`. We populate the `structs.Job` namespace from the request here as well, but only after the conversion has occurred. Swap the order of these operations so that the conversion is always happening with a correct namespace. Long-term we should not be making mutations during conversion either. But we can't remove it immediately because API requests may come from any agent across upgrades. Move the scaling target creation into the `Canonicalize` method and mark it for future removal in the API conversion code path. Fixes: #24039
tgross
added a commit
that referenced
this pull request
Oct 1, 2024
…in jobspec (#24065) (#24096) When jobs are submitted with a scaling policy, the scaling policy's target only includes the job's namespace if the `namespace` field is set in the jobspec and not from the request. Normally jobs are canonicalized in the RPC handler before being written to Raft. But the scaling policy targets are instead written during the conversion from `api.Job` to `structs.Job`. We populate the `structs.Job` namespace from the request here as well, but only after the conversion has occurred. Swap the order of these operations so that the conversion is always happening with a correct namespace. Long-term we should not be making mutations during conversion either. But we can't remove it immediately because API requests may come from any agent across upgrades. Move the scaling target creation into the `Canonicalize` method and mark it for future removal in the API conversion code path. Fixes: #24039 Co-authored-by: Tim Gross <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
backport/ent/1.7.x+ent
Changes are backported to 1.7.x+ent
backport/1.8.x
backport to 1.8.x release line
theme/autoscaling
Issues related to supporting autoscaling
type/bug
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When jobs are submitted with a scaling policy, the scaling policy's target only includes the job's namespace if the
namespace
field is set in the jobspec and not from the request. Normally jobs are canonicalized in the RPC handler before being written to Raft. But the scaling policy targets are instead written during the conversion fromapi.Job
tostructs.Job
. We populate thestructs.Job
namespace from the request here as well, but only after the conversion has occurred. Swap the order of these operations so that the conversion is always happening with a correct namespace.Long-term we should not be making mutations during conversion either. But we can't remove it immediately because API requests may come from any agent across upgrades. Move the scaling target creation into the
Canonicalize
method and mark it for future removal in the API conversion code path.Fixes: #24039
Note for reviewers: I've broken this into one commit for the immediate fix and one for the
Canonicalize
refactor, just in case we think the latter is too much to land post-beta. I think it's safe, but I'm open to arguments otherwise.