Rollout and rollback
- Release readiness, traffic promotion, draining and recovery limits.
Diagram phase
Select a component to trace its direct connections. Drag to pan · Ctrl + wheel or pinch to zoom.
- A ReplicaSet keeps Pods running from one template. During a rolling update the old and new ReplicaSets can both have Ready Pods behind the same Service.
- Two new connections can reach different application versions during the overlap. Their database and artifact versions must work together for that window.
- Blue and green are two releases of the same domain application. The proposed preview Service lets the team exercise green while the active Service still selects blue.
- After the switch, allow endpoint updates to propagate and old connections to drain. Switching back depends on the retained blue release still understanding the data and artifacts.
Reading
Images and packaged delivery inputs
Kubernetes core/v1, apps/v1 and batch/v1 · Docker/OCI delivery concepts
What reaches each Pod
- Application images supply the WAR, settings and launch helpers.
- Init containers copy Java, Tomcat and dependency files into the Pod’s emptyDir.
- A replacement Pod repeats these copies. External artifacts arrive on a separate PVC.
Packaged SMS/APIGW dependencies
- Direct receives SMS/APIGW dependencies through its library image.
- The proposed CI build versions these libraries alongside the Direct adapters and verifies the local calls before packaging.
What an image cache saves
- Keep stable inputs early in the Dockerfile so a change to application settings can reuse the runtime layers.
- A warm node can skip downloading layers. Each new Pod still copies the runtime files into its own volume.
- Measure image transfer, file preparation and readiness separately.
Prepare files at startup
- Package shared libraries in an image. An init container copies them into a volume before the application starts.
- When reusing expanded files, verify their release identity before loading them.
Package dependency files · Dockerfile fragmentdockerfile
# Illustrative dependency carrier. CI supplies the selected library files.
ARG OS_IMAGE
FROM ${OS_IMAGE}
COPY libraries/ /payload/libraries/
Check an expanded WAR · shell fragmentbash
#!/bin/sh
# Illustrative expansion step. The application path is on a writable Pod volume.
set -eu
: "${APP_DIR:?set the application directory}"
if [ ! -d "$APP_DIR/WEB-INF" ]; then
mkdir -p "$APP_DIR"
(cd "$APP_DIR" && jar -xf /app/service.war)
fi
# A failed extraction can already have created WEB-INF.
# Verify release identity and completeness before reusing the tree.
Copy a runtime image into emptyDir · Pod fragmentyaml
# Pod spec fragment. The two image references are placeholders.
# The carrier image contains sh, cp and /payload/runtime.
volumes:
- name: runtime
emptyDir: {}
initContainers:
- name: copy-runtime
image: example.invalid/runtime-carrier:r1
command: ["sh", "-ec", "cp -R /payload/runtime/. /work/"]
volumeMounts:
- {name: runtime, mountPath: /work}
containers:
- name: application
image: example.invalid/service:r1
volumeMounts:
- {name: runtime, mountPath: /runtime}
# Set volume permissions for the image users and preserve required file modes.
Reduce repeated startup work
- Build and validate reusable security dependencies plus Direct adapters before changing how they are delivered.
- Consider stable Java/Tomcat layers and pre-expanded, versioned application files in immutable images; adjust mounts that would hide those files.
- Generate only Pod-specific writable configuration/work state at startup.
- Compare cold/warm pulls, copy/extraction, JVM initialization and readiness before selecting more init steps or a shared artifact store.
- Rebuild and test affected consumers when shared runtime/security dependencies change.
- The complete product CMC-OBRH WAR, including Camel, is an input to both separate Direct and IL assemblies.
- Direct-specific and IL-specific extension inputs are separate; selected SMS/APIGW compatibility components are shared inputs to both flavours.
- Jenkins/generated Gradle/Helm and supporting source folders do not by themselves prove complete affected-consumer rebuild selection.
- The sampled WAR carrier adds payload to /scratch/wars/; exact loading and archive/classloader mechanics remain unresolved.
- Resolve exact module/product membership and digests per assembly, then select every affected consumer on shared-component changes.
- Gate runnable images and releases on assembled-JVM compatibility, schema/config/state and capacity before blue-green promotion.
Candidate artifact identity
- Pin complete product-WAR, extension and shared compatibility inputs. Distinguish payload carriers from runnable images and deployed releases.
Compatible state and versions
- Gate candidates on configuration, schema, security-state and assembled-JVM compatibility. Rollback retains current approved policy.
Rollout capacity and failure cases
Rollout capacity and failure cases
Kubernetes apps/v1 and core/v1 · illustrative Proposed settings, not inspected Current values
Current source and illustrative tuning
- Inspected chart templates omit an explicit strategy; the Kubernetes default is RollingUpdate. Installed-release overrides remain unverified.
- The snippet below is an illustrative fragment to merge into a Deployment, not an observed OBRH setting.
- For three desired replicas, maxSurge=1 allows one extra non-terminating replica; maxUnavailable=0 waits for replacement availability before reducing available capacity. Terminating Pods can add resource demand.
Illustrative RollingUpdate Deployment fragmentyaml
# Illustrative fragment: merge into an existing apps/v1 Deployment.
# These are teaching values, not inspected OBRH chart settings.
spec:
replicas: 3
minReadySeconds: 10
progressDeadlineSeconds: 600
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
Evaluate the capacity contract
| Situation | Consequence | Required decision |
|---|---|---|
| No resources for the surge Pod | It can remain Pending while old Pods serve | Reserve headroom, reduce footprint or accept a different availability policy |
| Candidate fails readiness | Replacement does not become available | Diagnose the candidate; do not treat a longer timeout as a fix |
| Three old plus three Green replicas | Blue/green can require roughly twice steady-state replica capacity | Budget this per promoted domain; include startup/init/storage IO |
| Progress deadline expires | Deployment reports stalled progress; it does not automatically roll back | Release workflow decides stop, repair or compatible rollback |
- minReadySeconds=10 requires sustained readiness before availability. It is not a business-validation gate.
- The 600-second progress deadline is illustrative.
Retain the recovery inputs
- Keep Blue capacity and its image, common version, release files and compatible configuration through the rollback window.
- Selector changes propagate; established connections and accepted work can remain on Blue.
- Retire Blue only after the observed drain/retention policy permits it. A fixed sleep alone does not prove drain.
- Rolling updates are the confirmed release behavior; generated artifacts are not proof of successful activation.
- Effective drain/probe/worker and mixed-version contracts require validation.
- Use per-site blue-green active/preview switching and promote one site at a time.
- Retain Cisco active-active traffic while checking policy/key readiness, worker ownership and both-colour capacity.
Assembly and rollout tradeoffs
- Relevant alternatives are evaluated beside image assembly, artifact delivery and rollout; there is no standalone platform-alternatives diagram.
- The Current inventory is the confirmed sidecar/product/flavour architecture, not every platform option in a dependency tree.
- Deployed versions, benchmark limits and alternative activation remain unverified unless specifically evidenced.
- Evaluate ambient/waypoint, remote gRPC, geographic routing and shared cache changes against actual bottlenecks and ownership.
- Keep AI operations deferred until separately requested.
Payload and init-container carriers
- A payload image can stage WARs or JARs and then exit; its existence does not establish another running microservice.
- Image contents, enabled launch flags and observed deployment state are different parts of runtime composition.
- The inspected application launchers start a separate Java JMX exporter process; keep it in observability or runtime details.
Artifact storage choices
Kubernetes core/v1, apps/v1 and batch/v1 · Docker/OCI delivery concepts
Choose the prepared-file lifetime
- Ephemeral: every new Pod prepares its own files. A restart within that Pod can retain them.
- Persistent: compatible consumers can reuse immutable published versions, subject to backend, access-mode and topology constraints.
- Init containers and preparation Jobs populate storage; they are not storage types.
- Current already combines runtime/JAR emptyDir with an external-artifacts PVC. The proposal changes publication, compatibility and reuse.
Evaluate the mechanisms in their worked views
| Question | Worked example |
|---|---|
| What repeats for each new Pod? | Ordered init copies, mounts, validation and failed-init/replacement cases |
| What does a release actually identify? | R1/R2 manifests, common/V1 reuse, read-only paths and retained rollback inputs |
| When may consumers start? | Stage, verify, publish, complete the Job and explicitly gate deployment |
| How far can a storage failure spread? | Shared-backend versus independent domain/cluster storage |
Preview, promotion and rollback
Preview, promotion and rollback
Kubernetes apps/v1 and core/v1 · illustrative Proposed settings, not inspected Current values
Keep stable and preview traffic separate
- Prerequisite: two ready Deployments labelled app=example-api, release=R1 and release=R2 in domain-a. Their complete image/artifact identities must already be validated.
- api-active selects R1. api-preview selects R2. Neither Service creates Pods.
- These complete illustrative Service objects do not create Deployments, a PVC or a real OBRH API implementation.
Illustrative active and preview Servicesyaml
# Illustrative prerequisites: ready R1/R2 Deployments with matching Pod labels.
# Apply only after adapting the namespace, labels and port to the workload.
apiVersion: v1
kind: Service
metadata:
name: api-active
namespace: domain-a
spec:
selector:
app: example-api
release: R1
ports:
- name: http
port: 80
targetPort: 8080
---
apiVersion: v1
kind: Service
metadata:
name: api-preview
namespace: domain-a
spec:
selector:
app: example-api
release: R2
ports:
- name: http
port: 80
targetPort: 8080
Promote through an explicit gate
- Run from a release runner with kubectl, curl and jq, cluster DNS/network access and narrowly scoped permissions.
- Wait for Green, test the fixture endpoint through api-preview, then patch api-active. Adapt the example fixture URL/result to the actual business validation.
- The JSON Patch test checks that the active selector is still R1; a conflicting promotion fails instead of silently overwriting it. It is a guard on one API object, not a cluster-wide traffic transaction.
Illustrative guarded promotion and rollback commandsbash
#!/usr/bin/env bash
# Illustrative commands, not an automatic release pipeline.
# Prerequisites: publisher/compatibility gates passed; kubectl, curl, jq;
# runner inside the cluster network; actual API implements this test fixture.
set -euo pipefail
# R1 (api-blue) remains ready while R2 (api-green) is validated.
kubectl -n domain-a rollout status deployment/api-green --timeout=300s
curl --fail --silent --show-error \
http://api-preview.domain-a.svc.cluster.local/catalog/items/demo \
| jq -e '.id == "demo"' >/dev/null
# Compare-and-change one Service selector; conflicting promotions fail closed.
kubectl -n domain-a patch service api-active --type=json --patch='[
{"op":"test","path":"/spec/selector/release","value":"R1"},
{"op":"replace","path":"/spec/selector/release","value":"R2"}
]'
# Observe representative post-promotion behavior separately. Do not delete Blue
# or its immutable files before the drain and rollback-retention gate passes.
# Rollback is a SEPARATE action, only after checking retained Blue and confirming
# data/configuration compatibility. Run these commands only when rollback is chosen:
# kubectl -n domain-a rollout status deployment/api-blue --timeout=300s
# kubectl -n domain-a patch service api-active --type=json --patch='[
# {"op":"test","path":"/spec/selector/release","value":"R2"},
# {"op":"replace","path":"/spec/selector/release","value":"R1"}
# ]'
Distinguish promotion failure from rollback
| Failure point | Action | Remaining impact |
|---|---|---|
| Green rollout or preview test fails | Stop before changing api-active | Old release remains selected; preparation capacity was still consumed |
| Active target changes during another promotion | JSON Patch test fails | Reconcile the actual release owner; do not blindly retry |
| Post-promotion validation fails | Validate retained Blue and its data contract, then reverse the guarded selector change | Propagation and existing connections are still not instant |
| Blue files or compatible schema no longer exist | Do not promise immediate rollback | Restore the complete release or perform a forward recovery |
- The script deliberately does not scale down Blue or delete artifacts. Cleanup needs separate drain and retention evidence.
Compatibility before traffic promotion
Compatibility before traffic promotion
Kubernetes apps/v1 and core/v1 · illustrative Proposed settings, not inspected Current values
Check the complete release set
- Match the running image digests, common/V1 and release-specific files against the tested R1/R2 manifest.
- R2 can reuse common/V1 only after its integration/classpath/registration contract is validated. Published files alone do not establish that compatibility.
- Check API, configuration and shared-data/schema behavior while both versions can exist.
- Retain R1 files and a compatible data contract; switching the Service cannot undo an irreversible schema/data change.
Inspect the actual release manifests
- The release-identity map contains the concrete R1/R2 JSON and read-only consumer mount example.
- The publication map covers incomplete output, retries and the consumer-start gate. These are separate mechanisms from changing a Service selector.
Pod startup from image contents
Kubernetes v1 Pods, apps/v1 and batch/v1 · Node.js >=24 teaching protocol · illustrative release identities
Follow the files, not an image inheritance tree
- Image inputs: runtime carrier, dependency carrier, release/override carrier and consumer image have separate digest identities.
- Execution: three regular init containers copy those packaged files, in order, into this Pod’s
assembledemptyDir. - Consumption: the consumer mounts assembled files read-only; expansion, generated configuration, work, temp and logs use writable local volumes.
- SMS/APIGW dependencies are packaged content in the dependency image. Copying them is not proof of Direct integration or compatible local-call contracts.
- This composed Pod teaches the mechanism. It does not replace the source-bound inventory or assert that Current has only these inputs.
Illustrative Pod — ordered image-to-emptyDir copiesyaml
# Illustrative composed Pod, not an exact OBRH chart or deployable image set.
# Replace example digests; carriers must contain sh, cp and the stated /payload dirs.
# /payload/runtime includes executable start; UID/GID and permissions are image contracts.
apiVersion: v1
kind: Pod
metadata:
name: delivery-init-example
spec:
restartPolicy: Always
securityContext: {runAsUser: 1000, runAsGroup: 1000, fsGroup: 1000}
initContainers:
- name: copy-runtime
image: registry.example/runtime@sha256:1111111111111111111111111111111111111111111111111111111111111111
command: [sh, -ec]
args: ['mkdir -p /assembled/runtime; cp -R /payload/runtime/. /assembled/runtime/']
volumeMounts:
- {name: assembled, mountPath: /assembled}
- name: copy-dependencies
# SMS/APIGW dependencies are packaged files here, not service-call boxes.
image: registry.example/dependencies@sha256:2222222222222222222222222222222222222222222222222222222222222222
command: [sh, -ec]
args: ['mkdir -p /assembled/dependencies; cp -R /payload/dependencies/. /assembled/dependencies/']
volumeMounts:
- {name: assembled, mountPath: /assembled}
- name: copy-release-and-overrides
image: registry.example/release@sha256:5555555555555555555555555555555555555555555555555555555555555555
command: [sh, -ec]
args:
- mkdir -p /assembled/release /assembled/overrides;
cp -R /payload/release/. /assembled/release/;
cp -R /payload/overrides/. /assembled/overrides/
volumeMounts:
- {name: assembled, mountPath: /assembled}
containers:
- name: consumer
image: registry.example/consumer@sha256:3333333333333333333333333333333333333333333333333333333333333333
# Custom launcher contract: consume artifacts read-only, write below /local.
command: [/artifacts/runtime/start]
env:
- {name: ARTIFACT_ROOT, value: /artifacts}
- {name: RUNTIME_WRITE_ROOT, value: /local}
securityContext: {readOnlyRootFilesystem: true}
volumeMounts:
- {name: assembled, mountPath: /artifacts, readOnly: true}
- {name: local, mountPath: /local} # expanded apps/config/work/temp/logs
- {name: tmp, mountPath: /tmp}
volumes:
- {name: assembled, emptyDir: {sizeLimit: 2Gi}}
- {name: local, emptyDir: {sizeLimit: 2Gi}}
- {name: tmp, emptyDir: {sizeLimit: 128Mi}}
# Copy steps are repeatable into their own directories. Add checksums and clean
# extraction semantics for archives; a directory-exists shortcut is not integrity.
# Existing external-artifacts PVC inputs, if required, remain separately mounted.
Trace startup and the failure branch
- Runtime copy must finish before dependency copy; dependency copy must finish before release/override copy. The consumer starts after all succeed.
- A failed copy prevents the consumer from starting. Retry behavior follows the Pod restart policy; repeated init work must be safe against partial files.
- The example writes each carrier into its own directory. For real archives, validate checksums and extraction results; an existing directory alone does not establish completeness.
- Image layers already present on a node can avoid downloads. They do not copy those bytes into a replacement Pod’s new volume.
Distinguish restart from replacement
- An application-container crash preserves the same Pod’s emptyDir. Removing that Pod deletes its emptyDir; the replacement assembles a fresh one.
- Init work can be retried or rerun in documented Pod restart situations. Keep it idempotent; do not assume a durable release cache in emptyDir.
| Event | Prepared bytes | Operational consequence |
|---|---|---|
| Consumer container restarts in the same Pod | emptyDir remains | No guaranteed reassembly; still validate application recovery. |
| Failed init retries | Partial copied files may remain | Retry must overwrite safely or reject incomplete extraction. |
| Pod replaced on a warm node | New emptyDir is empty | Image may be local; filesystem copy still repeats. |
| Node local storage exhausted | Copy/work volume may fail | Size limits do not reserve node capacity. |
Evaluate repeated work explicitly
- Illustrative calculation: 12 replacement Pods × 600 MiB copied = 7,200 MiB of destination writes, even if every image is already local.
- Illustrative timing: a 6 s assembly step on each Pod is 72 Pod-seconds of work. Parallel scheduling means this is not automatically 72 s of rollout delay.
- Measure image resolution/pull, copy/extract, writable preparation and readiness separately. Shared storage may remove repeated immutable preparation while leaving local expansion and warm-up.
| Choice | Benefit | Cost / limit |
|---|---|---|
| Per-Pod emptyDir | Independent prepared copy; no artifact-PV mount for these files | Repeated writes and init failure path on replacement. |
| Versioned persistent files | Reuse already prepared compatible bytes | Backend/mount availability, publication gate and retention ownership. |
| Init writes to PVC | Can prepare persistent content | Needs the same locking/immutability rules; init does not mean ephemeral. |
Immutable release identity
Kubernetes v1 Pods, apps/v1 and batch/v1 · Node.js >=24 teaching protocol · illustrative release identities
R1 pins the complete selected set
- R1/R2 are releases of the same application, not customized binaries for different functional domains. Domain clusters can promote compatible release versions independently.
imagespins the runtime carrier, dependency carrier and consumer digests. The manifest also pinscommon/V1andreleases/R1file paths and SHA-256 values.- Image digests identify image content; mutable tags do not freeze a release. The repeated-digit digests here are clearly labelled placeholders.
- File hashes are real for the tiny
teachingPayloadstext fixtures. Real payloads need a complete file inventory or a checked archive plus validated extraction; this is not a real OBRH release. - Compatibility evidence must cover runtime, reusable dependencies, release/application/Direct integration, configuration and data/schema behavior. Matching hashes prove identity, not compatibility.
Illustrative R1 — pinned images and checksummed pathsjson
{
"exampleStatus": "Illustrative release contract, not a current OBRH release. Digests are placeholders; payload hashes are real for the teaching text below.",
"releaseId": "R1",
"images": {
"runtimeCarrier": "registry.example/runtime@sha256:1111111111111111111111111111111111111111111111111111111111111111",
"dependencyCarrier": "registry.example/dependencies@sha256:2222222222222222222222222222222222222222222222222222222222222222",
"consumer": "registry.example/consumer@sha256:3333333333333333333333333333333333333333333333333333333333333333"
},
"common": {
"version": "common/V1",
"files": [{"path": "bundle.txt", "sha256": "7e4e275e451b479e8a6f769aec0342e2101c12bad493cb989709ccf99b5ace99"}]
},
"release": {
"version": "releases/R1",
"files": [{"path": "bundle.txt", "sha256": "53c14942e128b97753ca06c2658b8746660fa42848c2fa966625010777fa40ed"}]
},
"teachingPayloads": {"common/bundle.txt": "common V1 teaching bytes\n", "release/bundle.txt": "release R1 teaching bytes\n"},
"compatibilityGate": "Illustrative accepted set: runtime/dependencies/application/Direct integration/configuration/schema; CI evidence must replace this sentence.",
"retainWhile": ["active", "selected rollback target"]
}
R2 reuses V1 without changing V1
- R2 keeps the exact
common/V1path and hashes. It selects new release-specificreleases/R2bytes and a new consumer digest. common/V1is an immutable dependency, not a directory called latest. If common content changes, publishcommon/V2and validate the new combination.- Common publication can be reused only where V1 is already verified in the consuming domain. R2 still needs its own release preparation and acceptance gate.
| Identity | R1 | R2 |
|---|---|---|
| Common bytes | common/V1 | Same path and hashes |
| Release bytes | releases/R1 | releases/R2 |
| Consumer image | Digest 333… | Digest 444… |
| Rollback set | Retain if active/selected | R1 remains available during R2 acceptance |
Illustrative R2 — unchanged common/V1, new release bytesjson
{
"exampleStatus": "Illustrative compatible successor. Common V1 is reused byte-for-byte; only release bytes and consumer identity change. Digests are placeholders.",
"releaseId": "R2",
"images": {
"runtimeCarrier": "registry.example/runtime@sha256:1111111111111111111111111111111111111111111111111111111111111111",
"dependencyCarrier": "registry.example/dependencies@sha256:2222222222222222222222222222222222222222222222222222222222222222",
"consumer": "registry.example/consumer@sha256:4444444444444444444444444444444444444444444444444444444444444444"
},
"common": {
"version": "common/V1",
"files": [{"path": "bundle.txt", "sha256": "7e4e275e451b479e8a6f769aec0342e2101c12bad493cb989709ccf99b5ace99"}]
},
"release": {
"version": "releases/R2",
"files": [{"path": "bundle.txt", "sha256": "b3d8d8fb8e63fd5bc560cbe95d154de35fc24cf7abe2c0668d7ff616fc0eced3"}]
},
"teachingPayloads": {"common/bundle.txt": "common V1 teaching bytes\n", "release/bundle.txt": "release R2 teaching bytes\n"},
"compatibilityGate": "Illustrative R2 validation allows common/V1; changed common bytes require V2 and renewed validation.",
"retainWhile": ["active", "selected rollback target"],
"rollbackTo": "R1"
}
Make consumption read-only and version-specific
- The R2 Pod mounts only
common/V1andreleases/R2through explicitsubPathentries, withreadOnly: true. It has no mutable latest lookup. - The launcher contract uses
COMMON_ROOTandRELEASE_ROOT; these names are illustrative application configuration, not Kubernetes features. - Writable generated files stay under
/localand/tmp. An application that mutates an installed tree must be adapted or copy that mutable portion locally. - Storage access modes describe supported mounts; they do not by themselves enforce write protection. Validate backend/CSI mode and topology, and restrict publisher identities.
Illustrative R2 Pod — exact read-only version mountsyaml
# Illustrative R2 consumer. Deploy only after exact common/V1 + releases/R2 gate.
# The publisher image, PVC, actual digest and launcher are deployment prerequisites.
# Mountability/sharing depends on CSI backend, access mode and node/zone topology.
apiVersion: v1
kind: Pod
metadata: {name: consumer-r2, namespace: domain-a}
spec:
securityContext: {runAsUser: 1000, runAsGroup: 1000, fsGroup: 1000}
containers:
- name: consumer
image: registry.example/consumer@sha256:4444444444444444444444444444444444444444444444444444444444444444
command: [/opt/consumer/start]
# These variable names are an illustrative launcher contract, not Kubernetes APIs.
env:
- {name: COMMON_ROOT, value: /artifacts/common/V1}
- {name: RELEASE_ROOT, value: /artifacts/releases/R2}
- {name: RUNTIME_WRITE_ROOT, value: /local}
securityContext: {readOnlyRootFilesystem: true}
volumeMounts:
- {name: artifacts, mountPath: /artifacts/common/V1, subPath: common/V1, readOnly: true}
- {name: artifacts, mountPath: /artifacts/releases/R2, subPath: releases/R2, readOnly: true}
- {name: local, mountPath: /local} # expansion/config/work/temp/logs stay local
- {name: tmp, mountPath: /tmp}
volumes:
- name: artifacts
persistentVolumeClaim: {claimName: domain-a-artifacts, readOnly: true}
- {name: local, emptyDir: {sizeLimit: 2Gi}}
- {name: tmp, emptyDir: {sizeLimit: 128Mi}}
# R1 rollback selects its retained digest + common/V1 + releases/R1 explicitly.
# Read-only mounts protect this consumer view; storage ACLs must exclude other writers.
Retain a usable rollback set
- Keep the union of artifacts referenced by active, pending and approved rollback manifests. R1 + R2 sharing V1 retains V1 once, plus both release directories.
- If V1 is 600 MiB and each release is 100 MiB, R1 + R2 use 800 MiB of artifact content before metadata/replication overhead. These numbers are illustrative.
- Reverting the image alone cannot recover a deleted release directory or undo an incompatible schema migration. Verify the old manifest, configuration and data contract before promotion.
- Garbage collection needs reference checks, reader drain, an approved retention window and the publisher’s serialization rule. Deleting a PVC is not version-level cleanup.
Prepare reusable files before rollout
Kubernetes v1 Pods, apps/v1 and batch/v1 · Node.js >=24 teaching protocol · illustrative release identities
Use a preparation Job with an explicit owner
- This optional pre-rollout step prepares reusable files on versioned storage before new OBRH consumers start. Per-Pod init copying remains a separate alternative; a Job is not required for every Deployment.
- The Job’s custom image contains Node, the publisher, an exact release manifest and payload directories. The example does not download tools at startup or claim that the placeholder image exists.
- Publish and verify common first, then release. A verified common/V1 can return
already-published; a different V1 identity fails closed. parallelism: 1limits that Job’s intended concurrency. Kubernetes can still start the same program twice; other Jobs and release attempts also exist. Serialization and idempotency remain required.
Illustrative Job — pinned preparer and checked publicationyaml
# Illustrative preparation Job, NOT an implicit prerequisite of any Deployment.
# Custom image prerequisites: Node >=24; /tools/artifact-publisher.cjs;
# /input/release.json matching artifact-release-r2.json; verified /payload/common
# and /payload/release. The included JSON uses text fixtures, not real binaries.
# Replace digest, size, namespace/PVC, UID/GID and CSI/access topology deliberately.
apiVersion: batch/v1
kind: Job
metadata: {name: prepare-r2, namespace: domain-a}
spec:
completions: 1
parallelism: 1
backoffLimit: 2
activeDeadlineSeconds: 300
template:
spec:
restartPolicy: Never
securityContext: {runAsUser: 1000, runAsGroup: 1000, fsGroup: 1000}
containers:
- name: publish
image: registry.example/preparer-r2@sha256:6666666666666666666666666666666666666666666666666666666666666666
command: [sh, -ec]
args:
- |
node /tools/artifact-publisher.cjs publish /store /payload/common /input/release.json common
node /tools/artifact-publisher.cjs publish /store /payload/release /input/release.json release
node /tools/artifact-publisher.cjs verify /store /payload/common /input/release.json common
node /tools/artifact-publisher.cjs verify /store /payload/release /input/release.json release
volumeMounts:
- {name: store, mountPath: /store}
volumes:
- name: store
persistentVolumeClaim: {claimName: domain-a-artifacts}
# Even parallelism:1 does not replace writer serialization/idempotency across
# retries, multiple Jobs or concurrent releases. Crash can leave a lock/stage.
Inspect the small publication protocol
- Acquire one root-level lock by exclusive directory creation. All publishers and cleanup must honor it; the example serializes concurrent releases rather than building a scheduler.
- Create a unique staging directory under the same storage root. Copy only declared regular files and validate every SHA-256 before publishing.
- Write the manifest receipt, then rename the complete stage to its absent immutable version path. Existing identical version: verify and reuse. Different manifest, hash or file set: reject.
- The protocol assumes atomic exclusive mkdir, same-filesystem directory rename and coherent visibility on the chosen backend. These are backend acceptance criteria, not a promise made by mounting a PVC.
- Trust the input manifest, source tree and parent directories. This teaching utility does not defend against hostile concurrent writers, symlink races or power loss; it does not fsync directories or files.
- The tiny text fixtures validate file bytes only. Executable modes, ownership and complete runtime-tree metadata are outside this utility; adopting this pattern for JDK/Tomcat trees requires those packaging contracts too.
Runnable local Node teaching publisher — explicit backend assumptionsjavascript
'use strict';
// Teaching protocol, Node >=24, no dependencies. TRUSTED inputs/parent directory only.
// Backend prerequisites: atomic exclusive mkdir and same-filesystem directory
// rename with coherent visibility to all clients. Validate these on the actual CSI
// backend; Node APIs alone do not establish distributed-filesystem guarantees.
// Every writer AND cleanup process must honor the one root-level lock.
// No automatic stale-lock removal, no fsync/power-loss durability guarantee,
// no hostile-writer/symlink-race protection. Published trees must be write-protected
// by storage identity/permissions. Consumers mount read-only.
const fs = require('node:fs/promises');
const path = require('node:path');
const {createHash} = require('node:crypto');
const hash = bytes => createHash('sha256').update(bytes).digest('hex');
const safe = value => typeof value === 'string' && /^[A-Za-z0-9_.-]+(?:\/[A-Za-z0-9_.-]+)*$/.test(value) && !value.split('/').some(x => x === '.' || x === '..');
function normalize(input) {
if (!input || !/^(common|releases)\/[A-Za-z0-9_-]+$/.test(input.version) || !Array.isArray(input.files) || !input.files.length) throw Error('Invalid bundle manifest');
const files = input.files.map(({path: name, sha256}) => {
if (!safe(name) || name === '.publication.json' || !/^[a-f0-9]{64}$/.test(sha256)) throw Error('Invalid path or checksum');
return {path: name, sha256};
}).sort((a,b) => a.path.localeCompare(b.path, 'en'));
if (new Set(files.map(x => x.path)).size !== files.length) throw Error('Duplicate path');
return {version: input.version, files};
}
async function regularBytes(filename) {
if (!(await fs.lstat(filename)).isFile()) throw Error('Expected regular file: ' + filename);
return fs.readFile(filename);
}
async function namesBelow(dir, prefix = '') {
const result = [];
for (const entry of await fs.readdir(dir, {withFileTypes:true})) {
const relative = prefix + entry.name;
if (entry.isDirectory()) result.push(...await namesBelow(path.join(dir, entry.name), relative + '/'));
else if (entry.isFile()) result.push(relative);
else throw Error('Non-regular published entry: ' + relative);
}
return result.sort();
}
async function verifyBundle(root, input) {
const manifest = normalize(input), final = path.join(root, manifest.version);
const recorded = JSON.parse(await regularBytes(path.join(final, '.publication.json')));
if (JSON.stringify(recorded) !== JSON.stringify(manifest)) throw Error('Existing version has different manifest');
const expected = [...manifest.files.map(x=>x.path), '.publication.json'].sort();
if (JSON.stringify(await namesBelow(final)) !== JSON.stringify(expected)) throw Error('Published file set differs');
for (const file of manifest.files) {
if (hash(await regularBytes(path.join(final, file.path))) !== file.sha256) throw Error('Published checksum mismatch: ' + file.path);
}
return {version: manifest.version, state:'verified'};
}
async function publishBundle(root, source, input) {
const manifest = normalize(input);
root = path.resolve(root); source = path.resolve(source);
await fs.mkdir(root, {recursive:true});
const lock = path.join(root, '.publisher-lock');
try { await fs.mkdir(lock); } catch (error) {
if (error.code === 'EEXIST') throw Error('Publisher lock held; do not remove without fencing its owner');
throw error;
}
let stage;
try {
const final = path.join(root, manifest.version);
let exists = false;
try { await fs.lstat(final); exists = true; } catch (error) { if (error.code !== 'ENOENT') throw error; }
if (exists) {
await verifyBundle(root, manifest); // Same identity+bytes: retry succeeds without rewriting.
return {version:manifest.version, state:'already-published'};
}
// Stage lives under root, so promotion does not cross filesystems.
stage = await fs.mkdtemp(path.join(root, '.stage-'));
for (const file of manifest.files) {
const bytes = await regularBytes(path.join(source, file.path));
if (hash(bytes) !== file.sha256) throw Error('Source checksum mismatch: ' + file.path);
const target = path.join(stage, file.path);
await fs.mkdir(path.dirname(target), {recursive:true});
await fs.writeFile(target, bytes, {flag:'wx'});
if (hash(await regularBytes(target)) !== file.sha256) throw Error('Staged checksum mismatch: ' + file.path);
}
await fs.writeFile(path.join(stage, '.publication.json'), JSON.stringify(manifest) + '\n', {flag:'wx'});
await fs.mkdir(path.dirname(final), {recursive:true});
await fs.rename(stage, final); // Cooperating writers serialized; final was absent.
stage = undefined;
await verifyBundle(root, manifest);
return {version:manifest.version, state:'published'};
} finally {
try {
if (stage) {
if (path.dirname(stage) !== root || !path.basename(stage).startsWith('.stage-')) throw Error('Unsafe staging cleanup target');
await fs.rm(stage, {recursive:true, force:true});
}
}
finally { await fs.rmdir(lock); }
}
}
module.exports = {hash, normalize, publishBundle, verifyBundle};
if (require.main === module) {
(async()=>{
const [action, root, source, filename, member] = process.argv.slice(2);
if (!['publish','verify'].includes(action) || !root || !source || !filename) throw Error('Usage: node artifact-publisher.cjs publish|verify ROOT SOURCE MANIFEST [common|release]');
const document = JSON.parse(await fs.readFile(filename, 'utf8'));
const manifest = member ? document[member] : document;
if (!manifest) throw Error('Manifest member missing');
console.log(JSON.stringify(await (action === 'publish' ? publishBundle(root,source,manifest) : verifyBundle(root,manifest))));
})().catch(error=>{console.error(error.message); process.exitCode=1;});
}
Gate consumer submission on verified completion
- The shell example creates the reviewed release Job, waits for its successful completion, and only then submits the reviewed R2 consumer Pod.
- A normal Deployment does not automatically wait for an unrelated Job. Helm/CI/GitOps must implement the dependency and stop on publication failure; Job YAML alone does not create it.
- Use unique release/attempt Job identities. A stale Completed Job cannot certify a new image/manifest. The Job’s pinned image and the consumer manifest must agree on the exact release set.
- Publication completion proves these publisher checks ran successfully. Compatibility, readiness, promotion and drain need their own acceptance evidence.
Illustrative release workflow — wait before consumer submissionbash
#!/bin/sh
# Illustrative CI gate. This file is NOT executed by Atlas tests.
# Requires kubectl context authorization, immutable reviewed Job/consumer manifests,
# unique Job name per release/attempt, compatible storage mounts and CI timeout policy.
# The Job's pinned image must contain the exact release manifest and publisher.
set -eu
# Before this point, CI validates the complete compatible release set and compares
# the consumer image + versioned paths to the approved R2 manifest. That validation
# is a prerequisite; these kubectl commands do not test application compatibility.
kubectl create -f artifact-preparation-job.yaml
kubectl -n domain-a wait --for=condition=complete job/prepare-r2 --timeout=320s
# Job completion means this image's publish+verify commands succeeded. A timeout,
# Failed Job or context/auth failure stops this script; no consumer is submitted.
kubectl create -f artifact-consumer-pod.yaml
# The consumer Pod is illustrative. A release controller would submit the reviewed
# Deployment then verify rollout/health. Do not repeatedly create an identically
# named Job and mistake a stale Complete result for verification of a new release.
# Retain R1 until promotion, drain and the approved rollback window finish.
Work the interruption cases before release
- A stage is never a consumer path. Ordinary caught failures remove only that attempt’s stage and lock; process/node loss can leave both behind.
| Failure | Visible result | Recovery / release decision |
|---|---|---|
| Wrong source hash | No final version | Stop; rebuild/resolve source identity. |
| Existing same version and bytes | Verified idempotent success | Reuse; do not rewrite. |
| Existing version has different bytes | Reject | Publish a new version after investigation. |
| Another release holds lock | Reject this attempt | Retry through the release workflow; do not break active owner. |
| Writer dies before rename | Orphan stage + possible lock; no final | Fence owner, inspect, clean abandoned state, retry. Age alone is not fencing. |
| Writer dies after rename | Complete final may exist; lock may remain | Fence owner, verify final, recover lock, retry idempotently. |
| Common published; release fails | Unreferenced valid common may remain | Consumer gate stays closed; later retry can reuse common. |
Know what the local POC establishes
- Run
node --test tests/artifact-examples.test.cjsfrom the repository root. Tests create only temporary local directories and execute both the API and CLI. - Covered outcomes: complete publication, unchanged retry, wrong source checksum, conflicting identity, damaged publication, held lock, retained R1/R2 and exact common/V1 reuse.
- These tests do not validate a CSI backend, multi-node cache consistency, crash durability, application compatibility or a live Kubernetes gate. Establish those separately before adopting the protocol.
Domain failure isolation
User-confirmed whole-application architecture · illustrative R1 and budgets · physical dependencies unverified
Same application, separate domain deployments
- User-confirmed baseline: the same OBRH application runs separately per functional domain/cluster. Domains do not mean customized code or domain-specific binaries.
- The map selects identical R1 image digests for A and B. Independent rollout schedules may temporarily select different compatible release versions of that same application.
- Not live evidence: cluster placement, image digests, budgets and actual shared DB/provider/storage/control-plane edges have not been verified here.
Non-Kubernetes teaching contract — same OBRH app, separate domain scopejson
{
"kind": "IllustrativeDomainIsolationPlan",
"apiStatus": "Teaching contract; NOT a Kubernetes resource, CRD, deployable configuration or observed estate",
"evidence": {
"baseline": "Current user-reported baseline: the same OBRH application is isolated by functional domain/cluster, without per-domain code customization",
"workedExample": "R1, digest, cluster names, worker budgets and physical placement are illustrative",
"unverified": "Actual routing, workload placement, quotas, shared physical infrastructure and external dependency topology"
},
"application": {
"identity": "OBRH",
"domainCodeCustomization": false,
"release": "R1",
"image": "registry.example.invalid/obrh@sha256:3333333333333333333333333333333333333333333333333333333333333333",
"digestStatus": "Placeholder image digest; no existence or runtime observation claimed",
"rolloutRule": "Independent domains may temporarily select compatible different releases of the same application; this is not domain-specific code"
},
"domains": [
{
"domain": "a", "cluster": "cluster-a", "applicationIdentity": "OBRH", "releaseRef": "R1", "imageRef": "application.image",
"trafficScope": "a-ingress-and-routing",
"requestWorkerBudget": {"id": "workers-a", "slots": 80, "sharedWithOtherDomain": false},
"applicationScope": "A replicas, executors, bounded queues and CPU/memory allocations",
"operationsScope": "A placement, rollout and recovery; no mandatory B rollout"
},
{
"domain": "b", "cluster": "cluster-b", "applicationIdentity": "OBRH", "releaseRef": "R1", "imageRef": "application.image",
"trafficScope": "b-ingress-and-routing",
"requestWorkerBudget": {"id": "workers-b", "slots": 80, "sharedWithOtherDomain": false},
"applicationScope": "B replicas, executors, bounded queues and CPU/memory allocations",
"operationsScope": "B placement, rollout and recovery; no mandatory A rollout"
}
],
"workedFailure": {
"event": "A occupies every local request-worker slot", "aOccupiedSlots": 80, "bOccupiedSlots": 20, "aFreeLocalSlots": 0, "bFreeLocalSlots": 60,
"qualification": "Local capacity arithmetic only; shared downstream exhaustion, retries and physical infrastructure can still couple service outcomes"
},
"conditionalSharedDependencies": [
{"kind": "database", "sharing": "unverified", "risk": "availability, sessions/connection limits, locks, schema changes and downstream contention"},
{"kind": "provider", "sharing": "unverified", "risk": "availability, rate limits, retry amplification and unknown outcomes"},
{"kind": "identity", "sharing": "unverified", "risk": "startup/runtime authorization or key refresh; actual cache/failure behavior matters"},
{"kind": "configuration", "sharing": "unverified", "risk": "startup/runtime reads, incompatible shared changes and recovery"},
{"kind": "storage", "sharing": "unverified", "risk": "required mounts/reads, immutable publication and accessible retained rollback versions"},
{"kind": "imageRegistry", "sharing": "unverified", "risk": "fresh pulls and recovery; cached images do not establish universal availability"}
],
"acceptanceChecks": [
"Verify domain request routes do not consume the other domain worker pool",
"Verify per-domain replica/executor/queue, admission and CPU/memory limits",
"Verify placement and shared host/network/management-system failure scope",
"Verify independent rollout/recovery controls and compatible release sets",
"Verify actual DB/provider/identity/config/storage/registry sharing and quotas",
"Namespace, PVC name and versioned paths alone are not an availability boundary"
],
"storageConcern": {
"role": "One dependency within whole-application/domain isolation",
"identity": "Immutable versions protect content identity; namespace/PVC/path separation protects ownership",
"availability": "Shared backend failure can affect both domains; actual backend independence is unverified",
"rollback": "Retained compatible artifacts must remain accessible; an image rollback does not restore deleted files or schema"
}
}
Contain the whole application failure
- Domain routing selects its own ingress and application replicas. Request workers, queues and CPU/memory allocations have separate local budgets.
- A burst or stuck A worker pool consumes A capacity. It does not directly take a B worker slot, and A recovery does not inherently require a B rollout.
- Node placement, cluster scheduling/reconciliation and release controls define additional failure and recovery scope. Different labels or namespaces alone are not this boundary.
- Separate clusters still need the physical dependency review: shared hosts, network, management systems or downstream services can create correlated failures.
Work the failure impact before claiming independence
Illustrative capacity: each domain has 80 worker slots. A has 80 occupied and B has 20: A has 0 free; B still has 60 free local slots. Useful throughput also depends on CPU, waits, admission and downstream capacity.
| Event | Domain A | Domain B / qualification |
|---|---|---|
| A request burst or worker exhaustion | A queues/rejects according to its own bounds | Does not consume B local worker slots; shared downstream contention may still affect B. |
| A application crash / bad rollout | A replicas or changed release need recovery | No B rollout is inherently required; the same latent software defect can independently fail in B if triggered. |
| A ingress failure | A entry path fails or loses capacity | B entry can continue when its route and required shared upstreams are healthy. |
| A node loss | Work placed on that node is lost; rescheduling needs headroom | B is protected only from that node failure if its workloads and dependencies are outside the failed node scope. |
| A cluster control-plane outage | A scheduling/reconciliation may stop; running Pods may continue | B control can continue if management infrastructure and required dependencies are healthy. |
| Shared DB / provider exhausted | A calls wait/fail; retries can add pressure | B may wait/fail too. Separate app pools do not isolate the shared service limit. |
| Shared identity / config unavailable | Effect depends on startup/runtime calls and caches | Can couple both; validate actual dependency and cache/fail behavior. |
| Registry / artifact storage unavailable | New pulls, mounts, publication or rollback may stop | Can affect both if shared; running work depends on local retained bytes and required runtime reads. |
Use the contract as a review checklist
- The JSON is a non-Kubernetes illustrative contract. It is not a resource, CRD, observed inventory or deployable configuration.
- Verify A/B routing, replica placement, worker/admission limits, CPU/memory budgets and rollout ownership against source and selected runtime evidence before certifying containment.
- For every shared dependency, identify availability, capacity/quota, retry, startup and recovery coupling. Independent local replica pools do not prove independent backend infrastructure.
- Storage is one concern: namespace/PVC/path separation and immutable versions protect ownership and identity. A shared backend can still fail both domains; retained rollback bytes must also remain accessible.
- Benefit: local workload incidents and operations have a smaller blast radius. Cost: duplicated reserved capacity, per-domain monitoring, release validation and recovery work.
Image layers and Pod startup
Dockerfile / BuildKit
What each image delivers
- The Direct and IL application images contain the WAR, settings and launch scripts.
- A separate runtime image supplies Java and Tomcat. An init container copies them into each new Pod’s emptyDir.
- Dependency images supply the selected libraries. Direct includes SMS/APIGW dependencies. External artifacts have separate mounts.
Application image inputs · simplified Dockerfiledockerfile
# Illustrative layout. Supply an approved OS image and the application files.
ARG OS_IMAGE
FROM ${OS_IMAGE}
COPY service.war /app/service.war
COPY settings/ /app/settings/
COPY launch.sh /app/launch.sh
# The chart mounts Java and Tomcat from the runtime volume at startup.
Runtime carrier · simplified Dockerfiledockerfile
# Illustrative carrier. The build context supplies a compatible runtime tree.
ARG OS_IMAGE
FROM ${OS_IMAGE}
COPY runtime/ /payload/runtime/
# A Pod init container selects this image and copies /payload/runtime.
Where startup spends time
- Each new Pod copies its runtime and libraries. A warm image cache saves the download and the copy still runs.
- The launcher expands the WAR and prepares JDBC libraries and Tomcat configuration. After a container restart, it can skip expansion when the application directory already exists.
- A partial extraction can leave that directory behind. Validate the complete release before reusing the files.
Init copy and consumer mount · Pod fragmentyaml
# Pod spec fragment. The two image references are placeholders.
# The carrier image contains sh, cp and /payload/runtime.
volumes:
- name: runtime
emptyDir: {}
initContainers:
- name: copy-runtime
image: example.invalid/runtime-carrier:r1
command: ["sh", "-ec", "cp -R /payload/runtime/. /work/"]
volumeMounts:
- {name: runtime, mountPath: /work}
containers:
- name: application
image: example.invalid/service:r1
volumeMounts:
- {name: runtime, mountPath: /runtime}
# Set volume permissions for the image users and preserve required file modes.
WAR expansion on startup · launcher fragmentbash
#!/bin/sh
# Illustrative expansion step. The application path is on a writable Pod volume.
set -eu
: "${APP_DIR:?set the application directory}"
if [ ! -d "$APP_DIR/WEB-INF" ]; then
mkdir -p "$APP_DIR"
(cd "$APP_DIR" && jar -xf /app/service.war)
fi
# A failed extraction can already have created WEB-INF.
# Verify release identity and completeness before reusing the tree.
Reduce rebuild work
| Change | Why it helps | Cost or prerequisite |
|---|---|---|
| Copy a stable WAR before frequently edited settings | Settings-only changes can reuse the WAR layer | Check which inputs change independently. |
| Set ownership as files enter the image | Avoid a recursive ownership pass after every payload change | Keep the launcher executable and volumes writable by the application user. |
| Copy only the final runtime tree from a build stage | Temporary archives and extraction trees stay out of the final image | Preserve required tools, libraries, certificates and file modes. |
Set file ownership during the builddockerfile
# syntax=docker/dockerfile:1
# Illustrative build. Supply a digest-pinned Linux image with user/group tools.
ARG OS_IMAGE
FROM ${OS_IMAGE}
RUN groupadd --system app && useradd --system -g app app
WORKDIR /app
# Keep the more stable WAR layer reusable when settings or scripts change.
COPY --chown=app:app service.war /app/service.war
COPY --chown=app:app settings/ /app/settings/
COPY --chown=app:app --chmod=0755 launch.sh /app/launch.sh
USER app
ENTRYPOINT ["/app/launch.sh"]
Publish a common runtime parentdockerfile
# syntax=docker/dockerfile:1
# Supply approved OS and runtime-carrier digests. The carrier provides both trees.
ARG RUNTIME_PAYLOAD_IMAGE
ARG OS_IMAGE
FROM ${RUNTIME_PAYLOAD_IMAGE} AS payload
FROM ${OS_IMAGE}
# The final OS must supply the shared libraries used by the copied binaries.
COPY --from=payload /payload/java/ /opt/java/
COPY --from=payload /payload/tomcat/ /opt/tomcat/
ENV JAVA_HOME=/opt/java CATALINA_HOME=/opt/tomcat
# Publish the parent by digest. The child supplies the runtime user and launcher.
Move WAR expansion into the build
- Use the common runtime as the parent of the application image and add the expanded WAR in a release layer. A runtime patch now requires rebuilding and testing every dependent image.
- Adjust the launcher and chart mounts together. A volume mounted over the baked runtime hides those files. Keep generated configuration, temp files and logs in writable Pod-local paths.
- Compare cold pulls, warm Pod restarts, init copy, expansion and time to readiness. Pre-expansion can add image bytes and shift work into CI.
Expand the WAR in a build stagedockerfile
# syntax=docker/dockerfile:1
# Supply the runtime parent by digest. It provides Java, Tomcat and jar.
ARG RUNTIME_IMAGE
FROM ${RUNTIME_IMAGE} AS unpack
COPY service.war /tmp/service.war
WORKDIR /tmp/expanded
RUN "$JAVA_HOME/bin/jar" -xf /tmp/service.war && test -d WEB-INF
FROM ${RUNTIME_IMAGE}
COPY --from=unpack /tmp/expanded/ /opt/app/
COPY --chmod=0755 launch-prepared.sh /opt/bin/launch-prepared.sh
# The launcher must configure Tomcat to serve /opt/app, use writable Pod-local
# state under CATALINA_BASE and load the selected libraries and certificates.
ENV CATALINA_BASE=/local/tomcat
USER 10001:10001
ENTRYPOINT ["/opt/bin/launch-prepared.sh"]
Tie container exit to the application
- The current launcher backgrounds Tomcat and the metrics exporter, then follows the application log. A JVM crash can leave the log reader running until the health policy intervenes.
- After preparation, run Tomcat in the foreground. Give the exporter its own supervised lifecycle and test the revised stop hook, probes and request drain.
- Verify JVM exit, exporter exit and termination during a request. Retain the previous image and mount configuration for rollback.
Start Tomcat after preparationbash
#!/bin/sh
# Final launcher step after configuration, JDBC and certificates are ready.
# Requires a supervised exporter and a chart with compatible drain and stop hooks.
set -eu
: "${CATALINA_HOME:?set Tomcat home}"
: "${CATALINA_BASE:?set the writable Tomcat base}"
test -x "$CATALINA_HOME/bin/catalina.sh"
test -d "$CATALINA_BASE/conf"
exec "$CATALINA_HOME/bin/catalina.sh" run
Image selection and release rollback
Helm 3
Who selects the image
- CI/CD selects the application and init image versions while generating the Deployment template. Helm supplies the registry and environment when it renders that template.
- A tag override only affects an image field that reads it. In the worked chart, each component takes its own repository, tag and optional digest from values.yaml. The helper uses the digest when supplied.
Default image and artifact valuesyaml
# ILLUSTRATIVE identities; example.invalid and repeated-digit digests do not run.
# Values own all image versions; templates contain no image tag/digest literals.
replicaCount: 1
images:
app:
repository: example.invalid/obrh/consumer
tag: "r1"
digest: "sha256:3333333333333333333333333333333333333333333333333333333333333333"
verifier:
repository: example.invalid/obrh/artifact-verifier
tag: "v1"
digest: "sha256:1111111111111111111111111111111111111111111111111111111111111111"
artifacts:
claimName: prepared-artifacts
commonPath: common/V1
releasePath: releases/R1
# Prerequisite: publication/compatibility gate approved these immutable paths.
# The custom verifier image supplies verify-release; this chart does not publish.
runtime:
uid: 10001
gid: 10001
Select a digest or taggotemplate
{{/* Digest wins over the human-readable tag. Empty digest demonstrates tag mode. */}}
{{- define "atlasReview.image" -}}
{{- $repo := required "image repository is required" .repository -}}
{{- if .digest -}}
{{- printf "%s@%s" $repo .digest -}}
{{- else -}}
{{- printf "%s:%s" $repo (required "image tag or digest is required" .tag) -}}
{{- end -}}
{{- end -}}
Follow one upgrade
| Input | R1 | R2 |
|---|---|---|
| Application | Image pinned to the R1 digest | Image pinned to the R2 digest |
| Common files | common/V1 | Reuse compatible common/V1 |
| Release files | releases/R1 | Mount releases/R2 |
- The verifier init container and application mount the selected files read-only. The application prepares its writable state separately.
- Keep the chart package and effective values together. The chart version identifies the template package.
appVersiondescribes the application. The rendered Deployment selects the image.
R1 valuesyaml
# Recorded R1 override fixture. Unspecified keys inherit this chart's values.yaml.
images:
app:
tag: "r1"
digest: "sha256:3333333333333333333333333333333333333333333333333333333333333333"
artifacts:
commonPath: common/V1
releasePath: releases/R1
R2 valuesyaml
# R2 reuses compatible common/V1; app and release-specific files change together.
images:
app:
tag: "r2"
digest: "sha256:4444444444444444444444444444444444444444444444444444444444444444"
artifacts:
commonPath: common/V1
releasePath: releases/R2
Deployment image and volume bindingsyaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-consumer
labels:
app.kubernetes.io/name: {{ .Release.Name }}-consumer
helm.sh/chart: {{ printf "%s-%s" .Chart.Name .Chart.Version | quote }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: {{ .Release.Name }}-consumer
template:
metadata:
labels:
app.kubernetes.io/name: {{ .Release.Name }}-consumer
spec:
securityContext:
runAsNonRoot: true
runAsUser: {{ .Values.runtime.uid }}
runAsGroup: {{ .Values.runtime.gid }}
fsGroup: {{ .Values.runtime.gid }}
initContainers:
- name: verify-published-release
image: {{ include "atlasReview.image" .Values.images.verifier | quote }}
imagePullPolicy: IfNotPresent
command: ["/opt/obrh/bin/verify-release"]
args: ["/published/common", "/published/release"]
securityContext:
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
volumeMounts:
- name: artifacts
mountPath: /published/common
subPath: {{ required "commonPath is required" .Values.artifacts.commonPath | quote }}
readOnly: true
- name: artifacts
mountPath: /published/release
subPath: {{ required "releasePath is required" .Values.artifacts.releasePath | quote }}
readOnly: true
containers:
- name: consumer
image: {{ include "atlasReview.image" .Values.images.app | quote }}
imagePullPolicy: IfNotPresent
command: ["/opt/obrh/bin/launch-prepared.sh"]
env:
- name: COMMON_ROOT
value: /artifacts/common
- name: RELEASE_ROOT
value: /artifacts/release
securityContext:
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
volumeMounts:
- name: artifacts
mountPath: /artifacts/common
subPath: {{ .Values.artifacts.commonPath | quote }}
readOnly: true
- name: artifacts
mountPath: /artifacts/release
subPath: {{ .Values.artifacts.releasePath | quote }}
readOnly: true
- name: local
mountPath: /local
- name: tmp
mountPath: /tmp
volumes:
- name: artifacts
persistentVolumeClaim:
claimName: {{ .Values.artifacts.claimName | quote }}
- name: local
emptyDir: {}
- name: tmp
emptyDir: {}
Chart metadatayaml
apiVersion: v2
name: atlas-release-review
description: Local rendering example for pinned images and retained artifact paths
type: application
version: 0.1.0
appVersion: "teaching-app-1"
What rollback can restore
- For a Helm-managed release, identify the prior revision with
helm history RELEASE. Helm rollback applies its recorded resource definitions and creates a new release revision. - For an Argo CD–managed application using Helm rendering, revert the desired version in Git and reconcile it.
| Failure after promotion | Recovery depends on |
|---|---|
| Wrong image or artifact path | Prior Deployment references and their retained image digests and files. |
| Incompatible database migration | A data/schema contract the old application can use. |
| Damaged release files or unavailable storage | Verified artifact contents and an accessible volume before consumers start. |
- Rendering the same chart with R1, R2 and R1 values exercises image and path selection offline. A live rollback additionally requires retained Helm release history.