Search in sources :

Example 51 with IngressBuilder

use of io.fabric8.kubernetes.api.model.networking.v1.IngressBuilder in project kubernetes-client by fabric8io.

the class NetworkingV1IngressTest method testDelete.

@Test
void testDelete() {
    server.expect().withPath("/apis/networking.k8s.io/v1/namespaces/test/ingresses/ingress1").andReturn(HttpURLConnection.HTTP_OK, new IngressBuilder().build()).once();
    server.expect().withPath("/apis/networking.k8s.io/v1/namespaces/ns1/ingresses/ingress2").andReturn(HttpURLConnection.HTTP_OK, new IngressBuilder().build()).once();
    Boolean deleted = client.network().v1().ingresses().withName("ingress1").delete();
    assertTrue(deleted);
    deleted = client.network().v1().ingresses().withName("ingress2").delete();
    assertFalse(deleted);
    deleted = client.network().v1().ingresses().inNamespace("ns1").withName("ingress2").delete();
    assertTrue(deleted);
}
Also used : IngressBuilder(io.fabric8.kubernetes.api.model.networking.v1.IngressBuilder) Test(org.junit.jupiter.api.Test)

Example 52 with IngressBuilder

use of io.fabric8.kubernetes.api.model.networking.v1.IngressBuilder in project kubernetes-client by fabric8io.

the class NetworkingV1IngressTest method testDeleteWithNamespaceMismatch.

@Test
void testDeleteWithNamespaceMismatch() {
    Ingress ingress1 = new IngressBuilder().withNewMetadata().withName("ingress1").withNamespace("test").and().build();
    NonNamespaceOperation<Ingress, IngressList, Resource<Ingress>> ingressOp = client.network().v1().ingresses().inNamespace("test1");
    assertFalse(ingressOp.delete(ingress1));
}
Also used : IngressBuilder(io.fabric8.kubernetes.api.model.networking.v1.IngressBuilder) Resource(io.fabric8.kubernetes.client.dsl.Resource) Ingress(io.fabric8.kubernetes.api.model.networking.v1.Ingress) IngressList(io.fabric8.kubernetes.api.model.networking.v1.IngressList) Test(org.junit.jupiter.api.Test)

Example 53 with IngressBuilder

use of io.fabric8.kubernetes.api.model.networking.v1.IngressBuilder in project kubernetes-client by fabric8io.

the class NetworkingV1beta1IngressTest method testDeleteWithNamespaceMismatch.

@Test
void testDeleteWithNamespaceMismatch() {
    Ingress ingress1 = new IngressBuilder().withNewMetadata().withName("ingress1").withNamespace("test").and().build();
    Boolean deleted = client.network().ingress().inNamespace("test1").delete(ingress1);
    assertFalse(deleted);
}
Also used : IngressBuilder(io.fabric8.kubernetes.api.model.networking.v1beta1.IngressBuilder) Ingress(io.fabric8.kubernetes.api.model.networking.v1beta1.Ingress) Test(org.junit.jupiter.api.Test)

Example 54 with IngressBuilder

use of io.fabric8.kubernetes.api.model.networking.v1.IngressBuilder in project kubernetes-client by fabric8io.

the class NetworkingV1beta1IngressTest method testDeleteMulti.

@Test
void testDeleteMulti() {
    Ingress ingress1 = new IngressBuilder().withNewMetadata().withName("ingress1").withNamespace("test").and().build();
    Ingress ingress2 = new IngressBuilder().withNewMetadata().withName("ingress2").withNamespace("ns1").and().build();
    Ingress ingress3 = new IngressBuilder().withNewMetadata().withName("ingress3").withNamespace("any").and().build();
    server.expect().withPath("/apis/networking.k8s.io/v1beta1/namespaces/test/ingresses/ingress1").andReturn(200, ingress1).once();
    server.expect().withPath("/apis/networking.k8s.io/v1beta1/namespaces/ns1/ingresses/ingress2").andReturn(200, ingress2).once();
    Boolean deleted = client.network().ingress().inAnyNamespace().delete(ingress1, ingress2);
    assertTrue(deleted);
    deleted = client.network().ingress().inAnyNamespace().delete(ingress3);
    assertFalse(deleted);
}
Also used : IngressBuilder(io.fabric8.kubernetes.api.model.networking.v1beta1.IngressBuilder) Ingress(io.fabric8.kubernetes.api.model.networking.v1beta1.Ingress) Test(org.junit.jupiter.api.Test)

Example 55 with IngressBuilder

use of io.fabric8.kubernetes.api.model.networking.v1.IngressBuilder in project kubernetes-client by fabric8io.

the class NetworkingV1beta1IngressTest method testCreateWithNameMismatch.

@Test
void testCreateWithNameMismatch() {
    Assertions.assertThrows(KubernetesClientException.class, () -> {
        Ingress ingress1 = new IngressBuilder().withNewMetadata().withName("ingress1").withNamespace("test").and().build();
        Ingress ingress2 = new IngressBuilder().withNewMetadata().withName("ingress2").withNamespace("ns1").and().build();
        client.network().ingress().inNamespace("test1").withName("myingress1").create(ingress1);
    });
}
Also used : IngressBuilder(io.fabric8.kubernetes.api.model.networking.v1beta1.IngressBuilder) Ingress(io.fabric8.kubernetes.api.model.networking.v1beta1.Ingress) Test(org.junit.jupiter.api.Test)

Aggregations

IngressBuilder (io.fabric8.kubernetes.api.model.networking.v1.IngressBuilder)39 Ingress (io.fabric8.kubernetes.api.model.networking.v1.Ingress)31 Test (org.junit.jupiter.api.Test)28 IngressBuilder (io.fabric8.kubernetes.api.model.extensions.IngressBuilder)13 ArrayList (java.util.ArrayList)13 Ingress (io.fabric8.kubernetes.api.model.extensions.Ingress)11 HTTPIngressPathBuilder (io.fabric8.kubernetes.api.model.networking.v1.HTTPIngressPathBuilder)11 IngressRule (io.fabric8.kubernetes.api.model.networking.v1.IngressRule)9 IngressTLSBuilder (io.fabric8.kubernetes.api.model.networking.v1.IngressTLSBuilder)9 HTTPIngressPath (io.fabric8.kubernetes.api.model.networking.v1.HTTPIngressPath)8 GenericKafkaListener (io.strimzi.api.kafka.model.listener.arraylistener.GenericKafkaListener)8 Test (org.junit.Test)8 IngressRuleBuilder (io.fabric8.kubernetes.api.model.networking.v1.IngressRuleBuilder)7 IngressBuilder (io.fabric8.kubernetes.api.model.networking.v1beta1.IngressBuilder)6 ObjectMeta (io.fabric8.kubernetes.api.model.ObjectMeta)5 ObjectMetaBuilder (io.fabric8.kubernetes.api.model.ObjectMetaBuilder)5 HTTPIngressPathBuilder (io.fabric8.kubernetes.api.model.extensions.HTTPIngressPathBuilder)5 Ingress (io.fabric8.kubernetes.api.model.networking.v1beta1.Ingress)5 HashMap (java.util.HashMap)5 HTTPIngressPath (io.fabric8.kubernetes.api.model.extensions.HTTPIngressPath)4