Skip to content

Commit fa95177

Browse files
authored
Avoid pod garbage collection thread getting killed because of a common unhandled exception (#1579)
1 parent fe48922 commit fa95177

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/main/java/org/csanchez/jenkins/plugins/kubernetes/GarbageCollection.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import hudson.model.TaskListener;
1414
import hudson.util.FormValidation;
1515
import io.fabric8.kubernetes.api.model.Pod;
16+
import io.fabric8.kubernetes.client.KubernetesClientException;
1617
import java.io.IOException;
1718
import java.time.Duration;
1819
import java.time.Instant;
@@ -195,6 +196,8 @@ private static void garbageCollect() {
195196
client.resource(pod).delete();
196197
});
197198
}
199+
} catch (KubernetesClientException e) {
200+
LOGGER.log(Level.WARNING, "Unexpected error while calling Kubernetes API", e);
198201
} catch (KubernetesAuthException e) {
199202
LOGGER.log(Level.WARNING, "Error authenticating to Kubernetes", e);
200203
} catch (IOException e) {

0 commit comments

Comments
 (0)