Search in sources :

Example 1 with VerticalPodAutoscalerBuilder

use of io.fabric8.verticalpodautoscaler.api.model.v1.VerticalPodAutoscalerBuilder in project kubernetes-client by fabric8io.

the class V1VerticalPodAutoscalerCrudTest method shouldListAndGetVerticalPodAutoscaler.

@Test
void shouldListAndGetVerticalPodAutoscaler() {
    VerticalPodAutoscaler vpa2 = new VerticalPodAutoscalerBuilder().withNewMetadata().withName("vpa2").endMetadata().build();
    client.v1().verticalpodautoscalers().inNamespace("ns2").create(vpa2);
    VerticalPodAutoscalerList certificateList = client.v1().verticalpodautoscalers().inNamespace("ns2").list();
    assertNotNull(certificateList);
    assertEquals(1, certificateList.getItems().size());
}
Also used : VerticalPodAutoscaler(io.fabric8.verticalpodautoscaler.api.model.v1.VerticalPodAutoscaler) VerticalPodAutoscalerList(io.fabric8.verticalpodautoscaler.api.model.v1.VerticalPodAutoscalerList) VerticalPodAutoscalerBuilder(io.fabric8.verticalpodautoscaler.api.model.v1.VerticalPodAutoscalerBuilder) Test(org.junit.jupiter.api.Test)

Example 2 with VerticalPodAutoscalerBuilder

use of io.fabric8.verticalpodautoscaler.api.model.v1.VerticalPodAutoscalerBuilder in project kubernetes-client by fabric8io.

the class V1VerticalPodAutoscalerCrudTest method shouldDeleteAVerticalPodAutoscaler.

@Test
void shouldDeleteAVerticalPodAutoscaler() {
    VerticalPodAutoscaler vpa3 = new VerticalPodAutoscalerBuilder().withNewMetadata().withName("vpa3").endMetadata().build();
    client.v1().verticalpodautoscalers().inNamespace("ns3").create(vpa3);
    Boolean deleted = client.v1().verticalpodautoscalers().inNamespace("ns3").withName("vpa3").delete();
    assertTrue(deleted);
}
Also used : VerticalPodAutoscaler(io.fabric8.verticalpodautoscaler.api.model.v1.VerticalPodAutoscaler) VerticalPodAutoscalerBuilder(io.fabric8.verticalpodautoscaler.api.model.v1.VerticalPodAutoscalerBuilder) Test(org.junit.jupiter.api.Test)

Example 3 with VerticalPodAutoscalerBuilder

use of io.fabric8.verticalpodautoscaler.api.model.v1.VerticalPodAutoscalerBuilder in project kubernetes-client by fabric8io.

the class VerticalPodAutoscalerCreate method main.

public static void main(String[] args) {
    try (NamespacedVerticalPodAutoscalerClient verticalPodAutoscalerClient = new DefaultVerticalPodAutoscalerClient()) {
        String namespace = "default";
        VerticalPodAutoscaler verticalPodAutoscaler = new VerticalPodAutoscalerBuilder().build();
        // Create VerticalPodAutoscaler
        verticalPodAutoscalerClient.v1().verticalpodautoscalers().inNamespace(namespace).create(verticalPodAutoscaler);
        System.out.println("Created: " + verticalPodAutoscaler.getMetadata().getName());
        // List VerticalPodAutoscaler
        VerticalPodAutoscalerList verticalPodAutoscalerList = verticalPodAutoscalerClient.v1().verticalpodautoscalers().inNamespace(namespace).list();
        System.out.println("There are " + verticalPodAutoscalerList.getItems().size() + " VerticalPodAutoscaler objects in " + namespace);
    }
}
Also used : VerticalPodAutoscaler(io.fabric8.verticalpodautoscaler.api.model.v1.VerticalPodAutoscaler) NamespacedVerticalPodAutoscalerClient(io.fabric8.verticalpodautoscaler.client.NamespacedVerticalPodAutoscalerClient) VerticalPodAutoscalerList(io.fabric8.verticalpodautoscaler.api.model.v1.VerticalPodAutoscalerList) DefaultVerticalPodAutoscalerClient(io.fabric8.verticalpodautoscaler.client.DefaultVerticalPodAutoscalerClient) VerticalPodAutoscalerBuilder(io.fabric8.verticalpodautoscaler.api.model.v1.VerticalPodAutoscalerBuilder)

Aggregations

VerticalPodAutoscaler (io.fabric8.verticalpodautoscaler.api.model.v1.VerticalPodAutoscaler)3 VerticalPodAutoscalerBuilder (io.fabric8.verticalpodautoscaler.api.model.v1.VerticalPodAutoscalerBuilder)3 VerticalPodAutoscalerList (io.fabric8.verticalpodautoscaler.api.model.v1.VerticalPodAutoscalerList)2 Test (org.junit.jupiter.api.Test)2 DefaultVerticalPodAutoscalerClient (io.fabric8.verticalpodautoscaler.client.DefaultVerticalPodAutoscalerClient)1 NamespacedVerticalPodAutoscalerClient (io.fabric8.verticalpodautoscaler.client.NamespacedVerticalPodAutoscalerClient)1