Repository navigation
Description
We have a little-known feature that allows someone to run external provisioners outside of the coder server. However, there are some cases where a workspace owner wants to guarantee which "external provisioner/runner" their workspace is built on.
- Runners in specific clouds/datacenters
- Runners on a developer's local machine
Templates can tag which runners they are compatible with, but this isn't done done per-workspace (a workspace may be re-built on a different runner with the same tag, leading to data loss or a failed build).
With an immutable, dynamic, runner parameter on the “create workspace” page, we can do both! Instead of hardcoded values, Coder pulls the list of available runners and perhaps shows latency.
We could also consider this for our dogfood template, removing provisioning load from the Coder server and relying on runners on each bare metal instance to provision containers with their respective local docker sockets. This has an added advantage of builds not failing when we redeploy Coder (we constantly update our dogfood environment when a new commit is merged into main)
Note
In most (to all) cases, this parameter should be immutable. I'd actually argue we should not support it being mutable. Migrating a workspace to another datacenter / runtime is risky

Activity
mtojek commentedon Feb 3, 2023
TIL, thanks!
If this is a low-hanging fruit, then most likely we should look into this.
👍
BTW well described issue, Ben.
github-actions commentedon May 30, 2023
This issue is becoming stale. In order to keep the tracker readable and actionable, I'm going close to this issue in 7 days if there isn't more activity.
kconley-sq commentedon May 30, 2023
Bump to remove the stale label, my team is still wishing for this feature. 🙏
bpmct commentedon Jul 24, 2023
It seems like this should both support targeting specific provisioners (e.g. single runner running on a VM) or tags/groups of provisioners (e.g.
cluster 1 (100 daemons running)spikecurtis commentedon Aug 4, 2023
One thing we could do fairly straightforwardly is to allow rich parameters to set tags on the build job, which then can restrict which provisionerds are able to build the workspace. For simplicity, we should require the parameter to be immutable.
Work items:
coder_parameterto accept an argument marking it as a tag.This gets us a basic working version, but falls short of
We'd have to depend on hardcoded values in the template, so there would have to be out-of-band coordination between the operators who set up the provisionerds with tags and the template authors who want to allow end users to tag their jobs. (This is basically the situation today, with tags set at the template version.)
The difficulty in pulling a list of available provisioners is that Coder doesn't presently track the lifecycle of provisionerds. They get added to the database when they connect, but then are never updated when they disconnect.
I also think latency isn't very sensible. Latency from what to what? Presumably users are interested in minimizing the latency from their computer to their workspace, but we can't measure that prior to building the workspace. Provisionerds don't respond to latency pings from end users, and adding that is difficult because there is no requirement for them to be externally reachable. While you might expect that provisionerds are often located near where the workspaces will be created, this is far from universal. Consider the case of public clouds like AWS: a provisioner job talking to the AWS APIs can create a workspace in any zone across the whole world.
bpmct commentedon Aug 18, 2023
Yeah latency was a bit of a silly idea, we don't need to do that :)
mtojek commentedon Aug 25, 2023
As this is part of this sprint, let's list changes in the terraform-provider.
@spikecurtis I'd like to follow up on your vision. Did you mean something like this:
In this case, option values would be tags:
bens-macbook,us-pittsburgh,sydney, andbens-thinkpad.Coderd/UI could determine the role of
coder_parameterto be a provisioner selector based on theroleproperty.defaultproperty for the provisioner selector?Side note:
Maybe we could just introduce another TF resource like
coder_provisioner, which is not a rich parameter,but can provide a list of allowed provisioner tags.
kconley-sq commentedon Aug 25, 2023
Hey all, my team is one of the teams asking for this feature. We strictly need this aspect:
to support arbitrary developers spinning up workspaces on personal/local provisioners running on their laptops (see #909) that we can't pre-bake as hard-coded template parameter options.
We're trying to improve the experience today where:
bpmct commentedon Aug 29, 2023
I think this is a good opportunity for us to have "magic parameters" where the options and validation are not defined Terraform but instead by
coderd: for example:I suppose this could be a "pre-create-workspace-page plan" 😅 but these kind of these things could be better solved without Terraform (good ol' REST APIs).
I imagine this may cause some heavy refactors if we try to implement this in parameters and there is another risk in duplication if we introduce a different data source:
This kind of reminds me how we do gitauth in Coder. https://coder.com/docs/v2/latest/admin/git-providers#require-git-authentication-in-templates
I guess the parameter picker should be its own data source ❓
mtojek commentedon Aug 29, 2023
bpmct commentedon Aug 29, 2023
Nice! I like this
4 remaining items
matifali commentedon Apr 24, 2024
mtojek commentedon Apr 24, 2024
FYI I'm working on the RFC right now, and will come up with the design by the end of this week.
[-]rich parameters: select a provisioner[/-][+]Use parameters to select a provisioner[/+]mtojek commentedon May 10, 2024
Battle plan:
coder_workspace_tags#13218coder_workspace_tags#13221matifali commentedon May 10, 2024
mtojek commentedon May 10, 2024
The RFC does not discuss dynamic provisioner tags, so the short answer is: no, not yet. We can focus on the dynamic list of active tags later.
matifali commentedon May 10, 2024
@mtojek I agree, and I am writing down this idea for future reference.
matifali commentedon May 21, 2024
What will be the behavior when the provided tags do not match any provisioner? What is the plan to evict these build jobs from the build queue? As currently, the behavior is that they always stay stuck in a pending state.
mtojek commentedon May 21, 2024
Stuck as it is now. We will need a separate RFC to describe a concept of "dead letter queue". It was mentioned in the RFC.
matifali commentedon May 21, 2024
@mtojek Thanks for the update.
mtojek commentedon May 23, 2024
As all items have been implemented according to the RFC, I'm closing this issue now.