Back to results for “Applications”
ArgoCD › Sync Waves & Hooks

How do you seed initial data on first deployment only?

Intermediate

Answer

Use a PreSync or Sync hook Job with BeforeHookCreation deletion and idempotent seeding logic, or gate it so re-runs are no-ops. Because hooks run each sync, the seed script itself should detect existing data and skip, giving effectively run-once behavior safely.
metadata:
  annotations:
    argocd.argoproj.io/hook: PostSync
    argocd.argoproj.io/hook-delete-policy: HookSucceeded
Real-world example A seed Job checks whether the table is populated and exits early on subsequent syncs.

Common follow-ups: How do you make seeding idempotent? | Why can't you assume run-once?