Note: On brand new build this doesnt happen, but can be a problem if people deploy one(staging) environment, do some development then go ahead and deploy their 2nd(prod) environment at a later date.
The existing flow for CI/CD pipeline deployment goes something like this
- build image
- check migration files
2.1 if no migration files skip to deploy
2.2 if there are migration files create migration job and waits for job to succeed
- deploy (kustomize apply overlay/)
On a brand new repo during ci/cd, when there's no migration file it works, But if the first time running one already has migration files, the k8s environment does not have secret for migration job to mount, which would be created from external-secrets during deploy step.