use of com.bakdata.quick.manager.config.DeploymentConfig in project quick by bakdata.
the class ImageUpdaterTest method shouldNotUpdateFixedMirror.
@Test
void shouldNotUpdateFixedMirror() {
final MirrorResourceLoader loader = new MirrorResourceLoader(new KubernetesResources(), this.getDeploymentConfig(), this.getResourceConfig());
final MirrorService mirrorService = new KubernetesMirrorService(new KubernetesResources(), this.getManagerClient(), this.getDeploymentConfig(), loader);
final MirrorCreationData mirrorCreationData = new MirrorCreationData("topic", "service", 1, // use default tag
FIXED_TAG, null);
mirrorService.createMirror(mirrorCreationData).blockingAwait();
assertThat(this.getDeployments()).hasSize(1).first().extracting(ImageUpdaterTest::getContainerImage).isEqualTo(String.format("%s/%s:%s", DOCKER_REGISTRY, MIRROR_IMAGE, FIXED_TAG));
final DeploymentConfig newDeploymentConfig = this.createNewDeploymentConfig();
final ImageUpdater imageUpdater = new ImageUpdater(this.client, newDeploymentConfig);
imageUpdater.updateManagedDeployments();
assertThat(this.getDeployments()).hasSize(1).first().extracting(ImageUpdaterTest::getContainerImage).isEqualTo(String.format("%s/%s:%s", DOCKER_REGISTRY, MIRROR_IMAGE, FIXED_TAG));
}
use of com.bakdata.quick.manager.config.DeploymentConfig in project quick by bakdata.
the class ImageUpdaterTest method shouldUpdateMirror.
@Test
void shouldUpdateMirror() {
final MirrorResourceLoader loader = new MirrorResourceLoader(new KubernetesResources(), this.getDeploymentConfig(), this.getResourceConfig());
final MirrorService mirrorService = new KubernetesMirrorService(new KubernetesResources(), this.getManagerClient(), this.getDeploymentConfig(), loader);
final MirrorCreationData mirrorCreationData = new MirrorCreationData("topic", "service", 1, // use default tag
null, null);
mirrorService.createMirror(mirrorCreationData).blockingAwait();
assertThat(this.getDeployments()).hasSize(1).first().extracting(ImageUpdaterTest::getContainerImage).isEqualTo(String.format("%s/%s:%s", DOCKER_REGISTRY, MIRROR_IMAGE, DEFAULT_IMAGE_TAG));
final DeploymentConfig newDeploymentConfig = this.createNewDeploymentConfig();
final ImageUpdater imageUpdater = new ImageUpdater(this.client, newDeploymentConfig);
imageUpdater.updateManagedDeployments();
assertThat(this.getDeployments()).hasSize(1).first().extracting(ImageUpdaterTest::getContainerImage).isEqualTo(String.format("%s/%s:%s", DOCKER_REGISTRY, MIRROR_IMAGE, NEW_TAG));
}
use of com.bakdata.quick.manager.config.DeploymentConfig in project quick by bakdata.
the class GatewayResourceLoaderTest method shouldCreateGatewayIngressWithHttpIngress.
@Test
void shouldCreateGatewayIngressWithHttpIngress() {
// given null host and ingress point
final Optional<String> host = Optional.empty();
final String ingressEntrypoint = "web";
final boolean useSsl = false;
final GatewayCreationData gatewayCreationData = new GatewayCreationData(GATEWAY_NAME, REPLICAS, TAG, null);
final DeploymentConfig customConfig = new DeploymentConfig(this.getDeploymentConfig().getDockerRegistry(), this.getDeploymentConfig().getDefaultImageTag(), this.getDeploymentConfig().getDefaultReplicas(), host, useSsl, ingressEntrypoint);
final GatewayResourceLoader customLoader = new GatewayResourceLoader(new KubernetesResources(), customConfig, TestUtil.newResourceConfig(), NAMESPACE);
final GatewayResources gatewayResources = customLoader.forCreation(gatewayCreationData, ResourcePrefix.GATEWAY);
final Optional<HasMetadata> hasMetadata = findResource(gatewayResources, ResourceKind.INGRESS);
final String expected = ResourcePrefix.GATEWAY.getPrefix() + GATEWAY_NAME;
assertThat(hasMetadata).isPresent().get(InstanceOfAssertFactories.type(Ingress.class)).satisfies(gatewayIngress -> {
assertThat(gatewayIngress.getMetadata()).hasFieldOrPropertyWithValue("name", expected).extracting(ObjectMeta::getAnnotations, MAP).containsExactlyInAnyOrderEntriesOf(Map.of("kubernetes.io/ingress.class", "traefik", "traefik.ingress.kubernetes.io/router.middlewares", String.format("%s-%s@kubernetescrd", "test", expected), "traefik.ingress.kubernetes.io/router.entrypoints", "web", "traefik.ingress.kubernetes.io/router.tls", "false"));
final IngressSpec ingressSpec = gatewayIngress.getSpec();
assertThat(ingressSpec).isNotNull();
assertThat(ingressSpec.getRules()).isNotNull().hasSize(1).first().satisfies(rule -> assertThat(rule.getHost()).isNull());
});
}
Aggregations