-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: allow migration jobs to be cleaned up after finishing #96
Conversation
Signed-off-by: Michael Lavacca <[email protected]>
aec2254
to
db6ae7f
Compare
Note that this is another solution to the issue seen in #69 |
Just as a heads up, this solution is incompatible with v2.0 of k8s-wait-for. v2.0 will only return success if the job exists and was successful. Any pods that get restarted or if the pod count scales up, new pods will fail to start if the job doesn't exist. You would have to set the version to v1.6 for this to work reliably. |
Hi @jliedy, Thank you for the heads-up. I was not aware the difference with the new version of In trying the new version For reference we are updating helm charts through the Bitbucket pipeline yvogl/aws-eks-helm-deploy:1.1.0, which was working with |
A super handy helm plugin can be found at : https://github.com/databus23/helm-diff That will show you all the changes to a deployment that will be made before you actually update it. It's great for validating stuff. As far as troubleshooting: if you're not enabling the wait flag, I'd start assuming that it's not able to or is having difficulty with running the hook that deletes the job. I'd look at the version of helm that your tool is using and also check that during the deployment the migration job has been deleted (or manually delete the job). You could also try running the helm upgrade command using the |
@michael-lavacca-rw Given that we're currently pinned to The original migration job was inspired by a lot of other Helm charts I have seen, particular many of them in the Can we close in favor of the work already done in #70? |
Hi guys, Yes I'll close this PR. I have been able to get the latest I'm actually trying to adopt this method now for our own custom job that does the authorization model "migration". Thanks for the notes and a better, working solution to my issue! |
Description
The datastore migration job that runs does not clean up after itself by default. This PR adds an optional field
.datastore.migrateJobTtlSecondsAfterFinished
that allows the job to be cleaned up after the specified time (in seconds) by the k8s ttl controller.For our team's purposes this also allows us to have repeatable helm deployments in CI so that new jobs do not conflict with the old ones by name, seen in this error for reference:
Error: UPGRADE FAILED: cannot patch "appName-openfga-migrate" with kind Job: Job.batch "appName-openfga-migrate" is invalid:...
References
From k8s docs: https://kubernetes.io/docs/concepts/workloads/controllers/job/#clean-up-finished-jobs-automatically
Review Checklist
main
(I could not find documentation besides schema descriptors nor tests for these fields - please let me know if they exist and I will update accordingly)