CASE 15 / KUBERNETES / PREVIEW / DEVELOPER EXPERIENCE
Feature Branch Preview Environments with Kubernetes
Design a disposable review environment for each change to an AEM-adjacent Java API. This scenario follows the complete lifecycle from branch creation to namespace removal, treating isolation, test data and cleanup as engineering requirements.
Engineering path
PREVIEW LIFECYCLE
Proposed engineering sequence
- 01Developer
- 02Feature branch
- 03CI build
- 04Container image
- 05Namespace
- 06Deploy & test
- 07Review
- 08Merge
- 09Destroy
01 / Context
A reviewable integration boundary
- PLATFORM
- Kubernetes / Docker
- SCOPE
- Feature Branch Preview Environments with Kubernetes
- TYPE
- Representative engineering scenario
A shared test API makes parallel changes interfere with one another. The proposed preview contains the API and its disposable dependencies, with either a controlled AEM test endpoint or a contract-compatible stub supplying content.
02 / PROBLEM
Isolation must include more than a URL
Separate hostnames do not separate credentials, outbound traffic or data. A namespace gives resources a scope, but the design also needs restrictive RBAC, supported network policies, resource quotas and a clear rule for which external systems a preview may contact.
03 / CONSTRAINTS
Boundaries the design must preserve
- Isolate preview configuration, credentials and routing from production.
- Give every temporary environment an owner and cleanup policy.
04 / ARCHITECTURE
One branch identity across infrastructure
Derive a bounded, DNS-safe identifier from the pull request and repository, not an arbitrary branch name alone. Use that identity for the namespace, routing host, configuration and fixture dataset; a controller-backed ingress or gateway exposes the review endpoint behind appropriate access controls.
PREVIEW LIFECYCLE
Only the integration service is deployed here. AEM test endpoints and sanitized fixtures remain external dependencies.
Feature Branch Preview Environments with Kubernetes
- Developer
- Feature branch
- CI build
- Container image
- Namespace
- Deploy & test
- Review
- Merge
- Destroy
05 / ENGINEERING APPROACH
Reconcile desired state from a trusted pipeline
Build an immutable image from the commit, then reconcile the namespace and manifests with narrowly scoped deployment credentials. Treat untrusted fork builds separately: they must not inherit cluster credentials or access private AEM endpoints.
Implementation checkpoints
Proposed engineering checks for this scenario.
- 01Inject preview-only secrets; never bake them into the image.
- 02Use deterministic fixture data and contract tests alongside live integration tests.
- 03Attach owner, pull-request and expiry metadata so abandoned resources can be identified.
06 / DEPLOYMENT FLOW
Publish a review URL only after validation
Wait for scheduling, startup and readiness before running smoke and integration checks. Associate test evidence and the URL with the exact commit so reviewers do not accidentally approve a stale deployment.
BRANCH TO CLEANUP
Merge and branch closure request cleanup; a scheduled expiry reconciler catches missed events.
- 01Branch
- 02Build
- 03Image
- 04Namespace
- 05Deploy
- 06Test
- 07Review
- 08Merge
- 09Destroy
07 / OPERATIONAL CONSIDERATIONS
Cleanup is part of environment ownership
Namespace deletion does not prove that external DNS records, provisioned databases or retained volumes are gone. Track these resources explicitly, retry idempotent cleanup and alert on namespaces stuck terminating rather than blindly removing finalizers.
08 / TRADEOFFS
Real integration versus predictable feedback
A shared AEM test instance preserves realistic integration behavior but can still couple previews through content and rate limits. Stubs offer faster, reproducible checks but need contract verification; neither mode establishes full production equivalence.
| Risk | Impact | Mitigation to validate |
|---|---|---|
| Namespace treated as complete isolation | Workloads retain unintended access | Review network, identity and resource policies |
| Cleanup misses resources | Preview infrastructure outlives the branch | Exercise merge, abandonment and failed-cleanup paths |
Continue with the complementary design in Dockerized AEM Development: Reproducible Setup and Configuration.
09 / WHAT I WOULD VALIDATE IN PRODUCTION
Prove isolation and expiry before expanding access
The intended result is a reproducible feedback loop with clear environment ownership. It remains a design objective until the lifecycle is exercised under failures.
Acceptance scope and limits
TO VALIDATE
Proposed checks, not captured results.
- Attempt cross-namespace access and forbidden outbound connections; inspect actual policy enforcement.
- Cancel a pipeline during deployment, close its branch and verify both in-cluster and external resources are removed.
- Update a branch during review and verify routing, fixtures and results refer to the new image digest.
- Exercise quota exhaustion, missing secrets and unavailable AEM dependencies without exposing credentials.
DOES NOT CLAIM
An anonymized architecture scenario for AEM-adjacent services. AEM remains on its separately supported deployment platform; this design does not place standard Adobe AEM deployments on Kubernetes. No production delivery or measured outcome is claimed.
- A completed customer deployment or measured production outcome
- A passing test run without retained execution evidence
10 / LESSONS
A preview is a lifecycle, not a namespace
Provisioning is the easy half of ephemeral infrastructure. The useful engineering unit is the full contract: trusted inputs, isolated dependencies, reproducible tests, discoverable ownership and verifiable destruction.
Technical references
These sources document product behavior. The scenario and proposed validation are engineering interpretations, not vendor claims or execution evidence.