Repository navigation
feat(project): secrets, health and release in cbox.yaml - #1
Closed
sylvesterdamgaard wants to merge 1 commit into
Closed
sylvesterdamgaard wants to merge 1 commit into
sylvesterdamgaard wants to merge 1 commit into
Conversation
Three keys a production manifest needs, read, compiled and deployed.
secrets: `VAR: { secret, key }` — an environment variable from a Secret
that already exists on the platform. Validated here (variable, Secret and
key names; no `optional`; no collision with env, a resource binding or
the url variable) and compiled to a secretKeyRef on every container by
cboxdk/platform's SecretReference. Never a value; a missing Secret stops
the pod with CreateContainerConfigError, which deploy now explains.
health: `{ path, liveness, token }` — the web process's probes. The token
must be a `secrets` entry: Kubernetes cannot put a Secret into a probe
header, so the platform compiles an exec probe that reads it from the
container's environment.
release: a command run to completion before anything rolls. The deploy
applies everything but the workloads, waits for the databases, runs the
release Job, and only on success applies the Deployments. A failure stops
the deploy with the release's output and leaves the running release
untouched; a pod that cannot start is reported within seconds rather than
after the Job's hour-long deadline. The Job is named for what it runs, so
the same release is not migrated twice and a failed one is retried.
Needs cboxdk/platform 0.12.0 (SecretReference, HealthCheck,
ReleaseJobCompiler). Until that is tagged, composer.json points at the
platform PR branch aliased as 0.12.0.
Contributor
Author
|
Closed: Cbox ID's production deployment is defined in cbox-infra (infra/kubernetes/cbox-id), not cbox.yaml, so the platform doesn't need these keys for it. Branch kept. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Do not merge before cboxdk/platform#1 is merged and tagged
v0.12.0.composer.jsoncurrently points at that PR branch (dev-feat/secrets-health-release as 0.12.0+ avcsrepository) so this branch's CI can run. Before merging: set"cboxdk/platform": "^0.12.0", drop therepositoriesentry,composer update cboxdk/platform,composer sbom, commit.Three keys cbox-id's production
cbox.yamlneeds, which the reader refused and the compiler could not express.secretsEnv var from a Secret that already exists in the project namespace. Compiled (platform
SecretReference) tovalueFrom.secretKeyRefon every container: web, every process,cbox run, the release. Never a value, neveroptional. Refused here: invalid variable / Secret / key names, settings other thansecret/key, a variable also underenv, also bound by a resource, or equal to theurlvariable. A missing Secret leaves the pod inCreateContainerConfigError; the deploy's blocked-pod message now namessecretsas the likely cause.healthWeb Deployment only. startup (liveness path, 2s × 150 = 5 min) → liveness (10s, 3 misses) and readiness (10s, 3 misses).
tokenmust name asecretsentry (refused underenvor missing): KuberneteshttpGetprobes take static headers only, so readiness with a token is anexecprobe —printf 'Authorization: Bearer %s\n' "${HEALTH_TOKEN}" | curl -fsS -o /dev/null --max-time 4 -H @- 'http://127.0.0.1:PORT/path'. The value never enters the pod spec or argv. Needscurlin the image (every Cbox base image has it).releaseProjectDeployernow sequences a deploy with a release (newReleaseRunner):Deployment/ScaledObject/HTTPScaledObject— the old release keeps servingCluster/StatefulSetto be ready (a first deploy's Postgres is seconds old and its app Secret does not exist yet)Complete/Failedcondition. ACompleteJob of the same name means this release already ran → skip. AFailedone is deleted and re-run. A pod stuck inCreateContainerConfigError/ImagePullBackOfffor 5 polls fails the deploy and deletes the Job instead of waiting out the 1h deadlineDry run: the Job is included in the single admission-only apply, nothing waits. No
release→ one apply, exactly as before.cbox pushdoes not carry the three keys (Cortex's/v1has no field for them);omitted()now says so and what to do in Cortex.Tests
tests/SecretsHealthReleaseTest.php— 38 tests: reader acceptance and every refusal, the compiledsecretKeyRefs and probes, push omissions, and the deploy order (release before workloads, failure rolls nothing, stuck pod, already-ran, retry-after-failure, timeout, dry run, no-release unchanged). Also checked by hand: cbox-id'scbox.yamlfromdocs/k8s-deploymentreads cleanly and compiles.Gates locally: pint, phpstan (max), pest 253 passed, license-check.
sbom.jsonregenerated (only the platform entry moved, and will move again with the constraint swap).