- Notifications
You must be signed in to change notification settings - Fork1.1k
chore(docs): add external provisioner configuration for prebuilds#20305
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
chore(docs): add external provisioner configuration for prebuilds#20305
Uh oh!
There was an error while loading.Please reload this page.
Conversation
…ernal-provisioners-prebuilds
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.
Some minor nits, otherwise LGTM! Thanks@ssncferreira !
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
| ```hcl | ||
| data "coder_workspace_tags" "prebuilds" { | ||
| count = data.coder_workspace_owner.me.name == "prebuilds" ? 1 : 0 | ||
| tags = { | ||
| "is_prebuild" = "true" | ||
| } | ||
| } | ||
| ``` |
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.
Interesting! I forgot that multiplecoder_workspace_tags would be merged.
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.
Yes, this way the data block can conditionally set the tag when the workspace owner is the prebuilds user, while still including any other tags defined in othercoder_workspace_tags blocks.
…ernal-provisioners-prebuilds
09e2daf intomainUh oh!
There was an error while loading.Please reload this page.
| ```hcl | ||
| data "coder_workspace_tags" "prebuilds" { | ||
| count = data.coder_workspace_owner.me.name == "prebuilds" ? 1 : 0 |
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.
Nice!
| ####Setup | ||
| 1) Create a provisioner key with a prebuild tag (e.g.,`is_prebuild=true`). |
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.
How does this tag interact with other tags? Let's say I already have provisioners with separate tags to process only aws jobs in one pool and only gke in another. Or perhaps I have a provisioner deployed in each region.
Would I need to add a new provisioner key for each of these sets but with theis_prebuild flag included?
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.
Multiplecoder_workspace_tags are cumulative:https://github.com/coder/coder/blob/main/coderd/dynamicparameters/tags_internal_test.go#L200-L242
Multiple instances of thecoder_workspace_tags data source cannot clobber existing tag values.
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.
How does this tag interact with other tags?
It depends on the tags that the user has defined in their template. I didn’t go into much detail here because that could make it harder to understand. Basically, the provisioner key needs to include all the tags already specified in the template, plus this new one.
Would I need to add a new provisioner key for each of these sets but with the is_prebuild flag included?
In your example, if you want to update your provisioners deployed in AWS and GKE, you would need to create 2 new provisioner key with those same tags and the additionalis_prebuild tag.
For instance, in the dogfood template we already have two static tags:
data "coder_workspace_tags" "tags" { tags = { "cluster" = "dogfood-v2" "env" = "gke" }}For the provisioners to handle prebuild jobs for this template, the key must be created with:--tag cluster=dogfood-v2 --tag env=gke --tag is_prebuild=true
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.
I get your point. If we're being overly verbose it will be hard to understand. On the other hand, I don't know that what you said above will be obvious to readers without additional context.
Don't feel pressured to change anything at my insistence, but perhaps consider whether there is a way to illustrate this interaction simply.
| 1) Publish the new template version. | ||
| 2) Wait for the prebuilds reconciliation loop to run. |
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.
What are the failure scenarios for this approach?
If prebuild specific provisioners fail to deploy for a specific tagset, will those jobs remain pending? Will that result in any kind of back pressure where the pending jobs impact the reconciliation loop?
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.
The jobs will remain in a pending state as there will be no provisioner to pick them up. My understanding is that the reconcilation loop should detect that there are in-progress jobs and not completely spam the queue (ref:https://github.com/coder/coder/blob/main/coderd/prebuilds/preset_snapshot.go#L394-L410) but do correct me if I'm not understanding correctly.
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.
What@johnstcn said, the prebuild jobs would remain in a pending state, waiting for a provisioner daemon with matching tags to become available. The reconciliation loop already accounts for pending prebuilds (jobs in the queue) and subtracts them from the desired count, so this wouldn’t impact the loop itself.
The only side effect is that the queue for prebuild-related jobs could continue to grow if new template versions are imported or existing prebuilds are claimed.
Should I add another step here to validate the status of the provisioners from Coder’s perspective, for example, by checking the Provisioners page or running thecoder provisioner list CLI command?
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.
I think that would be a good idea, but I'll leave the decision up to you.
Description
Update the Prebuilds troubleshooting page to include a new section, “Preventing prebuild queue contention (recommended)”, outlining a best-practice configuration to prevent prebuild jobs from overwhelming the provisioner queue.
This setup introduces a dedicated prebuild provisioner pool and has been successfully tested internally in dogfood:https://github.com/coder/dogfood/pull/201
Closes:#20241