-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Description
Describe the bug
When I haven't manually disabled AutoConfig and there is an empty kubeconfig file present in the system, it leads to a NullPointerException in the loadFromKubeConfig method.
Fabric8 Kubernetes Client version
other (please specify in additional context)
Steps to reproduce
1 echo '' > root/.kube/config
2 new ConfigBuilder()
3 will get a NPE
Expected behavior
no NPE
Runtime
Kubernetes (vanilla)
Kubernetes API Server version
1.25.3@latest
Environment
Linux
Fabric8 Kubernetes Client Logs
`Caused by: java.lang.NullPointerException
at io.fabric8.kubernetes.client.Config.loadFromKubeconfig(Config.java:703)
at io.fabric8.kubernetes.client.Config.tryKubeConfig(Config.java:666)
at io.fabric8.kubernetes.client.Config.autoConfigure(Config.java:286)
at io.fabric8.kubernetes.client.Config.<init>(Config.java:251)
at io.fabric8.kubernetes.client.Config.<init>(Config.java:242)
at io.fabric8.kubernetes.client.ConfigBuilder.<init>(ConfigBuilder.java:10)
at io.fabric8.kubernetes.client.ConfigBuilder.<init>(ConfigBuilder.java:7)
at `Additional context
version is 6.6.0
Based on the following code, it seems that you are consciously trying to prevent empty kubeconfig files. However, you are currently only checking for null and not checking for an empty string "".
if (kubeconfigContents == null) { return false; }