It's not using jobs because they did not exist when the plugin was created, and yes, it would be a good addition to the plugin.
Note that I don't think it would fix a) as Jenkins expects the agent to keep state. ie. agent clones git repo then crashes later on, Jenkins expects the agent to already have the gi repo cloned after agent restart On Thu, Nov 22, 2018 at 4:04 PM <daniel.schiem...@gebit.de> wrote: > Hi all, > > I am working on a kubernetes cluster for Jenkins. I quickly found Carlos > Sanchez' kubernetes-plugin and started using and adapting it. > The plugin creates "bare" Pods directly in kubernetes, watches and in the > end deletes them after the agent process inside the Pod terminated. > I think there are several issues with this: > a) bare Pods do not get rescheduled in failover cases, for example node > crash > b) kubernetes-plugin is responsible for deleting such a bare Pod (because > Pods are designed to never terminate). If Jenkins (or the node its running > on) > crashes while terminating the slave, it might never actually delete the > Pod. > c) kubernetes-plugin immediately deletes the Pod after the build inside > the container is finished. If something else is happening inside the Pod > after > the build (e. g. cleanup or syncing), it has no chance of completing. > > While researching, I found out that kubernetes provides a "Job" object > that runs a certain amount of containers until successful completion. > Using a kubernetes Job to schedule builds onto the cluster seems to solve > all my aforementioned issues. > a) a Job ensures that the specified number of completed runs are achieved, > even in case of failover > b) and c) a Job automatically deletes all associated Pods when it gets > deleted (and finished Jobs themselves can get auto-deleted with > the new alpha feature TTLAfterFinished in k8s v1.12). This frees the > kubernetes-plugin from caring for the Pods after build completion. > > Has anyone experience with kubernetes Jobs? Am I missing something obvious? > > @Carlos Sanchez: If not, I would try to implement this in your > kubernetes-plugin. Would you be interested to get this back into your > mainline? Then I would fork the github repo and start directly off master. > > Regards, > Daniel > > -- > You received this message because you are subscribed to the Google Groups > "Jenkins Developers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to jenkinsci-dev+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jenkinsci-dev/1fe306b4-f8f6-48b1-a98a-087b119f880f%40googlegroups.com > <https://groups.google.com/d/msgid/jenkinsci-dev/1fe306b4-f8f6-48b1-a98a-087b119f880f%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Jenkins Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CALHFn6N4Z4fwADnCL7khj3Ey%3D9dg1%2BA--VN85FNi9bBKmiRHiw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.