Search in sources :

Example 1 with NamedClusterBuilder

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();
}
Also used : NamedClusterBuilder(io.fabric8.kubernetes.api.model.NamedClusterBuilder) Config(io.fabric8.kubernetes.api.model.Config) ConfigBuilder(io.fabric8.kubernetes.api.model.ConfigBuilder) File(java.io.File) NamedContextBuilder(io.fabric8.kubernetes.api.model.NamedContextBuilder)

Aggregations

Config (io.fabric8.kubernetes.api.model.Config)1 ConfigBuilder (io.fabric8.kubernetes.api.model.ConfigBuilder)1 NamedClusterBuilder (io.fabric8.kubernetes.api.model.NamedClusterBuilder)1 NamedContextBuilder (io.fabric8.kubernetes.api.model.NamedContextBuilder)1 File (java.io.File)1