Warning
Highly Experimental / Alpha Software This repository is a hackathon contribution and remains a highly experimental, alpha-stage project. Do not use this in production or expose it to end users.
coder-k8s is a Go-based Kubernetes control-plane project with two app modes:
- A
controller-runtimeoperator for managingCoderControlPlaneandCoderWorkspaceProxyresources (coder.com/v1alpha1). - An aggregated API server for
CoderWorkspaceandCoderTemplateresources (aggregation.coder.com/v1alpha1).
- Go 1.25+ (
go.modcurrently declares Go 1.25.7) - A Kubernetes cluster (OrbStack is recommended for local development; any cluster works)
kubectlconfigured to point at your cluster context
# Generate CRD and RBAC manifests
make manifests
# Apply CRDs to your cluster
kubectl apply -f config/crd/bases/
# Run the controller locally (uses your kubeconfig context)
GOFLAGS=-mod=vendor go run . --app=controller
# In another terminal: apply the sample CR
kubectl apply -f config/samples/coder_v1alpha1_codercontrolplane.yaml
# Verify
kubectl get codercontrolplanes -Aexamples/cloudnativepg/- Deploy aCoderControlPlanewith a CloudNativePG-managed PostgreSQL backend.
Bootstrap a KIND cluster and install CRDs/RBAC (this also switches your current kubectl context):
make kind-dev-upTip: override defaults when needed:
- Use
CLUSTER_NAMEto run multiple clusters in parallel.- Use
KIND_NODE_IMAGEto pin the node image (default:kindest/node:v1.34.0).CLUSTER_NAME=my-cluster make kind-dev-up KIND_NODE_IMAGE=kindest/node:v1.32.0 make kind-dev-up
If the cluster already exists and you change
KIND_NODE_IMAGE, runmake kind-dev-downfirst so the new image can be applied.
If you need to switch your kubectl context later:
make kind-dev-ctx
# or: CLUSTER_NAME=my-cluster make kind-dev-ctxStart the controller (pick one):
-
Out-of-cluster (fast iteration):
GOFLAGS=-mod=vendor go run . --app=controller -
In-cluster (closer to CI):
make kind-dev-load-image kubectl apply -f config/e2e/deployment.yaml kubectl -n coder-system wait --for=condition=Available deploy/coder-k8s --timeout=120s
Demo:
make kind-dev-k9sCleanup:
make kind-dev-downMux users: there is an optional agent skill (kind-dev) under .mux/skills/ with agent-oriented instructions for running per-workspace KIND clusters.
| Command | Description |
|---|---|
make build |
Build the project |
make test |
Run tests |
make manifests |
Generate CRD/RBAC manifests |
make codegen |
Run deepcopy code generation |
make verify-vendor |
Verify vendor consistency |
make lint |
Run linter (requires golangci-lint) |
make vuln |
Run vulnerability check (requires govulncheck) |
make docs-serve |
Serve the documentation site locally (requires mkdocs) |
make docs-check |
Build docs in strict mode (CI-equivalent) |
- Unit tests:
make testruns all tests, including unit tests inmain_test.go. - Integration tests: Use
envtestto exercise reconciliation against a lightweight API server (no real cluster needed). Run them viamake test(included in the full suite) ormake test-integration(focused on controller tests only). - E2E smoke tests: Recommended CI smoke coverage uses a Kind-based flow that deploys the controller image and verifies pod health.
api/v1alpha1/— CRD types and generated deepcopy codeinternal/controller/— Reconciliation logicconfig/crd/bases/— Generated CRD manifestsconfig/rbac/— RBAC manifests (generated role + deployment bindings)config/samples/— Sample custom resourceshack/— Code generation and maintenance scripts
Apache-2.0. See LICENSE.