In order to use the garbage collector, the master has to be aware of its own UID (or the UID of the stateful set it’s a part of) in the Kubernetes cluster in order to inject that value into the slave templates. I’ve tried a few approaches in getting this value. As the master is aware of its own URL, you can try to use the ingress resource and follow that chain, but that proved slow and unreliable. A more reliable way to get the value is to inject it as an environment variable at deployment-time, but that would make the plugin dependent on whatever method you use to deploy, which is not ideal. We’ve implemented similar functionality through a helm delete hook, which we’d added to the Jenkins stable helm chart. |