Search in sources :

Example 1 with ClientBuilder

use of io.kubernetes.client.util.ClientBuilder in project java by kubernetes-client.

the class KubectlAnnotateTest method setup.

@Before
public void setup() throws IOException {
    ModelMapper.addModelMap("", "v1", "Pod", "pods", true, V1Pod.class);
    ModelMapper.addModelMap("", "v1", "Node", "nodes", false, V1Node.class);
    apiClient = new ClientBuilder().setBasePath("http://localhost:" + 8384).build();
}
Also used : ClientBuilder(io.kubernetes.client.util.ClientBuilder) Before(org.junit.Before)

Example 2 with ClientBuilder

use of io.kubernetes.client.util.ClientBuilder in project java by kubernetes-client.

the class KubectlDrainTest method setup.

@Before
public void setup() throws IOException {
    ModelMapper.addModelMap("", "v1", "Pod", "pods", true, V1Pod.class);
    ModelMapper.addModelMap("", "v1", "Node", "nodes", false, V1Node.class);
    apiClient = new ClientBuilder().setBasePath("http://localhost:" + 8384).build();
}
Also used : ClientBuilder(io.kubernetes.client.util.ClientBuilder) Before(org.junit.Before)

Example 3 with ClientBuilder

use of io.kubernetes.client.util.ClientBuilder in project java by kubernetes-client.

the class KubectlGetTest method setup.

@Before
public void setup() throws IOException {
    ModelMapper.addModelMap("", "v1", "Pod", "pods", true, V1Pod.class);
    ModelMapper.addModelMap("", "v1", "Node", "nodes", false, V1Node.class);
    apiClient = new ClientBuilder().setBasePath("http://localhost:" + wireMockRule.port()).build();
}
Also used : ClientBuilder(io.kubernetes.client.util.ClientBuilder) Before(org.junit.Before)

Example 4 with ClientBuilder

use of io.kubernetes.client.util.ClientBuilder in project java by kubernetes-client.

the class GenericKubernetesApiForCoreApiTest method patchNamespacedPodWithApiPrefix.

@Test
public void patchNamespacedPodWithApiPrefix() {
    V1Patch v1Patch = new V1Patch("{}");
    V1Pod foo1 = new V1Pod().kind("Pod").metadata(new V1ObjectMeta().namespace("default").name("foo1"));
    // add api prefix
    String prefix = "/k8s/clusters/c-7q988";
    stubFor(patch(urlEqualTo(prefix + "/api/v1/namespaces/default/pods/foo1")).withHeader("Content-Type", containing(V1Patch.PATCH_FORMAT_STRATEGIC_MERGE_PATCH)).willReturn(aResponse().withStatus(200).withBody(json.serialize(foo1))));
    GenericKubernetesApi<V1Pod, V1PodList> rancherPodClient = new GenericKubernetesApi<>(V1Pod.class, V1PodList.class, "", "v1", "pods", new ClientBuilder().setBasePath("http://localhost:" + 8181 + prefix).build());
    KubernetesApiResponse<V1Pod> podPatchResp = rancherPodClient.patch("default", "foo1", V1Patch.PATCH_FORMAT_STRATEGIC_MERGE_PATCH, v1Patch);
    assertTrue(podPatchResp.isSuccess());
    assertEquals(foo1, podPatchResp.getObject());
    assertNull(podPatchResp.getStatus());
    verify(1, patchRequestedFor(urlPathEqualTo(prefix + "/api/v1/namespaces/default/pods/foo1")));
}
Also used : V1PodList(io.kubernetes.client.openapi.models.V1PodList) V1ObjectMeta(io.kubernetes.client.openapi.models.V1ObjectMeta) V1Patch(io.kubernetes.client.custom.V1Patch) V1Pod(io.kubernetes.client.openapi.models.V1Pod) ClientBuilder(io.kubernetes.client.util.ClientBuilder) Test(org.junit.Test)

Example 5 with ClientBuilder

use of io.kubernetes.client.util.ClientBuilder in project java by kubernetes-client.

the class GenericKubernetesApiTest method setup.

@Before
public void setup() throws IOException {
    ApiClient apiClient = new ClientBuilder().setBasePath("http://localhost:" + 8181).build();
    jobClient = new GenericKubernetesApi<>(V1Job.class, V1JobList.class, "batch", "v1", "jobs", apiClient);
}
Also used : V1Job(io.kubernetes.client.openapi.models.V1Job) V1JobList(io.kubernetes.client.openapi.models.V1JobList) ApiClient(io.kubernetes.client.openapi.ApiClient) ClientBuilder(io.kubernetes.client.util.ClientBuilder) Before(org.junit.Before)

Aggregations

ClientBuilder (io.kubernetes.client.util.ClientBuilder)18 Before (org.junit.Before)15 ApiClient (io.kubernetes.client.openapi.ApiClient)6 V1Pod (io.kubernetes.client.openapi.models.V1Pod)4 V1PodList (io.kubernetes.client.openapi.models.V1PodList)4 V1Job (io.kubernetes.client.openapi.models.V1Job)3 V1JobList (io.kubernetes.client.openapi.models.V1JobList)3 Test (org.junit.Test)3 SocketTimeoutException (java.net.SocketTimeoutException)2 V1Patch (io.kubernetes.client.custom.V1Patch)1 V1ObjectMeta (io.kubernetes.client.openapi.models.V1ObjectMeta)1