Files
co-lite/openspec/changes/archive/2026-12-03-add-k8s-deployment/proposal.md
T

47 lines
2.7 KiB
Markdown

# Proposal
## Why
Phase 1 ends with Co-Lite running on the team's Kubernetes cluster before go-live on 15 January 2027. CI already publishes the images, and `docs/deployment.md` describes the environment the images need. Nobody has written the Kubernetes manifests yet, so every deploy would be typed by hand from a long document. That invites mistakes in the things that matter most: which paths are public, where secrets come from, and which image version runs.
## What Changes
- Add a `deploy/k8s/` folder with Kustomize manifests for the whole system:
- a Deployment and a Service for each of the ten images in `docs/deployment.md` section 1, with the names, ports, health probes and settings it lists;
- a `prod` overlay that pins every image to one commit SHA, sets the plain settings, and routes the public host through Traefik with TLS.
- Expose only two things to the internet: the admin portal, and mobile-api's WhatsApp webhook path. Nothing else gets a route.
- Keep every secret out of git. The manifests only refer to Secrets and mounted files by name. Add a checked-in template and a script that creates them from local files the deployer fills in and never commits.
- Add a check script, run locally and in CI, that renders the manifests and fails if:
- a route reaches anything other than the portal or the webhook path;
- an image uses `latest`;
- a Secret value appears in the rendered output;
- service-counter has more than one replica.
- Update `docs/deployment.md` so the deploy steps use the manifests (`kubectl apply -k`) instead of describing them in prose. Add the rollback steps.
Out of scope:
- MySQL and Redis: the DBA's MySQL and the existing Redis stay outside the cluster manifests.
- The Pub/Sub project and key.
- Choosing an email provider.
- Connecting WhatsApp in Meta.
## Capabilities
### New Capabilities
- `cluster-deployment`: how Co-Lite is described and rolled out on Kubernetes. It covers what is exposed publicly, how secrets are supplied, how image versions are pinned, and how a release is rolled back.
### Modified Capabilities
None. `release-packaging` (how images are built and published) does not change.
## Impact
- **New:** `deploy/k8s/` (base and `prod` overlay), `deploy/k8s/secrets.example/`, `deploy/check.sh`.
- **Changed:** `docs/deployment.md` and `.gitea/workflows/ci.yml` (one manifest-check step).
- **No application code changes.**
- **No new dependencies in the repo.** The check runs `kubectl kustomize` and kubeconform from pinned container images, so the machine needs only Docker.
- **The real cluster needs:**
- Traefik, with its IngressRoute CRD;
- a pull secret for `gitea.containerverse.dev`;
- the DNS record for `co-lite.containerverse.dev`.