Search in sources :

Example 41 with IngressBuilder

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

the class IngressTest method testGet.

@Test
public void testGet() {
    server.expect().withPath("/apis/extensions/v1beta1/namespaces/test/ingresses/ingress1").andReturn(200, new IngressBuilder().build()).once();
    server.expect().withPath("/apis/extensions/v1beta1/namespaces/ns1/ingresses/ingress2").andReturn(200, new IngressBuilder().build()).once();
    Ingress ingress = client.extensions().ingress().withName("ingress1").get();
    assertNotNull(ingress);
    ingress = client.extensions().ingress().withName("ingress2").get();
    assertNull(ingress);
    ingress = client.extensions().ingress().inNamespace("ns1").withName("ingress2").get();
    assertNotNull(ingress);
}
Also used : IngressBuilder(io.fabric8.kubernetes.api.model.extensions.IngressBuilder) Ingress(io.fabric8.kubernetes.api.model.extensions.Ingress) Test(org.junit.jupiter.api.Test)

Example 42 with IngressBuilder

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

the class IngressTest method testDelete.

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

Example 43 with IngressBuilder

use of io.fabric8.kubernetes.api.model.networking.v1.IngressBuilder in project ingress-access-operator by neo9.

the class VisitorGroupServiceExposerReconcilerTest method shouldWellComputeWhitelistForTwoGroupWithWhitespaceInAnnotation.

@Test
public void shouldWellComputeWhitelistForTwoGroupWithWhitespaceInAnnotation() {
    // given
    Ingress ingress = new IngressBuilder().withNewMetadata().withName("test").withAnnotations(Map.of(MutationAnnotations.MUTABLE_INGRESS_VISITOR_GROUP_KEY, "vg1 , vg2")).endMetadata().build();
    // when
    String cidrListAsString = visitorGroupIngressReconciler.getCidrListAsString(ingress);
    // then
    assertThat(cidrListAsString).isEqualTo(visitorGroup1Ips + "," + visitorGroup2Ips);
}
Also used : IngressBuilder(io.fabric8.kubernetes.api.model.networking.v1.IngressBuilder) Ingress(io.fabric8.kubernetes.api.model.networking.v1.Ingress) Test(org.junit.jupiter.api.Test)

Example 44 with IngressBuilder

use of io.fabric8.kubernetes.api.model.networking.v1.IngressBuilder in project ingress-access-operator by neo9.

the class VisitorGroupServiceExposerReconcilerTest method shouldUseDefaultConfigurationIfThereIsNoAnnotation.

@Test
public void shouldUseDefaultConfigurationIfThereIsNoAnnotation() {
    // given
    Ingress ingress = new IngressBuilder().withNewMetadata().withName("test").endMetadata().build();
    // when
    String cidrListAsString = visitorGroupIngressReconciler.getCidrListAsString(ingress);
    // then
    assertThat(cidrListAsString).isEqualTo("0.0.0.0/0");
}
Also used : IngressBuilder(io.fabric8.kubernetes.api.model.networking.v1.IngressBuilder) Ingress(io.fabric8.kubernetes.api.model.networking.v1.Ingress) Test(org.junit.jupiter.api.Test)

Example 45 with IngressBuilder

use of io.fabric8.kubernetes.api.model.networking.v1.IngressBuilder in project ingress-access-operator by neo9.

the class VisitorGroupServiceExposerReconcilerTest method shouldUseDefaultConfigurationIfThereIsNoGroups.

@Test
public void shouldUseDefaultConfigurationIfThereIsNoGroups() {
    // given
    Ingress ingress = new IngressBuilder().withNewMetadata().withName("test").withAnnotations(Map.of(MutationAnnotations.MUTABLE_INGRESS_VISITOR_GROUP_KEY, "")).endMetadata().build();
    // when
    String cidrListAsString = visitorGroupIngressReconciler.getCidrListAsString(ingress);
    // then
    assertThat(cidrListAsString).isEqualTo("0.0.0.0/0");
}
Also used : IngressBuilder(io.fabric8.kubernetes.api.model.networking.v1.IngressBuilder) Ingress(io.fabric8.kubernetes.api.model.networking.v1.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