Repository design and promotion
Typical layout (monorepo)
platform-gitops/
clusters/
dev-ap-south-1/ # flux-system + Kustomizations pointing below
staging-ap-south-1/
prod-ap-south-1/
infrastructure/
controllers/ # HelmReleases: aws-load-balancer-controller, cert-manager, external-secrets, karpenter...
configs/ # ClusterIssuers, StorageClasses, policies
apps/
base/orders/
dev/ # overlays per environment
staging/
prod/
Alternatives: repo per environment (strong access separation for prod), repo per team (apps) with the platform repo referencing them, or app config living in each service repo (simpler for teams, harder for platform-wide changes). Use directories, not branches, for environments — long-lived env branches drift and make merges painful.
Promotion
- CI builds image
orders:a1b2c3d, pushes to ECR, then opens a commit/PR changingapps/dev/orderstag. - Promotion to staging and prod = PRs changing the overlay tag (or a version in a shared file), with required reviews and checks for prod.
- Or Flux image automation:
ImageRepositoryscans ECR,ImagePolicyselects (semver range or a tag pattern with a timestamp/build number),ImageUpdateAutomationcommits the change; markers in YAML tell it what to update:
image: 123456789012.dkr.ecr.ap-south-1.amazonaws.com/orders:a1b2c3d # {"$imagepolicy": "flux-system:orders"}
Typically automated for dev/staging, PR-based for prod. Pin images by digest for full immutability where needed.
Progressive delivery
Flagger (Flux) or Argo Rollouts add canary and blue/green with automated analysis: shift 10% → 25% → 50% traffic via the ingress/service mesh, query Prometheus for error rate and latency, promote or roll back automatically. The GitOps commit changes the version; the rollout controller manages the traffic shifting.