Stage 5 · Platform
Release Packaging with Helm & Kustomize
Promotion Pipelines
GitOps repositories, Argo CD sync waves, Flux reconciliation, and environment promotion gates.
GitOps Promotion Model
GitOps uses Git as the source of truth for deployment. Promotion flows: commit to Git, CI builds and tests, CD applies to dev, promote to staging, promote to production. Each promotion is a Git commit that changes the target environment.
Developer commits code
-> CI pipeline builds and tests image
-> CI pushes image to registry
-> CI updates dev environment manifests (Git commit)
-> ArgoCD/Flux detects change and applies to dev
-> QA validates in dev
-> Promote to staging (Git commit to staging manifests)
-> ArgoCD/Flux applies to staging
-> Performance testing in staging
-> Promote to production (Git commit to production manifests)
-> ArgoCD/Flux applies to productionEvery promotion is a Git commit. This provides audit trail, rollback capability, and approval workflow. The CD tool watches Git and applies changes automatically.
Argo CD Sync Waves
Sync waves control the order of resource deployment. Resources with lower wave numbers deploy first. Use sync waves to ensure dependencies are met: namespaces before Deployments, Services before Ingresses, Secrets before Pods.
# Namespace first (wave 0)
apiVersion: v1
kind: Namespace
metadata:
name: production
annotations:
argocd.argoproj.io/sync-wave: "0"
---
# ConfigMap (wave 1)
apiVersion: v1
kind: ConfigMap
metadata:
name: app-config
annotations:
argocd.argoproj.io/sync-wave: "1"
---
# Deployment (wave 2)
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app
annotations:
argocd.argoproj.io/sync-wave: "2"
---
# Ingress (wave 3)
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: my-app
annotations:
argocd.argoproj.io/sync-wave: "3"
argocd.argoproj.io/sync-options: PruneLast=trueSync waves deploy resources in order: namespace (0), config (1), deployment (2), ingress (3). PruneLast=true ensures the resource is deleted last during uninstall. This prevents orphaned resources.
Flux Reconciliation
Flux reconciles Git repositories on a schedule. It detects drift and corrects it. Dependencies between Kustomizations ensure ordered deployment. Health checks verify each step before proceeding.
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: infrastructure
spec:
interval: 5m
path: ./infrastructure
sourceRef:
kind: GitRepository
name: manifests
---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: production-app
spec:
interval: 5m
path: ./apps/production
sourceRef:
kind: GitRepository
name: manifests
dependsOn:
- name: infrastructure
healthChecks:
- apiVersion: apps/v1
kind: Deployment
name: my-app
namespace: production
timeout: 3mdependsOn ensures infrastructure deploys before the application. healthChecks verifies the Deployment is healthy before marking reconciliation as successful. timeout limits how long to wait for health checks.
Promotion Gates
Promotion gates are conditions that must be met before promoting to the next environment: automated tests pass, approval from required reviewers, SLO compliance, and no active incidents.
# ArgoCD Application with promotion gates
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: my-app-production
annotations:
# Require approval from 2 reviewers
notifications.argoproj.io/subscribe.on-sync-succeeded.slack: production-deployments
spec:
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true
# Health checks must pass
ignoreDifferences:
- group: apps
kind: Deployment
jsonPointers:
- /spec/replicas # Ignore HPA-managed replicasPromotion gates ensure quality before production. Automated sync applies changes immediately after Git commit. For manual gates, disable automated sync and use argocd app sync command after approval.
Multi-Environment Promotion
Multi-environment promotion uses separate directories or branches per environment. Each environment has its own values file. Promotion is a Git commit that updates the image tag in the target environment's directory.
manifests/
base/
kustomization.yaml
deployment.yaml
service.yaml
overlays/
dev/
kustomization.yaml
values.yaml
staging/
kustomization.yaml
values.yaml
production/
kustomization.yaml
values.yaml
hpa.yaml
networkpolicy.yamlEach environment is a separate overlay. base/ contains common manifests. overlays/<env>/ contains environment-specific patches. Promotion commits update the image tag in the target overlay's kustomization.yaml.
Rollback Strategy
GitOps rollback is simple: revert the Git commit. ArgoCD/Flux detects the change and rolls back. For faster rollback, keep previous image tags in the overlay and switch between them.
# Option 1: Revert Git commit
git revert HEAD
git push
# Option 2: ArgoCD rollback
argocd app rollback my-app-production
# Option 3: Manual image tag change
# Edit overlays/production/kustomization.yaml
# Change newTag from "2.0.0" to "1.9.0"
# Commit and pushGitOps rollback is a Git operation. The CD tool applies the reverted state. This provides full audit trail and requires no special tooling. ArgoCD also supports direct rollback via CLI.
Use CI pipelines to automate promotion. After dev tests pass, create a PR to update staging values. After staging tests pass, create a PR to update production. Require manual approval for production.
Mark this lesson complete to store local progress and unlock a cleaner resume path the next time you visit.