Skip to content

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

Merged
merged 4 commits into from
Feb 22, 2024

Conversation

johnstcn
Copy link
Member

@johnstcn johnstcn commented Feb 22, 2024

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.

Comment on lines +348 to +353
{
name: "tagged provisioner and untagged job",
provisionerJobTags: map[string]string{"scope": "organization", "owner": ""},
acquireJobTags: map[string]string{"scope": "organization", "owner": "", "foo": "bar"},
expectAcquire: false,
},
Copy link
Member Author

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
Copy link
Member

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?

Copy link
Member Author

@johnstcn johnstcn Feb 22, 2024

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.

Copy link
Member

@mtojek mtojek left a comment

Choose a reason for hiding this comment

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

👍

@johnstcn johnstcn merged commit 53e8f9c into main Feb 22, 2024
@johnstcn johnstcn deleted the cj/provisionerd_acquire_untagged branch February 22, 2024 15:04
@github-actions github-actions bot locked and limited conversation to collaborators Feb 22, 2024
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.

3 participants