Dynamic parameters are how every parameter works now (default since v2.25.0), but the docs still split the concept across two sibling sidebar pages, "Parameters" and "Dynamic parameters". That hides form types, conditional parameters, and identity-aware parameters behind a legacy feature name. This PR folds them into a single **Parameters** section under **Extend templates**, with one focused child page per concept. Every code example from both old pages is kept (33 of 33 fenced blocks, including the commented-out daisy-chaining example). ## New structure | Page | Contents | Came from | |---|---|---| | `parameters/index.md` (Parameters) | What parameters are, defining one, provider version, how Coder evaluates parameters (data source caching, no HTTP fetching), types, options, required/optional, mutability, ephemeral, URL autofill | `parameters.md` + intro/requirements/data-source sections of `dynamic-parameters.md` | | `parameters/form-types.md` | `form_type` table, `styling` table, an example for each form type | `dynamic-parameters.md` | | `parameters/validation.md` | Number and string validation, validation that depends on other parameters | `parameters.md` + "Dynamic Validation" | | `parameters/conditional-parameters.md` | Show/hide, defaults from other parameters | `dynamic-parameters.md` | | `parameters/identity-aware-parameters.md` (`state: [premium]`) | Role-aware options, group-aware regions, groups as namespaces | `dynamic-parameters.md` | | `parameters/workspace-presets.md` | Presets | `parameters.md` | | `parameters/compatibility-mode.md` | Find, upgrade, and revert compatibility-mode templates | `dynamic-parameters.md` | | `parameters/troubleshooting.md` | Known issues, template variables, registry modules, module-not-loaded errors | `dynamic-parameters.md` | `parameters.md` moves to `parameters/index.md`, so `/docs/admin/templates/extending-templates/parameters` (and `#ephemeral-parameters`, which the dashboard links to) keeps working. ## Other changes - `docs/redirects.json`: `/docs/admin/templates/extending-templates/dynamic-parameters` redirects to the Parameters section. - Dashboard `docs()` links that pointed at `dynamic-parameters` now point at `parameters`, or at `parameters/compatibility-mode` where the link is about compatibility mode (the Storybook assertion is updated to match). - Inbound doc links updated. Glossary gets a **Parameters** entry, and **Dynamic parameters** is kept as the former name. - Tabs on the old page are replaced with headed sections, per the style guide's rule against tabs for content every reader needs. Each form type and example now has its own anchor. - Small cleanups in moved prose: sentence-case headings, "Dynamic Parameters" product-name references removed, the stale "Later in 2025..." registry-module sentence and GA announcement copy dropped, "template creation links" corrected to "workspace creation links" for URL autofill. ## Not in this PR Dashboard UI copy still says "Dynamic Parameters" in a few tooltips and helper text (for example, `CreateWorkspacePageView.tsx` and `TemplateParametersPageView.tsx`). That's a product copy change and is better handled separately. ## Verification - `make gen/docs-manifest`, `make lint/docs-manifest`, `make lint/docs-redirects` (also with `-base origin/main`), `make lint/emdash`, `make lint/docs-html`: pass - `markdownlint-cli2` and `markdown-table-formatter --check` on changed docs: pass - Vale on the new pages: 0 errors, 0 warnings, 0 suggestions - `biome check` on the changed `site/` files: pass - A script compared every fenced code block in the old `parameters.md` and `dynamic-parameters.md` with the new pages: all 33 are present. - Relative links and anchors in all changed docs files resolve. The only failures are anchors that were already broken in `glossary.md` and `admin/templates/index.md`, which this PR doesn't touch. - Not done: a rendered preview on the docs site, and running the Storybook interaction test. This PR was drafted by Superblink (Coder's AI assistant) at the request of @stirby, who will review it and is accountable for it. --------- Co-authored-by: coder[bot] <137810501+coder[bot]@users.noreply.github.com> Co-authored-by: Nick Vigilante <nickvigilante@users.noreply.github.com>
6.3 KiB
title
| title |
|---|
| Additional clusters |
With Coder, you can deploy workspaces in additional Kubernetes clusters using different authentication methods in the Terraform provider.
Option 1) Kubernetes contexts and kubeconfig
First, create a kubeconfig file with multiple contexts.
kubectl config get-contexts
CURRENT NAME CLUSTER
workspaces-europe-west2-c workspaces-europe-west2-c
* workspaces-us-central1-a workspaces-us-central1-a
Kubernetes control plane
If you deployed Coder on Kubernetes, you can attach a kubeconfig as a secret.
This assumes Coder is deployed on the coder namespace and your kubeconfig file is in ~/.kube/config.
kubectl create secret generic kubeconfig-secret -n coder --from-file=~/.kube/config
Modify your helm values to mount the secret:
coder:
# ...
volumes:
- name: "kubeconfig-mount"
secret:
secretName: "kubeconfig-secret"
volumeMounts:
- name: "kubeconfig-mount"
mountPath: "/mnt/secrets/kube"
readOnly: true
Upgrade Coder with these new values.
VM control plane
If you deployed Coder on a VM, copy the kubeconfig file to /home/coder/.kube/config.
Create a Coder template
You can start from our example template. From there, add template parameters to allow developers to pick their desired cluster.
# main.tf
data "coder_parameter" "kube_context" {
name = "kube_context"
display_name = "Cluster"
default = "workspaces-us-central1-a"
mutable = false
option {
name = "US Central"
icon = "/emojis/1f33d.png"
value = "workspaces-us-central1-a"
}
option {
name = "Europe West"
icon = "/emojis/1f482.png"
value = "workspaces-europe-west2-c"
}
}
provider "kubernetes" {
config_path = "~/.kube/config" # or /mnt/secrets/kube/config for Kubernetes
config_context = data.coder_parameter.kube_context.value
}
Option 2) Kubernetes ServiceAccounts
Alternatively, you can authenticate with remote clusters with ServiceAccount tokens. Coder can store these secrets on your behalf with managed Terraform variables.
Alternatively, these could also be fetched from Kubernetes secrets or even HashiCorp Vault.
This guide assumes you have a coder-workspaces namespace on your remote cluster.
Change the namespace accordingly.
Create a ServiceAccount
Run this command against your remote cluster to create a ServiceAccount, Role, RoleBinding, and token:
kubectl apply -n coder-workspaces -f - <<EOF
apiVersion: v1
kind: ServiceAccount
metadata:
name: coder-v2
---
apiVersion: v1
kind: Secret
metadata:
name: coder-v2
annotations:
kubernetes.io/service-account.name: coder-v2
type: kubernetes.io/service-account-token
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: coder-v2
rules:
- apiGroups: ["", "apps", "networking.k8s.io"]
resources: ["persistentvolumeclaims", "pods", "deployments", "services", "secrets", "pods/exec","pods/log", "events", "networkpolicies", "serviceaccounts"]
verbs: ["create", "get", "list", "watch", "update", "patch", "delete", "deletecollection"]
- apiGroups: ["metrics.k8s.io", "storage.k8s.io"]
resources: ["pods", "storageclasses"]
verbs: ["get", "list", "watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: coder-v2
subjects:
- kind: ServiceAccount
name: coder-v2
roleRef:
kind: Role
name: coder-v2
apiGroup: rbac.authorization.k8s.io
EOF
The output should be similar to:
serviceaccount/coder-v2 created
secret/coder-v2 created
role.rbac.authorization.k8s.io/coder-v2 created
rolebinding.rbac.authorization.k8s.io/coder-v2 created
2. Modify the Kubernetes template
You can start from our example template.
variable "host" {
description = "Cluster host address"
sensitive = true
}
variable "cluster_ca_certificate" {
description = "Cluster CA certificate (base64 encoded)"
sensitive = true
}
variable "token" {
description = "Cluster CA token (base64 encoded)"
sensitive = true
}
variable "namespace" {
description = "Namespace"
}
provider "kubernetes" {
host = var.host
cluster_ca_certificate = base64decode(var.cluster_ca_certificate)
token = base64decode(var.token)
}
Create Coder template with managed variables
Fetch the values from the secret and pass them to Coder. This should work on macOS and Linux.
To get the cluster address:
kubectl cluster-info
Kubernetes control plane is running at https://example.domain:6443
export CLUSTER_ADDRESS=https://example.domain:6443
To fetch the CA certificate and token:
export CLUSTER_CA_CERTIFICATE=$(kubectl get secrets coder-v2 -n coder-workspaces -o jsonpath="{.data.ca\.crt}")
export CLUSTER_SERVICEACCOUNT_TOKEN=$(kubectl get secrets coder-v2 -n coder-workspaces -o jsonpath="{.data.token}")
Create the template with these values:
coder templates push \
--variable host=$CLUSTER_ADDRESS \
--variable cluster_ca_certificate=$CLUSTER_CA_CERTIFICATE \
--variable token=$CLUSTER_SERVICEACCOUNT_TOKEN \
--variable namespace=coder-workspaces
If you're on a Windows machine (or if one of the commands fail), try grabbing the values manually:
# Get cluster API address
kubectl cluster-info
# Get cluster CA and token (base64 encoded)
kubectl get secrets coder-service-account-token -n coder-workspaces -o jsonpath="{.data}"
coder templates push \
--variable host=API_ADDRESS \
--variable cluster_ca_certificate=CLUSTER_CA_CERTIFICATE \
--variable token=CLUSTER_SERVICEACCOUNT_TOKEN \
--variable namespace=coder-workspaces
