Skip to content

Dev workspace namespace

The dev-workspace app (cluster/apps/system/dev-workspace) owns everything a Coder development workspace needs that the Coder provisioner must not create. Plan: .archive/.plans/remote-dev-workspace/.

What it creates

Object Purpose
Namespace dev-workspace, Pod Security baseline Home of the workspace pods
PVC <workspace>-home (15 Gi, ceph-block) Logins, config, tools added with mise use -g; backed up every 6 h
PVC <workspace>-src (30 Gi, ceph-block) Source code under /workspaces; backed up daily
ReplicationSource and restic ExternalSecret per PVC VolSync backups from charts/volsync, one restic repository per PVC
ServiceAccount <workspace> and ClusterRole dev-workspace-reader Read-only Kubernetes access (explicit lists, no Secrets, no wildcard)
serviceaccounts.talos.dev <workspace>-talos Talos credential (roles from talosRoles, os:reader by default); Talos creates a Secret with the same name
ExternalSecret <workspace>-bws (off until configured) BWS_ACCESS_TOKEN and BWS_PROJECT_ID for the workspace
Role dev-workspace-provisioner The Coder provisioner may manage Deployments here and nothing else
NetworkPolicy default-deny-ingress Ingress deny-all; egress stays open

The first workspace is dev-workspace. The Coder template only references these objects by name.

Add a workspace

  1. Add an entry to workspaces in values.yaml.
  2. Add two aliased volsync dependencies to Chart.yaml (volsync-<name>-home, volsync-<name>-src) and the two matching blocks to values.yaml. nameOverride and pvc.existingClaim must both equal the PVC name; nameOverride also names the restic repository path.
  3. Keep restore.enabled: false on both blocks: the claims hold live data, and the chart's restore-once destination would restore over the volume. Restore tests use a scratch PVC.

Why not the built-in view role

view aggregates every rule that an operator labels aggregate-to-view, so it grows silently. It already includes the 18 external-secrets generator kinds, some of which can hold inline credentials. dev-workspace-reader lists each resource by name instead. Add a CRD group only after reading its fields for credentials.

CRD audit (2026-11-24)

The cluster had 24 CRD groups with kinds that dev-workspace-reader did not list (for example the LiteLLM operator, so a LiteLLMProxy could not be read, and the RBAC objects, so a provisioner's ClusterRole could not be checked). Method: for each candidate kind, walk its OpenAPI schema (kubectl get crd -o json) and list every string field whose name suggests a credential (password, token, apiKey, secretKey, accessKey, privateKey, bearer and similar), then drop the known false positives (URLs such as tokenUrl, file paths such as credentialsFile, Windows gmsa fields). A field that is an object (a secretKeyRef) holds a name, not a value, and is fine. A kind stays out when a plain string can hold a credential.

  • Added: clusterroles, clusterrolebindings, roles and rolebindings; the LiteLLM kinds litellmproxies, litellmteams and litellmmcpservers; the Rook Ceph kinds that were missing, the ceph-csi operator kinds, three Cilium kinds, KEDA scaledobjects and scaledjobs, Multus network-attachment-definitions, NFD, the Intel GPU plugin kind, object bucket claims, four CloudNativePG kinds, the newer Gateway API kinds, dnsrecords, the group snapshot kinds and alertmanagerconfigs. 49 CRD kinds and the four RBAC kinds.
  • Left out: litellmmodels (spec.params.apiKey is a string, and some models in git use a literal value), litellmguardrails (spec.apiKey), litellmvirtualkeys (spec.secretKey), KEDA triggerauthentications and clustertriggerauthentications (hashiCorpVault.credential.token), scrapeconfigs, thanosrulers and prometheusagents (inline bearer tokens and cloud keys), the 18 external-secrets generator kinds, and serviceaccounts.talos.dev. Traefik, RabbitMQ, the Intel FPGA kinds and the Grafana podlogs have CRDs but no manifests in this repository (instances were not checked: the workspace cannot list them).
  • RBAC objects show who may do what; they carry no secrets. Reading them is how a missing permission is found without asking for a guess.

Run the audit again when a new operator is added: any CRD group that is not in the role is invisible to the workspace.

Boundaries

  • The workspace can read ExternalSecret specs, which contain Bitwarden references (identifiers, not values). It cannot read any Secret.
  • Only GitOps may create serviceaccounts.talos.dev in this namespace: the namespace may request any role in the cluster-wide KubeTalosAPIAccessConfig list, os:admin included.
  • Deleting a workspace, a template version or this app does not delete the PVCs (Prune=false,Delete=false).

Checks after the first sync

Read-only, with kubectl auth can-i --as=system:serviceaccount:dev-workspace:dev-workspace: get, list, watch on pods, nodes, namespaces answer yes; get, list, watch on secrets, get on pods/exec, nodes/proxy, create on serviceaccounts/token, and every write verb on pods, deployments, configmaps, roles, clusterroles, externalsecrets and serviceaccounts.talos.dev answer no. For the provisioner, no on persistentvolumeclaims, externalsecrets, replicationsources, roles and serviceaccounts.talos.dev in dev-workspace.

Subresources need --subresource. kubectl auth can-i get pods/exec does not ask about the exec subresource: it reads exec as the name of a pod, and a rule on pods allows any name, so it answers yes and looks like a leak. Use the flag:

A=--as=system:serviceaccount:dev-workspace:dev-workspace
kubectl auth can-i get pods --subresource=exec $A                 # no
kubectl auth can-i create pods --subresource=exec $A              # no
kubectl auth can-i get nodes --subresource=proxy $A               # no
kubectl auth can-i create serviceaccounts --subresource=token $A  # no
kubectl auth can-i get pods --subresource=log $A                  # yes

After the 2026-11-24 audit, these answer yes: list clusterroles, list clusterrolebindings, list litellmproxies -n ai, list cephclients -n rook-ceph, list scaledobjects -A. These still answer no: list litellmmodels -n ai, list litellmvirtualkeys -n ai, list triggerauthentications -A, list scrapeconfigs -A, list secrets -A.

The same applies to attach, portforward, ephemeralcontainers and the pods, services and nodes proxy subresources. Cluster-scoped resources print a harmless "not namespace scoped" warning.

Argo CD account dev-workspace

The workspace gets its own Argo CD local account (argocd-cm: accounts.dev-workspace: apiKey, so a token and no password login). SSO is not used from the workspace: the owner's identity and the ArgoCDAdmins group map to role:admin in argocd-rbac-cm, so an SSO session in the workspace would give a compromised workspace admin rights.

Capability Granted Why
Read applications, hard refresh all applications get is the only permission a refresh needs (checked in the v3.5.7 source)
Sync, stop a running sync (terminate-op), prune as a sync option all but the exclusions all three check sync (v3.6.2 source: Sync, TerminateOperation)
Rollback never server.rbac.rollback.enforce.enable makes it check rollback, which is not granted
Sync to another revision than targetRevision never needs override; application.sync.requireOverridePrivilegeForRevisionSync is on
Read projects (projects, get) all projects argocd app get fetches the project too; the response has no credentials
Delete, create, update, actions, exec, repositories, clusters, accounts never not in the policy
Create, update or delete projects never not in the policy

Responses mask live Secret values (get does not expose them).

Sync scope. argocd-rbac-cm allows sync on */* and denies it on the exclusions; a deny line wins over the allow (policy_effect in Argo CD's model.conf). The exclusions:

  • Argo CD itself, the CNI and Rook Ceph: the whole core project (core/*), so an application added to core later is excluded too.
  • Bootstrap: default/root-app, which deploys the projects and the ApplicationSets.
  • Access control: system/keycloak, system/external-secrets, system/cert-manager, system/kubelet-csr-approver.
  • The workspaces: system/dev-workspace, ai/agent-workspaces and the Coder platform ai/coder.
  • Storage operators outside core: system/cloudnative-pg, system/volsync, system/snapshot-controller.

An application added to any other project can be synced from the workspace without a policy change. To exclude it, add a deny line by a reviewed PR.

Why. Every application has automated sync, so a merged change normally deploys without a manual sync. A sync can still get stuck: Argo CD runs one operation per application, and an automated sync that waits for a resource to become healthy waits indefinitely if it never does. On 2026-11-27 a kube-prometheus-stack bump broke the node-exporter DaemonSet; the sync of the bump waited for it, and the sync of the fix could not start until the owner ran terminate-op and sync by hand. With this scope the workspace can do both, with the owner's consent.

Prune, replace and force are the owner's action. Argo CD has no separate permission for them: the token that may sync may also pass --prune, --replace or --force. A prune of an application that ships CRDs deletes the CRDs and every resource of those kinds, and --replace/--force delete and recreate objects. Claude denies the three flags (.claude/settings.json, DESTRUCTIVE in .agents/policy/permissions.md); for other harnesses that rule is instruction only. argocd.argoproj.io/sync-options: Prune=false on a PVC or stateful owner still stops a prune of that object. The disposable default/sync-probe application keeps its prune test (probe-prune-me).

Token. The owner generates it (argocd account generate-token --account dev-workspace) and stores it, with the server address, in the dev BWS project as ARGOCD_AUTH_TOKEN and ARGOCD_SERVER (the address contains the private domain, so it is a secret value, not text in this repository). The token is in the environment of every process in the pod (the template exports the BWS project, see the template README), so an agent can read it; the permission rules and the argocd RBAC are the limit, not secrecy. Using it to sync, or to stop a sync, still needs the owner's consent for each action.

Checks after the sync of this change (run by the owner, with the token, because they use the token):

argocd account can-i get applications '*/*'                         # yes
argocd account can-i get projects '*'                               # yes (also `argocd app get <name>` works)
argocd account can-i create projects '*'                            # no
argocd account can-i sync applications 'system/prometheus-stack'    # yes (also covers terminate-op)
argocd account can-i sync applications 'default/sync-probe'         # yes
argocd account can-i sync applications 'core/argocd'                # no
argocd account can-i sync applications 'default/root-app'           # no
argocd account can-i sync applications 'system/dev-workspace'       # no
argocd account can-i rollback applications 'system/prometheus-stack' # no
argocd account can-i override applications '*/*'                    # no
argocd account can-i delete applications '*/*'                      # no
argocd account can-i create applications '*/*'                      # no

The live argocd-cm must show application.sync.requireOverridePrivilegeForRevisionSync: "true" and server.rbac.rollback.enforce.enable: "true". To check a policy change before merging it, evaluate the file offline: argocd admin settings rbac can dev-workspace sync applications <project>/<app> --policy-file <policy.csv>.

Sync test on sync-probe (each sync is a RUNTIME_MUTATION: the owner runs it, or consents per action):

  1. argocd app sync sync-probe succeeds.
  2. argocd app sync root-app is refused (permission denied).
  3. argocd app sync sync-probe --revision <non-main branch> is refused (needs override).
  4. Prune: a later PR removes probe-prune-me from git. Auto-sync leaves it in the cluster (prune: false), the app shows OutOfSync; the owner runs argocd app sync sync-probe --prune, which deletes it.

_[VIP]: Virtual IP (Used for high-availability controlplanes) _[HA]: High Availability (often reduntant hardware/software) _[PVC]: k8s resource - Persistent Volume Claim _[PV]: k8s resource - Persistent Volume _[CNI]: k8s networking - Container Network Interface _[k8s]: Shortening of Kurbenetes _[CRD]: Custom Resource Definitions _[S3]: Simple Storage Service _[NFS]: Network File System _[DR]: Disaster Recovery