Closed jliedy closed 10 months ago
We had the same issue and found that these jobs can be cleaned up automatically by using the .spec.ttlSecondsAfterFinished
property in the job definition.
Reference from k8s: https://kubernetes.io/docs/concepts/workloads/controllers/job/#clean-up-finished-jobs-automatically
Made a quick PR for it here, just waiting for review: https://github.com/openfga/helm-charts/pull/96
We found this to be a lower-risk, backwards-compatible (being an optional parameter), tested and working way for our jobs to not conflict like in the error you're seeing.
I'm sure both methods achieve the desired behavior, though I would think having both as an option is better than one or none. :)
That's a viable option if still using v1.6 of the k8s-wait-for task, as it will return as "ok" if the job doesn't exit or if the job is successful. Typically it's fine, but you could run the risk of your application incorrectly starting if the migration fails and then the job gets deleted. If you're on v2.0, the task will only succeed if it's able to verify that the defined job exists and has run successfully. The risk of that is if you run an update/upgrade and the migration job fails, any pods that start (like during a HPA scaling event) or restart will fail to run until the migration job has run successfully.
After installing openfga, running
helm upgrade
fails due to the chart template trying to update a job.As far as I'm aware, jobs like this are immutable. You can use hooks to have a job delete itself after a successful run: https://helm.sh/docs/topics/charts_hooks/
I'll have a pull request completed momentarily to have this added.