Architecture overview
kornercode provisions browser-based development environments on Kubernetes. A developer signs in, picks a workspace profile, and gets a dedicated code-server instance (VS Code in the browser) with a persistent home directory, team-provided secrets and configuration, and network access restricted by policy. Administrators define what a workspace may look like and see how the platform is used.
The system has two components that share one Go module and one set of custom resources:
- The operator turns
WorkspaceandTeamresources into Kubernetes objects and keeps them in the desired state. - The gateway is the only entry point for users: it serves the dashboard and its REST API, authenticates users against an OIDC provider, and proxies traffic to the right workspace.
System context
flowchart LR
user([Developer / administrator])
idp[OIDC provider]
ingress[Ingress controller<br/>TLS termination]
subgraph cluster[Kubernetes cluster]
gateway[Gateway<br/>dashboard, API, proxies]
operator[Operator<br/>controllers and webhooks]
api[(Kubernetes API<br/>kornercode CRDs)]
certmanager[cert-manager]
prom[Prometheus<br/>optional]
subgraph teamns[Team namespace]
pod[Workspace pod<br/>code-server + Envoy]
pvc[(Home volume)]
end
end
user -->|HTTPS| ingress --> gateway
gateway -->|OIDC login| idp
gateway -->|read/write CRs| api
gateway -->|mTLS| pod
gateway -.->|usage queries| prom
operator -->|watch and reconcile| api
operator -->|Certificates| certmanager
api --- pod
pod --- pvc
Hostnames
The gateway serves three hostnames from one listener. Keeping them separate lets each one carry its own host-only session cookie, so code running in a workspace can never read the dashboard session (see ADR 0004).
| Hostname | Serves |
|---|---|
dashboard.<domain> | The dashboard (single-page application), the REST API under /api/v1, and the OIDC endpoints under /auth |
dev.<domain> | A reverse proxy to the signed-in user’s code-server |
test.<domain> | A reverse proxy to the application the user runs in their workspace (spec.testPort, default 3000) |
With the optional client-certificate gate on, all three hostnames ask the browser for the person’s company client certificate. The gateway then serves them only on a second listener (port 8444) that accepts connections from the ingress alone, and checks the certificate against the session on every request; its plain listener answers health checks and nothing else. Administrators listed in the chart’s break-glass mapping can sign in on the dashboard with the certificate alone while the OIDC provider is down. See Client-certificate gate.
Custom resources
All resources belong to the API group code.kornercloud.dev/v1alpha1. The
full field reference is in docs/reference/crds.md.
| Kind | Scope | Owned by | Purpose |
|---|---|---|---|
WorkspaceProfile | Cluster | Administrators | A workspace template: image, CPU and memory requests, storage size, default and maximum lifetime, inactivity timeout, GPU, extra environment and volumes, security context |
SecurityProfile | Cluster | Administrators | Security posture shared by teams: pod and container security contexts, service account, the NetworkPolicies to apply |
Team | Cluster | Administrators | Maps an OIDC group to a namespace, the profiles its members may use, a security profile, and the secrets, config maps and volumes mounted into every workspace |
Workspace | Namespaced | Users (through the gateway) | One user’s environment: owner, profile, team, optional TTL, inactivity timeout and test port |
flowchart LR
team[Team] -->|allowedProfiles| wp[WorkspaceProfile]
team -->|securityProfileRef| sp[SecurityProfile]
team -->|namespace| ns[Namespace]
ws[Workspace] -->|teamRef| team
ws -->|profileRef| wp
ws -->|lives in| ns
A user belongs to a team through the groups claim of their OIDC token
(Team.spec.groupClaim). Several teams may share a namespace; a workspace
always records its team in spec.teamRef.
What a workspace is made of
For each Workspace, the operator creates and owns:
| Object | Name | Notes |
|---|---|---|
| PersistentVolumeClaim | home-<owner>, or a restored volume adopted as the user’s home | The only volume the operator mounts, at /home/coder; it also holds code-server’s settings and extensions. Scoped to the user, not the workspace: it survives workspace deletion and is reused by the user’s next workspace (ADR 0003). Its name is recorded in status.homePVCName (see home volume) |
| ServiceAccount | workspace-runner or the one named by the security profile | Shared by all workspaces of the namespace; the token is only mounted when a security profile names an account |
| Certificate and Secret | workspace-<name>-tls | Issued by the internal cert-manager CA when mTLS is enabled |
| ConfigMap | workspace-<name>-envoy | Envoy sidecar configuration, when mTLS is enabled |
| Pod | workspace-<name> | code-server container, plus an Envoy mtls-proxy sidecar when mTLS is enabled |
| Service | workspace-<name> | Port 8080 to code-server (8443 to the Envoy sidecar with mTLS) and the test port |
Network isolation is not a per-workspace object: administrators define a set of NetworkPolicies once, the operator copies them into every team namespace, and a workspace pod opts into them through labels (see network isolation).
Main flows
Creating a workspace
sequenceDiagram
actor U as User
participant G as Gateway
participant K as Kubernetes API
participant W as Admission webhooks
participant O as Operator
U->>G: POST /api/v1/environments {profileRef}
G->>G: resolve team from OIDC groups, check allowed profile
G->>K: create Workspace (owner, team, profile)
K->>W: validate and default
K-->>O: watch event
O->>K: home PVC (adopt, reuse or create), ServiceAccount, Certificate
O->>K: Pod (with NetworkPolicy labels)
O->>K: Service, lifecycle status (expiresAt)
U->>G: GET /api/v1/workspace (polling)
G-->>U: workspace, pod readiness, events
Opening the IDE
Session cookies are host-only, so the dashboard hands the session to the
dev host with a short-lived, encrypted bridge ticket:
sequenceDiagram
actor U as Browser
participant D as Gateway (dashboard host)
participant V as Gateway (dev host)
participant P as Workspace pod
U->>D: POST /api/v1/bridge/ticket?target=dev
D-->>U: ticket (30 s, bound to the dev host)
U->>V: GET /auth/bridge?ticket=...&redirect=/
V->>V: verify ticket, set host-only session cookie
V-->>U: 302 /
U->>V: GET / (and WebSocket upgrades)
V->>P: proxy over mTLS to the user's workspace
Administrators can open another user’s IDE the same way; the ticket then names the workspace, and every such access is recorded as an event on it (ADR 0010).
Where to go next
- Operator: controllers, the reconcile chains, self-healing and lifecycle.
- Gateway: routing, authentication, proxies, the REST API and usage insights.
- Security: the threat model and every defense layer.
- Architecture decision records: why the system is built this way.