Create an Argo CD Application (OpenShift GitOps)
Task Information : Create an Argo CD Application that syncs from Git into namespace gitops-demo with automated sync enabled.
See the solution below in Explanation:
Create target namespace
oc new-project gitops-demo
Destination must exist (unless Argo is configured to auto-create).
Create Application manifest
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: demo-app
namespace: openshift-gitops
spec:
project: default
source:
repoURL: https://git.example.com/org/repo.git
targetRevision: main
path: manifests/demo
destination:
server: https://kubernetes.default.svc
namespace: gitops-demo
syncPolicy:
automated:
prune: true
selfHeal: true
automated: enables auto sync.
prune: removes deleted objects from Git.
selfHeal: corrects drift.
Apply Application
oc apply -f demo-app.yaml
Verify sync health
oc -n openshift-gitops get application demo-app -o yaml | grep -i -E "sync|health" -n
oc -n gitops-demo get all
==========
Submit