Skip to content

feat: add --key flag to provisionerd start #14002

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 7 commits into from
Jul 25, 2024
Merged

Conversation

f0ssel
Copy link
Contributor

@f0ssel f0ssel commented Jul 24, 2024

What this changes:

  • Adds --key flag to coder provisionerd start for providing a provisioner key to authenticate with.
    • Not allowed to specify --tag or --psk when using --key flag.

@f0ssel f0ssel force-pushed the f0ssel/provisionerd-key branch from 5d4cbc0 to 47aa9c4 Compare July 25, 2024 15:48
@f0ssel f0ssel marked this pull request as ready for review July 25, 2024 16:12
@f0ssel f0ssel requested a review from Emyrk July 25, 2024 18:29
Comment on lines +160 to +164
if provisionerKey != "" {
logger.Info(ctx, "provisioner key auth automatically sets tag "+provisionersdk.TagScope+" empty")
// no scope tag will default to org scope
delete(tags, provisionersdk.TagScope)
}
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 because it's all done on coderd? And we should be passing no tags into the provisioner daemon?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct, the API will actually fail if you pass any tags + a provisioner key. I felt this was a good opportunity to break that behavior altogether.

// If using PSK auth, the daemon is, by definition, scoped to the organization.
tags = provisionersdk.MutateTags(uuid.Nil, tags)
return tags, nil
if tags != nil && !maps.Equal(tags, map[string]string{}) {
Copy link
Member

Choose a reason for hiding this comment

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

TIL maps.Equal

@f0ssel f0ssel merged commit 2279441 into main Jul 25, 2024
29 checks passed
@f0ssel f0ssel deleted the f0ssel/provisionerd-key branch July 25, 2024 19:26
@github-actions github-actions bot locked and limited conversation to collaborators Jul 25, 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.

2 participants