⚗️ Build client once
This commit is contained in:
parent
c634ac1fa0
commit
3b66dc5f22
@ -3,6 +3,7 @@ package dev.dinauer.utils;
|
||||
import io.fabric8.kubernetes.client.Config;
|
||||
import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import io.fabric8.kubernetes.client.KubernetesClientBuilder;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import org.eclipse.microprofile.config.inject.ConfigProperty;
|
||||
|
||||
@ -14,8 +15,16 @@ public class ClientProvider
|
||||
@ConfigProperty(name = "dev.dinauer.kobooboo.kubeconfigs.dir")
|
||||
String configFilePath;
|
||||
|
||||
private KubernetesClient client;
|
||||
|
||||
@PostConstruct
|
||||
void init()
|
||||
{
|
||||
client = new KubernetesClientBuilder().withConfig(Config.fromKubeconfig(new File(configFilePath))).build();
|
||||
}
|
||||
|
||||
public KubernetesClient getClient()
|
||||
{
|
||||
return new KubernetesClientBuilder().withConfig(Config.fromKubeconfig(new File(configFilePath))).build();
|
||||
return client;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user