MARGA by EknathaLabs

Continuous delivery with Argo CD cheat sheet

Applications, sync policies, hooks, projects, ApplicationSets and a debugging checklist.

An Application

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: shop-api
  namespace: argocd
spec:
  project: team-shop
  source:
    repoURL: https://example.com/platform/shop-config.git
    targetRevision: main
    path: apps/shop-api
  destination:
    server: https://kubernetes.default.svc
    namespace: shop

Everyday commands

argocd app list
argocd app get shop-api
argocd app diff shop-api
argocd app sync shop-api --dry-run
argocd app history shop-api

Automated sync

syncPolicy:
  automated:
    prune: true
    selfHeal: true
  syncOptions:
    - CreateNamespace=true

Waves and hooks

metadata:
  annotations:
    argocd.argoproj.io/sync-wave: "-1"
    argocd.argoproj.io/hook: PreSync
    argocd.argoproj.io/hook-delete-policy: HookSucceeded

ApplicationSet

generators:
  - list:
      elements:
        - env: staging
        - env: production
template:
  metadata:
    name: "shop-{{env}}"

Ignore expected differences

ignoreDifferences:
  - group: apps
    kind: Deployment
    jsonPointers:
      - /spec/replicas

Debug stages

1. Fetch   - repo access, revision, path
2. Render  - helm template / kustomize build with the same values
3. Apply   - permissions, project rules, webhooks, CRD order
4. Health  - ordinary Kubernetes debugging on the resources

Official references

Read the vendor and project documentation for the full, current detail.