This exercise showcases how to customize Argo CD's diffing behavior to ignore differences in the number of replicas for a Deployment resource. Follow these steps:
Solution
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: diffing-customization-demo
namespace: argocd
spec:
destination:
namespace: diffing-customization-demo
server: "https://kubernetes.default.svc"
project: default
source:
path: guestbook-with-sub-directories
repoURL: "https://github.com/spy86/argocd-example-apps.git"
targetRevision: master
directory:
recurse: true
syncPolicy:
automated: {}
syncOptions:
- CreateNamespace=true
ignoreDifferences:
- group: apps
kind: Deployment
jsonPointers:
- /spec/replicas
kubectl apply -f app.yaml -n argocd
kubectl get application -n argocd
kubectl get all -n diffing-customization-demo
kubectl scale deployment/guestbook-ui -n diffing-customization-demo --replicas=3
kubectl port-forward svc/argocd-server -n argocd 8080:443
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d; echo