feature request: job name based on hash like config/secret #903
Description
This is related to #168
I would like to run a job once each time an image changes
(the specific use case is a django upgrade...). This is referenced in kubernetes/community#1171 but that seems to have ended when the KEP thing started.
So I have a deployment w/ replicas > 1 that contains a django container. It must do a db upgrade whenever the image tag changes. Since replicas >1 this usually crashes, fails, or corrupts the database.
An approach that is a bit hackish but can work is to have a 2nd deployment, w/ replicas==1, that solely does the upgrade. But then its left running. this is what Job was meant for.
But if I make it a Job, then when i change the image tag it does not get retriggered.
So I am thinking, if the job name could be a hash of the image tag or config map, then it would get created as a new Job each time I re-ran kustomize w/ changed config. If the config doesn't change, it won't retrigger.
So conceptually, if i could have:
Kind: Job
name: job-$(hash of image tag)
image: image-tag
...
I would achieve my goal. Its not once per kustomize run
its once per configmap change
that I'm looking for here.
initContainer does not work since it runs once per Pod in the Deployment.