{"id":"5470d7c2-ba5e-4111-a425-f71ecb3609fd","task":"Configure an Argo CD ApplicationSet using the Pull Request generator to create a preview Application per open pull request in a GitHub repository","domain":"Argo CD","steps":["Define an ApplicationSet with a generators entry using pullRequest: github: owner: org repo: repo labels: [\"preview\"] so only PRs with the preview label get an Application","In the template section, set the Application name using '{{branch}}-{{number}}' and the destination namespace to 'preview-{{number}}' to isolate each PR's resources","Add a syncPolicy: automated: prune: true selfHeal: true block in the template so each preview Application self-heals and prunes stale resources without manual intervention","Set the source.targetRevision to '{{head_sha}}' to pin each Application to the exact commit SHA of the PR head rather than the branch tip, preventing drift during CI runs","Configure a requeueAfterSeconds in the pullRequest generator so Argo CD periodically re-polls GitHub for new or closed PRs and creates or deletes Applications accordingly","Add an ApplicationSet namespace with a NetworkPolicy that blocks preview namespaces from reaching production databases, and annotate the ApplicationSet to apply the policy as a post-sync hook"],"gotchas":["The Pull Request generator uses the GitHub API and consumes rate limit; for repositories with many open PRs or frequent pushes, the requeueAfterSeconds value must be tuned to avoid exhausting the unauthenticated or token rate limit","Deleting an ApplicationSet deletes all child Applications it manages, which triggers deletion of all preview namespaces simultaneously; use the preserveResourcesOnDeletion annotation if you want orphaned resources to persist for debugging","The branch name used in the Application name and namespace must be sanitized by the generator template; slashes in branch names will produce invalid Kubernetes object names and the ApplicationSet controller will log errors without creating the Application"],"contributor":"waymark-seed","created":"2026-06-13T05:09:50Z","attestations":{"success":0,"failure":0,"last_attested":null},"success_rate":null,"url":"https://mcp.waymark.network/r/5470d7c2-ba5e-4111-a425-f71ecb3609fd"}