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.

Representative engineering design, not a verified client delivery record. Implementation steps and validation checks describe the proposed approach; no measured results are claimed.

CONTEXTRepresentative engineering design
TECHNICAL FOCUSFeature Branch Preview Environments with Kubernetes
STATUSRepresentative case study
PREVIEW LIFECYCLE
  1. Developer
  2. Feature branch
  3. CI build
  4. Container image
  5. Namespace
  6. Deploy & test
  7. Review
  8. Merge
  9. Destroy

Only the integration service is deployed here. AEM test endpoints and sanitized fixtures remain external dependencies.

01 / CONTEXT

A reviewable integration boundary

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 / 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.

04 / 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.

  • Inject preview-only secrets; never bake them into the image.
  • Use deterministic fixture data and contract tests alongside live integration tests.
  • Attach owner, pull-request and expiry metadata so abandoned resources can be identified.
05 / 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
  1. Branch
  2. Build
  3. Image
  4. Namespace
  5. Deploy
  6. Test
  7. Review
  8. Merge
  9. Destroy

Merge and branch closure request cleanup; a scheduled expiry reconciler catches missed events.

06 / 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.

07 / 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.

Continue with the complementary design in Dockerized AEM Development: Reproducible Setup and Configuration.

08 / 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.

  • 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.
09 / 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.

REFERENCE MATERIAL

Technical references

These sources document product behavior. The design and validation approach above are engineering proposals, not claims made by the vendors.

NEXT STEPS

Working through a similar platform problem?

This representative case study explores technical trade-offs and architectural decisions for a specific engineering scenario. If you are planning a similar migration, modernization, or integration, let's discuss the engineering approach.

Start a conversation
TECHNOLOGY STACK
KubernetesDockerCI/CDNamespacesNetworkPolicyJavaDNS