Search in sources :

Example 1 with IngressRuleConfig

use of org.eclipse.jkube.kit.config.resource.IngressRuleConfig in project jkube by eclipse.

the class NetworkingV1IngressGeneratorTest method testGenerateWithXMLConfig.

@Test
public void testGenerateWithXMLConfig() {
    // Given
    ServiceBuilder testSvcBuilder = initTestService();
    KubernetesListBuilder kubernetesListBuilder = new KubernetesListBuilder().addToItems(testSvcBuilder);
    IngressRuleConfig ingressRuleConfig = IngressRuleConfig.builder().host("foo.bar.com").path(IngressRulePathConfig.builder().path("/foo").pathType("Prefix").serviceName("test-svc").servicePort(8080).resource(IngressRulePathResourceConfig.builder().apiGroup("k8s.example.com").kind("StorageSets").name("icon-assets").build()).build()).build();
    IngressTlsConfig ingressTlsConfig = IngressTlsConfig.builder().host("foo.bar.com").secretName("testsecret-tls").build();
    // When
    Ingress ingress = NetworkingV1IngressGenerator.generate(kubernetesListBuilder, testSvcBuilder, "org.eclipse.jkube", null, Collections.singletonList(ingressRuleConfig), Collections.singletonList(ingressTlsConfig), logger);
    // Then
    assertThat(ingress).hasFieldOrPropertyWithValue("metadata.name", "test-svc").extracting("spec.rules").asList().hasSize(1).element(0).hasFieldOrPropertyWithValue("host", "foo.bar.com");
}
Also used : KubernetesListBuilder(io.fabric8.kubernetes.api.model.KubernetesListBuilder) IngressTlsConfig(org.eclipse.jkube.kit.config.resource.IngressTlsConfig) IngressRuleConfig(org.eclipse.jkube.kit.config.resource.IngressRuleConfig) Ingress(io.fabric8.kubernetes.api.model.networking.v1.Ingress) ServiceBuilder(io.fabric8.kubernetes.api.model.ServiceBuilder) Test(org.junit.Test)

Example 2 with IngressRuleConfig

use of org.eclipse.jkube.kit.config.resource.IngressRuleConfig in project jkube by eclipse.

the class NetworkingV1IngressGenerator method getXmlConfiguredIngressSpec.

private static IngressSpec getXmlConfiguredIngressSpec(List<IngressRuleConfig> ingressRuleConfigs, List<IngressTlsConfig> ingressTlsConfigs) {
    IngressSpecBuilder ingressSpecBuilder = new IngressSpecBuilder();
    for (IngressRuleConfig ingressRuleConfig : ingressRuleConfigs) {
        IngressRule ingressRule = getIngressRuleFromXmlConfig(ingressRuleConfig);
        ingressSpecBuilder.addToRules(ingressRule);
    }
    for (IngressTlsConfig ingressTlsConfig : ingressTlsConfigs) {
        IngressTLS ingressTLS = getIngressTlsFromXMLConfig(ingressTlsConfig);
        ingressSpecBuilder.addToTls(ingressTLS);
    }
    return ingressSpecBuilder.build();
}
Also used : IngressTlsConfig(org.eclipse.jkube.kit.config.resource.IngressTlsConfig) IngressRule(io.fabric8.kubernetes.api.model.networking.v1.IngressRule) IngressSpecBuilder(io.fabric8.kubernetes.api.model.networking.v1.IngressSpecBuilder) IngressRuleConfig(org.eclipse.jkube.kit.config.resource.IngressRuleConfig) IngressTLS(io.fabric8.kubernetes.api.model.networking.v1.IngressTLS)

Example 3 with IngressRuleConfig

use of org.eclipse.jkube.kit.config.resource.IngressRuleConfig in project jkube by eclipse.

the class IngressEnricherTest method testGetIngressRuleXMLConfigWithNonNullResourceConfig.

@Test
public void testGetIngressRuleXMLConfigWithNonNullResourceConfig() {
    // Given
    ResourceConfig resourceConfig = ResourceConfig.builder().ingress(IngressConfig.builder().ingressRule(IngressRuleConfig.builder().host("host1").build()).build()).build();
    // When
    List<IngressRuleConfig> ingressRuleXMLConfig = IngressEnricher.getIngressRuleXMLConfig(resourceConfig);
    // Then
    assertThat(ingressRuleXMLConfig).asList().hasSize(1);
}
Also used : IngressRuleConfig(org.eclipse.jkube.kit.config.resource.IngressRuleConfig) ResourceConfig(org.eclipse.jkube.kit.config.resource.ResourceConfig) IngressRulePathResourceConfig(org.eclipse.jkube.kit.config.resource.IngressRulePathResourceConfig) Test(org.junit.Test)

Aggregations

IngressRuleConfig (org.eclipse.jkube.kit.config.resource.IngressRuleConfig)3 IngressTlsConfig (org.eclipse.jkube.kit.config.resource.IngressTlsConfig)2 Test (org.junit.Test)2 KubernetesListBuilder (io.fabric8.kubernetes.api.model.KubernetesListBuilder)1 ServiceBuilder (io.fabric8.kubernetes.api.model.ServiceBuilder)1 Ingress (io.fabric8.kubernetes.api.model.networking.v1.Ingress)1 IngressRule (io.fabric8.kubernetes.api.model.networking.v1.IngressRule)1 IngressSpecBuilder (io.fabric8.kubernetes.api.model.networking.v1.IngressSpecBuilder)1 IngressTLS (io.fabric8.kubernetes.api.model.networking.v1.IngressTLS)1 IngressRulePathResourceConfig (org.eclipse.jkube.kit.config.resource.IngressRulePathResourceConfig)1 ResourceConfig (org.eclipse.jkube.kit.config.resource.ResourceConfig)1