From 85ca84eae4c3b275d8537c8e7b49ee7445429598 Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Mon, 19 Jun 2023 12:58:49 +0300 Subject: [PATCH] Take image-pull-policy config into account for init-containers Fixes: #34125 --- .../io/quarkus/kubernetes/deployment/ContainerConverter.java | 1 + .../KubernetesWithInitContainerResourceLimitsTest.java | 1 + .../kubernetes-with-init-container-resource-limits.properties | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/ContainerConverter.java b/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/ContainerConverter.java index 6e11dd995851c..5852cf6051c83 100644 --- a/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/ContainerConverter.java +++ b/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/ContainerConverter.java @@ -15,6 +15,7 @@ public static Container convert(Map.Entry e) { private static ContainerBuilder convert(String name, ContainerConfig c) { ContainerBuilder b = new ContainerBuilder(); b.withName(name); + b.withImagePullPolicy(c.imagePullPolicy); c.image.ifPresent(b::withImage); c.workingDir.ifPresent(b::withWorkingDir); c.command.ifPresent(w -> b.withCommand(w.toArray(new String[0]))); diff --git a/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithInitContainerResourceLimitsTest.java b/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithInitContainerResourceLimitsTest.java index 8d26c47b375cf..b8303d5742500 100644 --- a/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithInitContainerResourceLimitsTest.java +++ b/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithInitContainerResourceLimitsTest.java @@ -57,6 +57,7 @@ public void assertGeneratedResources() throws IOException { assertThat(r.getLimits().get("cpu")).isEqualTo(new Quantity("500m")); assertThat(r.getLimits().get("memory")).isEqualTo(new Quantity("128Mi")); }); + assertThat(c.getImagePullPolicy()).isEqualTo("Always"); }); }); diff --git a/integration-tests/kubernetes/quarkus-standard-way/src/test/resources/kubernetes-with-init-container-resource-limits.properties b/integration-tests/kubernetes/quarkus-standard-way/src/test/resources/kubernetes-with-init-container-resource-limits.properties index 5654a69657e1f..8b412dcc4dcf4 100644 --- a/integration-tests/kubernetes/quarkus-standard-way/src/test/resources/kubernetes-with-init-container-resource-limits.properties +++ b/integration-tests/kubernetes/quarkus-standard-way/src/test/resources/kubernetes-with-init-container-resource-limits.properties @@ -4,4 +4,5 @@ quarkus.kubernetes.init-containers.foo.arguments=-c cp /some/file /somewhere/els quarkus.kubernetes.init-containers.foo.resources.requests.cpu=250m quarkus.kubernetes.init-containers.foo.resources.requests.memory=64Mi quarkus.kubernetes.init-containers.foo.resources.limits.cpu=500m -quarkus.kubernetes.init-containers.foo.resources.limits.memory=128Mi \ No newline at end of file +quarkus.kubernetes.init-containers.foo.resources.limits.memory=128Mi +quarkus.kubernetes.init-containers.foo.image-pull-policy=Always