-
Bug
-
Resolution: Fixed
-
Minor
-
None
-
Jenkins 2.176.1
kubernetes-plugin 1.16.2
-
-
1.17.2
Background
We create Kubernetes resources (Deployments) from within Kubernetes Pods created with podTemplate. We want these resources to be deleted when the Pod created with podTemplate is deleted. To do this we set ownerReferences for the created resources, using the generated Pod's name and uid. This worked well for us a for a while.
Problem
We upgraded the Kubernetes plugin from 1.15.2 to 1.16.2 and this stopped working. The manually created resources (Deployments) weren't being cleaned up by Kubernetes garbage collection any more. We had to revert the plugin upgrade.
Possible cause
Version 1.16.0 of the plugin upgraded kubernetes-client from 4.1.3 to 4.3.0.
The changelog for kubernetes-client includes only one change within that range that would be likely to cause this change in behavior: Fix #758: Deleting Deployments with `.cascading(true)` creates a new Replica Set.
Possible fix
I don't understand the plugin's code well, but it seems like adding .cascading(true) to this line could return the previous behavior.
- links to