Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
4.2 KiB
cluster-deployment Specification
Purpose
Describe how Co-Lite is rolled out to Kubernetes from manifests in the repository, so that public exposure, secrets, image versions and rollback are fixed in reviewed files rather than typed by hand.
Requirements
Requirement: One manifest set deploys the whole system
The repository SHALL hold Kubernetes manifests that create a Deployment and a Service for each published image. The Service names and ports MUST be the ones the gateway, mobile-api and the portal already expect (docs/deployment.md section 1). Each Java service MUST have liveness and readiness probes on its actuator health endpoints. The admin portal MUST have a probe that needs no session.
Scenario: Apply brings every service up
- GIVEN a cluster where the Secrets, the mounted files, the database and the image pull secret already exist
- WHEN the deployer applies the
prodoverlay - THEN a Deployment and a Service exist for all ten images under the expected names and ports
- AND every pod becomes ready
Scenario: Unhealthy pod gets no traffic
- GIVEN a Java service whose readiness endpoint reports down
- WHEN Kubernetes checks the pod
- THEN the pod is not ready and its Service sends it no requests
Requirement: Only the portal and the WhatsApp webhook are public
The manifests SHALL route the public host, over TLS, to the admin-portal Service. They SHALL route exactly the path /api/public/whatsapp/webhook to the mobile-api Service. No other Service may be reachable from outside the cluster. The repository's manifest check MUST fail when a route targets any other Service or path.
Scenario: Gateway is not reachable from the internet
- WHEN the rendered
prodmanifests are checked - THEN no route targets
api-gatewayor anyservice-* - AND the only route to
mobile-apimatches exactly/api/public/whatsapp/webhook
Scenario: A new route is caught
- GIVEN a manifest change that adds a route to
api-gateway - WHEN the manifest check runs
- THEN it fails and names the route
Requirement: Secrets never enter the repository
The manifests SHALL refer to Secrets and mounted files only by name. The repository MUST NOT hold any real secret value. Secret templates hold placeholders only. The script that creates the Secrets MUST read the values from files that git ignores.
Scenario: Rendered manifests hold no secret data
- WHEN the
prodoverlay is rendered - THEN it contains no
Secretobject with data - AND the manifest check fails if one appears
Scenario: Filled-in secret files cannot be committed
- GIVEN a deployer who fills in the secret files under the secrets folder
- WHEN they run
git status - THEN those files are ignored
Requirement: Releases are pinned by commit and can be rolled back
The prod overlay SHALL pin every image to one commit SHA, never latest. Rolling back MUST be done by setting the previous SHA and applying again. The deployment docs MUST describe both steps. Before a real apply, a release check MUST refuse any cluster fact still left as a placeholder.
Scenario: latest is refused
- GIVEN a
prodoverlay where an image tag islatestor missing - WHEN the manifest check runs
- THEN it fails and names the image
Scenario: Unfilled cluster fact refused before apply
- GIVEN a
prodoverlay that still holds a<…>placeholder, such as the MySQL host - WHEN the deployer runs the release check
- THEN it fails and names each placeholder
Scenario: Roll back to the previous release
- GIVEN a release at SHA B that misbehaves, with SHA A deployed before it
- WHEN the deployer sets the overlay to SHA A and applies it
- THEN every Deployment rolls back to the SHA A images
Requirement: Single-run jobs stay single
service-counter SHALL run as exactly one replica. It sends the daily follow-up summary, and two replicas would send it twice. The manifest check MUST fail when service-counter has more than one replica.
Scenario: Counter scaled by mistake
- GIVEN a manifest change that sets service-counter to two replicas
- WHEN the manifest check runs
- THEN it fails