kubernetes-plugin icon indicating copy to clipboard operation
kubernetes-plugin copied to clipboard

Terminate running nodes after exiting `podTemplate` block

Open Vlatombe opened this issue 3 years ago • 5 comments

This prevents orphan agents left behind after removing a dynamic pod template. In some cases where Jenkins is restarted just after exiting a podTemplate block, agents would lose their reference to pod template and cause various exceptions such as https://github.com/jenkinsci/kubernetes-plugin/pull/1045

  • [X] Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • [X] Ensure that the pull request title represents the desired changelog entry
  • [X] Please describe what you did
  • [ ] Link to relevant issues in GitHub or Jira
  • [ ] Link to relevant pull requests, esp. upstream and downstream changes
  • [ ] Ensure you have provided tests - that demonstrates feature works or fixes the issue

Vlatombe avatar Dec 17 '21 09:12 Vlatombe

Seems reasonable. Doubt there would be any poor interactions with #1083 since this happens after node(POD_LABEL) {…} has exited.

jglick avatar Dec 17 '21 13:12 jglick

KubernetesProvisioningLimits.unregister: Pod template count for runInPod-jrsz5 went below zero.

seems like a genuine regression.

jglick avatar Dec 17 '21 13:12 jglick

Also wondering if maybe this requires some Queue.lock like retention strategies do. For example OnceRetentionStrategy.java.

Dohbedoh avatar Dec 20 '21 03:12 Dohbedoh

https://github.com/jenkinsci/durable-task-plugin/pull/2#issuecomment-69762498 :shrug:

jglick avatar Dec 20 '21 14:12 jglick

Right, this probably due to the required queue lock...

Vlatombe avatar Dec 28 '21 13:12 Vlatombe