use of io.fabric8.kubernetes.api.model.NamedClusterBuilder in project flink by apache.
the class KubernetesTestBase method writeKubeConfigForMockKubernetesServer.
protected String writeKubeConfigForMockKubernetesServer() throws Exception {
final Config kubeConfig = new ConfigBuilder().withApiVersion(server.getClient().getApiVersion()).withClusters(new NamedClusterBuilder().withName(CLUSTER_ID).withNewCluster().withNewServer(server.getClient().getMasterUrl().toString()).withInsecureSkipTlsVerify(true).endCluster().build()).withContexts(new NamedContextBuilder().withName(CLUSTER_ID).withNewContext().withCluster(CLUSTER_ID).withUser(server.getClient().getConfiguration().getUsername()).endContext().build()).withNewCurrentContext(CLUSTER_ID).build();
final File kubeConfigFile = new File(temporaryFolder.newFolder(".kube"), "config");
Serialization.yamlMapper().writeValue(kubeConfigFile, kubeConfig);
return kubeConfigFile.getAbsolutePath();
}
Aggregations