What does the 'prune' policy in GitOps do?
Pruning compares live cluster resources against the Git-declared desired state and removes anything absent from Git, preventing configuration drift. This enforces Git as the single source of truth, satisfying the GitOps reconciliation requirement that cluster state matches the repository.
Why this answer
The prune policy in GitOps deletes resources from the cluster that are no longer present in Git, ensuring the cluster state matches the declared desired state exactly. Without pruning, removed manifests would leave orphaned resources running, causing drift between Git and the live cluster.
Exam trap
CGOA often tests the confusion between pruning and syncing — candidates may pick the sync option, but pruning specifically means deleting cluster resources that no longer exist in Git.
How to eliminate wrong answers
Option B is wrong because cleaning up old container logs is a logging or retention concern, not a GitOps reconciliation behavior. Option C is wrong because synchronizing the Git repo with upstream changes describes a Git pull or sync operation, not pruning, which acts on cluster resources. Option D is wrong because restarting long-running pods is a remediation or liveness-probe action, not a prune policy, which is about removing resources absent from Git.