use of com.marcnuri.yakc.model.io.k8s.api.networking.v1.Ingress in project ingress-access-operator by neo9.
the class ServiceExposerReconcilerTest method shouldNotEnableTlsByDefault.
@Test
public void shouldNotEnableTlsByDefault() {
// given
Ingress ingress = new IngressBuilder().withNewMetadata().withNamespace("mynamespace").withName("myname").addToAnnotations(EXPOSE_INGRESS_HOSTNAME, "hello.{{domain}}").endMetadata().build();
// when
boolean shouldEnableTls = serviceExposerReconciler.shouldEnableTls(ingress.getMetadata().getAnnotations());
// then
assertThat(shouldEnableTls).isFalse();
}
use of com.marcnuri.yakc.model.io.k8s.api.networking.v1.Ingress in project ingress-access-operator by neo9.
the class VisitorGroupServiceExposerReconcilerTest method shouldWellComputeWhitelistForTwoGroup.
@Test
public void shouldWellComputeWhitelistForTwoGroup() {
// 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);
}
use of com.marcnuri.yakc.model.io.k8s.api.networking.v1.Ingress in project ingress-access-operator by neo9.
the class VisitorGroupServiceExposerReconcilerTest method shouldPanicOnUnknownVisitorGroup.
@Test
public void shouldPanicOnUnknownVisitorGroup() {
// given
Ingress ingress = new IngressBuilder().withNewMetadata().withName("test").withAnnotations(Map.of(MutationAnnotations.MUTABLE_INGRESS_VISITOR_GROUP_KEY, "vgUndefined")).endMetadata().build();
// when / then
assertThatThrownBy(() -> visitorGroupIngressReconciler.getCidrListAsString(ingress)).isInstanceOf(VisitorGroupNotFoundException.class);
}
use of com.marcnuri.yakc.model.io.k8s.api.networking.v1.Ingress in project quarkus by quarkusio.
the class KubernetesWithIngressTest method assertGeneratedResources.
@Test
public void assertGeneratedResources() throws IOException {
final Path kubernetesDir = prodModeTestResults.getBuildDir().resolve("kubernetes");
assertThat(kubernetesDir).isDirectoryContaining(p -> p.getFileName().endsWith("kubernetes.json")).isDirectoryContaining(p -> p.getFileName().endsWith("kubernetes.yml"));
List<HasMetadata> kubernetesList = DeserializationUtil.deserializeAsList(kubernetesDir.resolve("kubernetes.yml"));
assertThat(kubernetesList.get(0)).isInstanceOfSatisfying(Deployment.class, d -> {
assertThat(d.getMetadata()).satisfies(m -> {
assertThat(m.getName()).isEqualTo("kubernetes-with-ingress");
});
assertThat(d.getSpec()).satisfies(deploymentSpec -> {
assertThat(deploymentSpec.getTemplate()).satisfies(t -> {
assertThat(t.getSpec()).satisfies(podSpec -> {
});
});
});
});
assertThat(kubernetesList).filteredOn(i -> "Ingress".equals(i.getKind())).singleElement().satisfies(item -> {
assertThat(item).isInstanceOfSatisfying(Ingress.class, ingress -> {
// Check that labels and annotations are also applied to Routes (#10260)
assertThat(ingress.getMetadata()).satisfies(m -> {
assertThat(m.getName()).isEqualTo("kubernetes-with-ingress");
});
assertThat(ingress.getSpec().getRules()).allSatisfy(rule -> {
assertThat(rule.getHttp().getPaths()).allSatisfy(path -> {
assertThat(path.getPath()).isNotBlank();
assertThat(path.getPathType()).isNotBlank();
});
});
});
});
}
use of com.marcnuri.yakc.model.io.k8s.api.networking.v1.Ingress in project yakc by manusa.
the class NetworkingV1IngressIT method readNamespacedIngress.
@Test
@DisplayName("readNamespacedIngress, should read existing Ingress with provided name")
void readNamespacedIngress() throws IOException {
// When
final Ingress result = KC.create(NetworkingV1Api.class).readNamespacedIngress(ingressName, NAMESPACE).get();
// Then
assertThat(result).isNotNull().extracting("metadata").hasFieldOrPropertyWithValue("name", ingressName).hasFieldOrPropertyWithValue("creationTimestamp", ingress.getMetadata().getCreationTimestamp());
}
Aggregations