This is extracted and fixed/improved from #147 .
It's eventually a massive re-write of the logic to determine which API Version to use for CronJobs:
Delaying the decision until the k8s cluster is contacted, unless the user specified an explicit version to use
Using the information provided by the k8s APIs on a per-resource-kind level (the "API Groups" API doesn't give us the information we need here)
Eventually, we should drop support specifically for this case in kubetools, but this demonstrates how we could do it for any of the other k8s APIs in order to support multiple versions. It also helps understand the gaps in the code architecture that need to be filled in order to support this for other Resource kinds.
I've also fixed an important bug along the way: We shouldn't wait for cronjobs to finish executing on deploy; the next schedule might be a year from now. So we only need to wait for the CronJob resource to be created/updated
Sorry I don't find an easy way to clean-up the commit history better, so it still shows the numerous refactoring steps that were needed to clarify/simplify the code, and attempts that didn't work, until the solution became possible.
This is extracted and fixed/improved from #147 . It's eventually a massive re-write of the logic to determine which API Version to use for CronJobs:
Eventually, we should drop support specifically for this case in
kubetools
, but this demonstrates how we could do it for any of the other k8s APIs in order to support multiple versions. It also helps understand the gaps in the code architecture that need to be filled in order to support this for other Resource kinds.I've also fixed an important bug along the way: We shouldn't wait for cronjobs to finish executing on
deploy
; the next schedule might be a year from now. So we only need to wait for the CronJob resource to be created/updatedSorry I don't find an easy way to clean-up the commit history better, so it still shows the numerous refactoring steps that were needed to clarify/simplify the code, and attempts that didn't work, until the solution became possible.