deploy/k8s holds a Kustomize base (a Deployment and Service for each of the ten images, with the probes, settings and mounts from docs/deployment.md) and a prod overlay that pins every image to one commit SHA and routes only the admin portal and mobile-api's exact WhatsApp webhook path through Traefik with TLS. Secrets never enter git: deploy/k8s/secrets.example holds placeholders, the filled copy in deploy/k8s/secrets is ignored, and deploy/create-secrets.sh loads it without printing a value. deploy/set-release.sh pins or rolls back the release. deploy/check.sh (also a CI step) renders the overlay in one pinned container, validates it with kubeconform and refuses public routes to internal services, latest or untagged images, Secret data or literal secret env values, mixed SHAs and a second or rolling service-counter; --release also refuses unfilled cluster facts. --self-test proves each rule fires on its fixture. OpenSpec change: add-k8s-deployment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
2.7 KiB
2.7 KiB
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.mdsection 1, with the names, ports, health probes and settings it lists; - a
prodoverlay that pins every image to one commit SHA, sets the plain settings, and routes the public host through Traefik with TLS.
- a Deployment and a Service for each of the ten images in
- 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.mdso 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 andprodoverlay),deploy/k8s/secrets.example/,deploy/check.sh. - Changed:
docs/deployment.mdand.gitea/workflows/ci.yml(one manifest-check step). - No application code changes.
- No new dependencies in the repo. The check runs
kubectl kustomizeand 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.