- Finalize CNPG cluster config so
kubetty-shared-appsecret is created (ensurebootstrap.initdb+managedRolesandkubetty-postgres-usersecret exist). - Document the secret name/keys needed by Helm (
username,password,dbname,host,port) and ensure it lives inkubetty-shared. - Decide how namespaces are created (script or manual
kubectl create namespace <name>), especially for per-project releases.
- [DONE] Flesh out
internal/sessionswith real CNPG queries for single-session-per-pod model. - [DONE] Expand PTY management: handle resize messages, heartbeat logging, and graceful shutdown when shell exits.
- [DONE] Implement single-client enforcement (reject additional connections until first disconnects).
- Add structured logging and configurable log destination (stdout + optional file).
- [DONE] Wire terminal resize events to backend; persist theme/keyboard settings locally.
- [DONE] Implement login form and auth flow for protected deployments.
- Add session logs viewer modal for reviewing past PTY transcripts.
- Include minimal smoke tests (Vitest/React Testing Library) for auth and terminal state handling.
- Add
Makefiletargets:build-ui,build-server,docker-build,docker-push,helm-install. - Create
/etc/profile.d/claude.shinstall step in Dockerfile sourcingscripts/claude_with_log.sh. - Verify required CLIs (kubectl, helm, docker, go, node, git, jq, yq, curl/httpie, ripgrep, fd, tmux, make, python3/pip, psql, Claude/Codex/Gemini) are installed and pinned to versions.
- Add lint/format checks (
golangci-lint,npm run lint) if desired.
- Author Dockerfile that compiles the Go server, copies
server/ui/dist, installs toolchain, and sets entrypoint. - Document local build + push workflow (
docker build -t harbor.support.tools/kubetty/<repo>:<tag> .thendocker push). - Provide example tags per project (
kubetty-ai-dev:2024-05-01) and note how to prune old images in Harbor.
- Finish Helm chart templates (Service, Deployment, ConfigMap/Secret if needed) and add NOTES about port-forwarding.
- Parameterize env vars (
SESSION_ID,CLAUDE_*,ANTHROPIC_BASE_URL, CNPG host/port/db/user/pass) viavalues.yaml. - Offer sample values files for Project A/B, each with unique namespaces and session UUIDs.
- Document deployment procedure: create namespace,
helm upgrade --install,kubectl port-forward, and verifying/ws+/api/auth/me.
- Smoke test end-to-end: start backend, connect via browser, run CLI tools (Claude alias), confirm logs land under
$HOME/claude_logs. - Validate CNPG persistence by restarting pod and ensuring session resumes.
- Add operational runbook: session management, auth user creation/rotation, JWT secret rotation, CNPG cleanup.
- Capture troubleshooting steps for WebSocket errors, database outages, auth failures, or missing tools in the container.
- Update README/AGENTS to describe build/run instructions, env vars, CLI aliases, and deployment workflow.
- Provide Helm chart README with configuration table and CNPG requirements.
- Include onboarding checklist covering CNPG access, Harbor credentials, and namespace prep.
make ui– installswebdependencies and producesserver/ui/dist.make server– runsgo fmt,go test, and builds a localbin/kubetty.make docker-build IMAGE=harbor.support.tools/kubetty/<repo> TAG=<tag>– multi-stage build producing a tool-rich runtime image.make docker-push IMAGE=... TAG=...– pushes the image to Harbor once authenticated (docker login harbor.support.tools).helm upgrade --install <release> deploy/helm -n <namespace> -f <values>– deploys using the freshly pushed image, referencing CNPG secrets inkubetty-shared.
-
Gateway Configuration & Catalog
- Define a
projects.yaml(orPROJECTS_JSON) schema withid,displayName,namespace,service,port, and optional metadata (icon, description). - Extend the Go config package to load and validate the catalog; add unit tests.
- Document how to onboard a new project (update ConfigMap + redeploy gateway).
- Implement hot-reload or config hash comparison to detect drift and emit metrics/logs when the catalog changes.
- Define a
-
Downstream WebSocket Relay
- Introduce a
relaypackage that can dialws://<service>.<namespace>.svc:<port>/wswith TLS support if needed. - Manage lifecycle for each relay (connect, read/write pumps, retry with exponential backoff).
- Track metrics (latency, bytes, reconnect counts) per project.
- Handle backpressure to avoid unbounded buffering when the browser or downstream pod stalls.
- Capture structured events (connect, disconnect, retry) and surface them to both logs and
/api/tabsconsumers.
- Introduce a
-
Gateway API Surface
- Implement
/api/projects(list) and/api/tabs(POST create, GET list, DELETE close) endpoints. - Persist tab metadata in memory plus CNPG (reuse
sessionstable with new columns or add agateway_tabstable) so browser reloads can resume. - Add
/ws?tab=<id>handler that enforces tab ownership, wires to the relay, and streams structured status events (connected, reconnecting, closed). - Expose
/api/healthzaggregating downstream status so SREs can monitor the gateway itself. - Add migrations + DAO layer for the new
gateway_tabstable; include unit tests.
- Implement
-
React Tabbed UI
- Build a
TabManagercomponent with reducer/actions for open tabs, focus changes, and persistence vialocalStorage. - Create a
ProjectPickermodal that calls/api/projectsand handles empty/offline states. - Update
TerminalViewto acceptwsUrl+tabIdprops and to display project metadata (badge, status pill). - Add Vitest/RTL coverage for tab reducer, picker, and reconnect messaging.
- Instrument analytics/logging hooks so backend can correlate client actions with server events.
- Build a
-
Deployment & Security Hardening
- Add a Helm chart (or extend the existing one) for the gateway deployment, mounting the project catalog and the CNPG creds the gateway needs for tab persistence.
- Author NetworkPolicies that only allow the gateway namespace to reach each project service.
- Expose Prometheus metrics + logs for per-project visibility; ensure log lines include tab and project IDs.
- Provide runbooks for rotating CNPG credentials and gateway certificates without downtime.
- Decide on sticky session strategy (cookie affinity vs. shared relay store) before scaling to multiple gateway replicas.
-
Validation & Runbook
- Write an end-to-end validation script: open multiple tabs, verify each hits its project pod, simulate pod restarts, confirm reconnection works.
- Document troubleshooting steps (e.g., downstream pod offline, NetworkPolicy denies, catalog drift).
- Update DESIGN.md/README with the new architecture diagrams and operational guidance.
- Capture load-testing expectations (e.g., 20 concurrent tabs) and include soak test checklist.
- Add synthetic monitoring job that periodically opens a tab for each project to verify end-to-end connectivity.
-
Configuration & Secrets
- Added
AUTH_*env var plumbing tointernal/config, added validation, and surfaced the values in the Helm charts (deploy/helm/values*.yaml). - Documented secret handling plus helper instructions in
README.mdand exposedauth.jwtSecretSecretso operators can point to a Kubernetes Secret instead of embedding raw secrets.
- Added
-
Database Layer
- Created migrations for
kubetty_usersandkubetty_refresh_tokenswith citext usernames and indexed refresh token metadata. - Implemented
internal/auth/store.gofor user and refresh token CRUD with proper error handling.
- Created migrations for
-
Auth Manager & Tokens
- Built
internal/auth/manager.goto hash passwords, issue HMAC-SHA256 JWTs, rotate hashed refresh tokens, and validate incoming tokens.
- Built
-
HTTP Middleware & Handlers
- Added
/api/auth/login,/api/auth/me,/api/auth/refresh,/api/auth/logoutand wrapped all routes (including/ws) with middleware that enforces access tokens and injects user context. - Auth cookies are now Secure/HttpOnly and configurable via
AUTH_COOKIE_*env vars.
- Added
-
CLI & Ops Tooling
- Added
server/cmd/kubetty-authuserfor creating/updating/listing users and toggling activation states. - README now includes step-by-step auth enablement, user creation commands, and notes on token rotation.
- Added
-
Frontend Experience
- SPA probes
/api/auth/me, renders login UI when unauthenticated, sends credentials with every request, and shows logout/user info once logged in. - Session log requests now send cookies to remain operable under auth.
- SPA probes
-
Testing & Validation
- Ran
go test ./...andnpm --prefix web run build; tests currently rely on the embedded binaries without additional coverage at this stage.
- Ran
-
Secrets & User Bootstrap
- Seed the first user via
go run ./server/cmd/kubetty-authuser create .... - Store
AUTH_JWT_SECRETin a Kubernetes Secret and reference it from the Helmauthblock before enablingmode: local. - Document rotation steps in
README.md.
- Seed the first user via
-
Verification
- Manually verify login/refresh/logout flows via browser + curl (using cookies and Bearer tokens).
- Ensure
/session/logs+ gateway tab APIs continue working when auth is enabled. - Update any CI or rollout scripts to pass
AUTH_*env vars where needed.
-
Next Incorporations
- Consider adding health endpoints or metrics around login failures/refresh attempts once real usage starts.
- Monitor
kubetty_refresh_tokensgrowth and tune cleanup (viaauth.DeleteExpiredRefreshTokens) as part of ongoing maintenance.