-
Notifications
You must be signed in to change notification settings - Fork 887
fix(coderd): only allow untagged provisioners to pick up untagged jobs #12269
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
Conversation
{ | ||
name: "tagged provisioner and untagged job", | ||
provisionerJobTags: map[string]string{"scope": "organization", "owner": ""}, | ||
acquireJobTags: map[string]string{"scope": "organization", "owner": "", "foo": "bar"}, | ||
expectAcquire: false, | ||
}, |
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.
review: this is the behaviour that changes
AND nested.tags <@ @tags :: jsonb | ||
AND CASE | ||
-- Special case for untagged provisioners: only match untagged jobs. | ||
WHEN nested.tags :: jsonb = '{"scope": "organization", "owner": ""}' :: jsonb |
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.
When we assign @ tags, will it always contain scope = organization
when untagged and used live?
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.
We make sure to call provisionersdk.MutateTags
before serializing tags, so it will always contain scope
and owner
keys.
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.
👍
Alternative solution to #6442
Modifies the behaviour of
AcquireProvisionerJob
and adds a special case for 'un-tagged' jobs such that they can only be picked up by 'un-tagged' provisioners.Also adds comprehensive test coverage for
AcquireJob
given various combinations of tags.This solves the issue described in #6442 without the need for another configuration knob.
The approach in #12244 needs some additional supporting work and potentially some input from customers before we go ahead and build it properly.
This is a behavioural change for sure, but there doesn't seem to be any scenario in which the previous behaviour would be warranted.