Progressive Delivery with ArgoCD

Blue-Green Deployments

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: blue-green-app
spec:
  source:
    plugin:
      name: argocd-rollouts
    repoURL: https://github.com/org/app.git
    targetRevision: HEAD
    path: rollouts/
  destination:
    server: https://kubernetes.default.svc
    namespace: production

---
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
  name: blue-green-rollout
spec:
  replicas: 3
  strategy:
    blueGreen:
      activeService: active-service
      previewService: preview-service
      autoPromotionEnabled: false
  template:
    spec:
      containers:
      - name: app
        image: app:1.0

Multi-Cluster Management

Cluster Configuration

apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: multi-cluster-apps
spec:
  generators:
  - clusters: {}
  template:
    metadata:
      name: '{{name}}-app'
    spec:
      project: default
      source:
        repoURL: https://github.com/org/app-configs.git
        targetRevision: HEAD
        path: environments/{{name}}
      destination:
        server: '{{server}}'
        namespace: production

Sync Strategies

Selective Sync

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: selective-sync-app
  annotations:
    argocd.argoproj.io/sync-wave: "5"
spec:
  syncPolicy:
    automated:
      prune: true
      selfHeal: true
    syncOptions:
    - CreateNamespace=true
    - PruneLast=true
    - ApplyOutOfSyncOnly=true
  source:
    directory:
      recurse: true
      exclude: 'excluded-patterns/**'

Production Example

# Complete production deployment setup
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: production-deployment
  annotations:
    notifications.argoproj.io/subscribe.on-sync-succeeded.slack: production-deploys
spec:
  project: production
  source:
    repoURL: https://github.com/org/production-config.git
    targetRevision: main
    path: overlays/production
    directory:
      recurse: true
      jsonnet:
        extVars:
        - name: environment
          value: production
  destination:
    server: https://kubernetes.default.svc
    namespace: production
  syncPolicy:
    automated:
      prune: true
      selfHeal: true
    syncOptions:
    - CreateNamespace=true
    - ServerSideApply=true
    retry:
      limit: 5
      backoff:
        duration: 5s
        factor: 2
        maxDuration: 3m
  ignoreDifferences:
  - group: apps
    kind: Deployment
    jsonPointers:
    - /spec/replicas