Skip to main content
Source

This page is generated from skills/eks-platform-engineering/references/gitops-delivery.md. Edit the source, not this page.

GitOps Delivery — ArgoCD + Argo Workflows

The delivery backbone. Git is the single source of truth; ArgoCD reconciles cluster state to match; Argo Workflows runs the build pipelines that feed it.

Division of labor​

  • Argo Workflows (+ Argo Events) = CI. Webhook-triggered, container-native pipelines that build images, run tests, push to ECR, and update deployment manifests in Git.
  • ArgoCD = CD. Watches Git, detects manifest changes, syncs them to the target cluster, reports sync/health, and detects drift.

Keeping CI and CD separate (rather than one monolithic pipeline) means a failed build never half-deploys, and the deployed state is always exactly what's in Git.

Never fix an ArgoCD-managed resource imperatively. With self-heal on, ArgoCD syncs again when the live cluster's state deviates from Git, and retries with a backoff even on the same commit, so a kubectl patch, edit or scale on a managed resource is reverted, and repeating it produces a flap loop (unless the field is not in Git, as the docs advise for replicas under an HPA, or is in ignoreDifferences with RespectIgnoreDifferences=true). Make the change in Git (an MR/PR) and let ArgoCD sync it. If the live cluster must change first, use a scoped, recorded break-glass window: record that one Application's spec.syncPolicy.automated block (argocd app get <app> -o yaml), then switch it to manual sync (argocd app set <app> --sync-policy none); turning off self-heal alone does not hold the fix, since the next commit still auto-syncs. Instead, on Argo CD v3.1 or later, spec.syncPolicy.automated.enabled: false pauses auto-sync and keeps the prune and selfHeal settings; no argocd app set flag turns it off on an Application that already auto-syncs, so patch it (argocd app patch <app> --type merge --patch '{"spec":{"syncPolicy":{"automated":{"enabled":false}}}}') or change it in Git, and restore by setting it back to true, not with --sync-policy automated, which resets the block. If the Application is generated by an ApplicationSet or managed by an app-of-apps parent, a live sync-policy change is reverted unless the parent already ignores it (ignoreApplicationDifferences on /spec/syncPolicy, or ignoreDifferences with RespectIgnoreDifferences=true); otherwise, through Git, edit the child's manifest (app-of-apps) or add an ignoreApplicationDifferences rule with name: <app> and, once it is merged, run the live pause (ApplicationSet; a rule without name covers every generated Application, and a template change pauses them all). Record who, why and until when, make the fix and land the same change in Git; once it is merged and the Application reads Synced (if it stays OutOfSync, land in Git any live change that must stay, found with argocd app diff <app>, which hides fields under ignoreDifferences: the next sync after the restore writes Git's value over every field Git sets, those included unless RespectIgnoreDifferences=true; restore by the recorded end time either way), restore exactly the recorded automated block that --sync-policy none removed (argocd app set <app> --sync-policy automated, adding --auto-prune, --self-heal or --allow-empty only for a field the recorded block set to true; --sync-policy automated alone leaves pruning off), or in Git if paused there, and drop any rule added for the window. Semantics: Argo CD Automated Sync Policy.

ArgoCD patterns​

  • App-of-apps / ApplicationSets — a bootstrap Application points at a Git path of child Applications; ApplicationSets template one app per cluster/environment from a generator (e.g. the cluster-registration secrets from the GitOps Bridge). This is how 60+ platform add-ons stay in sync across hub + spokes.
  • Cluster registration — a new spoke registers with the hub's ArgoCD; ApplicationSets then deploy the full add-on set to it automatically.
  • One ArgoCD Application per deployment target — e.g. app-dev-cd watches deployment/dev/, app-prod-cd watches deployment/prod/. Promotion = changing what's in the prod path (done by Kargo, see progressive-delivery.md).
  • SSO — ArgoCD logs in via Keycloak; no separate credentials.

The application CI/CD pipeline (golden path 3)​

The platform provisions an app's whole pipeline from one Backstage template that emits a kro CICDPipeline (see infrastructure-abstraction.md). That single CRD reconciles into:

  • Argo Workflow templates (build + push to ECR + update manifest)
  • Argo Events sensor/trigger (fires the workflow on git push)
  • ECR repository
  • ArgoCD applications for dev and prod (<app>-dev-cd, <app>-prod-cd)
  • build caches

Two workflows typically run: a one-time *-setup-workflow (cache warming / provisioning) and the recurring *-initial-build-workflow (build → push → update the image: field in deployment/dev/application.yaml).

The developer contract for delivery​

The developer provides only:

  1. A Dockerfile in the repo (the platform expects nothing else for build — multi-stage builds, static linking, non-root, minimal base images are the recommended convention).
  2. The platform's application manifest in deployment/dev/ describing what to run — a kro-rendered custom resource on the default stack, or an OAM Application if you run the KubeVela abstraction (see application-model-oam.md). The examples below use the OAM form.

Then: git push → Argo Workflows builds and pushes the image and bumps the manifest → ArgoCD syncs → the app abstraction (kro composition or KubeVela) renders the app + its DynamoDB/IAM/ingress. "Deploying" is just pushing to Git.

Verifying​

  • kro pipeline object: kubectl get cicdpipelines <name> -n <team-ns> → expect STATE=ACTIVE, SYNCED=True.
  • ArgoCD app: check Synced/Healthy (UI or argocd app get <app>); force with argocd app sync <app>.
  • Workflow run: Argo Workflows UI shows build progress; kubectl get pods -n <team-ns> --watch shows the rollout.
  • Allow ~3–5 minutes for ArgoCD to detect a Git change on default sync intervals.