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");
}
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();
}
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);
}
Aggregations