feat(deploy): Kubernetes manifests, secret and release scripts, manifest check #67

Merged
ngqile merged 2 commits from add-k8s-deployment into main 2026-12-03 11:07:21 +00:00
Owner

This is the last phase 1 change, OpenSpec add-k8s-deployment (new capability cluster-deployment). It adds the Kubernetes files, scripts and checks needed to deploy Co-Lite to the team's cluster.

Manifests

  • deploy/k8s/base: a Deployment and a Service for each of the ten images, with the names, ports, probes, settings and mounts from docs/deployment.md.
  • service-counter runs as one replica with Recreate, so the daily summary is never sent twice.
  • deploy/k8s/overlays/prod:
    • pins one commit SHA for every image;
    • generates the plain settings;
    • has two Traefik IngressRoutes: the admin portal, and exactly mobile-api's /api/public/whatsapp/webhook.

Secrets

  • Placeholder templates are in deploy/k8s/secrets.example. The filled-in copy goes in deploy/k8s/secrets/, which git ignores.
  • deploy/create-secrets.sh creates the namespace and the Secrets, including the registry pull secret. It refuses to run while anything is missing or still a placeholder, and it never prints a value.

Release

  • deploy/set-release.sh <sha> pins a release or rolls one back.

Check (deploy/check.sh, also a new CI step)

  • It runs in one pinned alpine/k8s container: kustomize render, kubeconform with the Traefik CRD schema, then rules that refuse:
    • a public route to an internal service, or a NodePort or LoadBalancer Service;
    • an image on latest, untagged, or not on one shared SHA;
    • Secret data, or a literal secret value in an env var;
    • more than one service-counter replica, or a rolling update for it;
    • any of the ten services missing.
  • --release also refuses any <…> cluster fact left unfilled.
  • --self-test proves each rule fires on its fixture (12 of 12).

Bugs found while building, all fixed

  • mobile-api has no liveness or readiness path unless MANAGEMENT_HEALTH_PROBES_ENABLED=true. This was proven on a throwaway container, and the setting is now applied.
  • service-email's overall health is 503 without a mail server, so the startup probe uses the liveness path.
  • A SHA made only of digits rendered as a number, so the tags are now quoted.
  • The first create-secrets.sh run came before the namespace existed. The script now creates it.

Docs: docs/deployment.md sections 2 and 9 now cover the scripts, rollback, the settings left unset on purpose, and the cluster facts still to confirm.

Still open (task 6.2): a server-side dry run against the real cluster. It needs cluster access and the cluster facts (cert resolver, Redis and MySQL hosts, GCP project, pull secret name).

Not run: Maven and vitest, because no module source or build file changed.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs

This is the last phase 1 change, OpenSpec `add-k8s-deployment` (new capability `cluster-deployment`). It adds the Kubernetes files, scripts and checks needed to deploy Co-Lite to the team's cluster. **Manifests** - `deploy/k8s/base`: a Deployment and a Service for each of the ten images, with the names, ports, probes, settings and mounts from `docs/deployment.md`. - service-counter runs as one replica with `Recreate`, so the daily summary is never sent twice. - `deploy/k8s/overlays/prod`: - pins one commit SHA for every image; - generates the plain settings; - has two Traefik IngressRoutes: the admin portal, and exactly mobile-api's `/api/public/whatsapp/webhook`. **Secrets** - Placeholder templates are in `deploy/k8s/secrets.example`. The filled-in copy goes in `deploy/k8s/secrets/`, which git ignores. - `deploy/create-secrets.sh` creates the namespace and the Secrets, including the registry pull secret. It refuses to run while anything is missing or still a placeholder, and it never prints a value. **Release** - `deploy/set-release.sh <sha>` pins a release or rolls one back. **Check** (`deploy/check.sh`, also a new CI step) - It runs in one pinned `alpine/k8s` container: kustomize render, kubeconform with the Traefik CRD schema, then rules that refuse: - a public route to an internal service, or a NodePort or LoadBalancer Service; - an image on `latest`, untagged, or not on one shared SHA; - Secret data, or a literal secret value in an env var; - more than one service-counter replica, or a rolling update for it; - any of the ten services missing. - `--release` also refuses any `<…>` cluster fact left unfilled. - `--self-test` proves each rule fires on its fixture (12 of 12). **Bugs found while building, all fixed** - mobile-api has no liveness or readiness path unless `MANAGEMENT_HEALTH_PROBES_ENABLED=true`. This was proven on a throwaway container, and the setting is now applied. - service-email's overall health is 503 without a mail server, so the startup probe uses the liveness path. - A SHA made only of digits rendered as a number, so the tags are now quoted. - The first `create-secrets.sh` run came before the namespace existed. The script now creates it. **Docs:** `docs/deployment.md` sections 2 and 9 now cover the scripts, rollback, the settings left unset on purpose, and the cluster facts still to confirm. **Still open** (task 6.2): a server-side dry run against the real cluster. It needs cluster access and the cluster facts (cert resolver, Redis and MySQL hosts, GCP project, pull secret name). **Not run:** Maven and vitest, because no module source or build file changed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
ngqile added 2 commits 2026-12-03 11:07:18 +00:00
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
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
ngqile merged commit c17d2f4bf3 into main 2026-12-03 11:07:21 +00:00
ngqile deleted branch add-k8s-deployment 2026-12-03 11:07:21 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ngqile/co-lite#67