But when I manually sync, or for example when I have auto sync and I want to change something in the yaml files , my database also will be dropped.
Maybe it's a good idea to have something like "path" or "field" which will be checked to decide whether to run hook or not.
For example if spec.template.spec.containers[0].image or metadata.annotations.buildId was changed , then run the hook .
In this case we can be sure that only when we do "real" deployment our hook will run.
This is only my case but maybe it will be useful to have such feature.
I need to drop database during deployment, I use "hook"
But when I manually sync, or for example when I have auto sync and I want to change something in the yaml files , my database also will be dropped.
Maybe it's a good idea to have something like "path" or "field" which will be checked to decide whether to run hook or not. For example if spec.template.spec.containers[0].image or metadata.annotations.buildId was changed , then run the hook .
In this case we can be sure that only when we do "real" deployment our hook will run.