-
Notifications
You must be signed in to change notification settings - Fork 1.1k
drop loading image when its already present #1763
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,9 +54,7 @@ | |
|
|
||
| import static org.awaitility.Awaitility.await; | ||
| import static org.junit.jupiter.api.Assertions.fail; | ||
| import static org.springframework.cloud.kubernetes.integration.tests.commons.Commons.loadImage; | ||
| import static org.springframework.cloud.kubernetes.integration.tests.commons.Commons.pomVersion; | ||
| import static org.springframework.cloud.kubernetes.integration.tests.commons.Commons.pullImage; | ||
|
|
||
| /** | ||
| * @author wind57 | ||
|
|
@@ -65,15 +63,9 @@ public final class Util { | |
|
|
||
| private static final Log LOG = LogFactory.getLog(Util.class); | ||
|
|
||
| /** Image we get {@code istioctl} from in order to install Istio. */ | ||
| public static final String ISTIO_ISTIOCTL = "istio/istioctl"; | ||
|
|
||
| private final K3sContainer container; | ||
|
|
||
| private final KubernetesClient client; | ||
|
|
||
| public Util(K3sContainer container) { | ||
| this.container = container; | ||
| this.client = new KubernetesClientBuilder().withConfig(Config.fromKubeconfig(container.getKubeConfigYaml())) | ||
| .build(); | ||
| } | ||
|
|
@@ -85,7 +77,7 @@ public Util(K3sContainer container) { | |
| * tight as possible, providing reasonable defaults. | ||
| * | ||
| */ | ||
| public void createAndWait(String namespace, String name, @Nullable Deployment deployment, @Nullable Service service, | ||
| public void createAndWait(String namespace, @Nullable Deployment deployment, @Nullable Service service, | ||
| @Nullable Ingress ingress, boolean changeVersion) { | ||
| try { | ||
|
|
||
|
|
@@ -104,11 +96,6 @@ public void createAndWait(String namespace, String name, @Nullable Deployment de | |
| .get(0) | ||
| .setImage(imageFromDeployment + ":" + pomVersion()); | ||
| } | ||
| else { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't recall the history of why we needed this, but we do not anymore. At this point in time the images are already un-tared/downloaded and loaded in k3s, as such we can drop this code
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this was needed for Jenkins because on our end we hit threshold limits from Dockerhub inside of K3S. If we pull the images and load them in in the test iself we use our Dockerhub credentials and we don't run into the threshold limits from Dockerhub
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I get it, will close this PR cause its a lot easier to make a new one then re-work this one. thx! |
||
| String[] image = imageFromDeployment.split(":", 2); | ||
| pullImage(image[0], image[1], container); | ||
| loadImage(image[0], image[1], name, container); | ||
| } | ||
|
|
||
| client.apps().deployments().inNamespace(namespace).resource(deployment).create(); | ||
| waitForDeployment(namespace, deployment); | ||
|
|
@@ -141,7 +128,7 @@ public void busybox(String namespace, Phase phase) { | |
| Service service = client.services().load(serviceStream).item(); | ||
|
|
||
| if (phase.equals(Phase.CREATE)) { | ||
| createAndWait(namespace, "busybox", deployment, service, null, false); | ||
| createAndWait(namespace, deployment, service, null, false); | ||
| } | ||
| else if (phase.equals(Phase.DELETE)) { | ||
| deleteAndWait(namespace, deployment, service, null); | ||
|
|
@@ -311,7 +298,7 @@ public void setUpIstioctl(String namespace, Phase phase) { | |
| istioctlDeployment.getSpec().getTemplate().getSpec().getContainers().get(0).setImage(imageWithVersion); | ||
|
|
||
| if (phase.equals(Phase.CREATE)) { | ||
| createAndWait(namespace, null, istioctlDeployment, null, null, false); | ||
| createAndWait(namespace, istioctlDeployment, null, null, false); | ||
| } | ||
| else { | ||
| deleteAndWait(namespace, istioctlDeployment, null, null); | ||
|
|
@@ -362,7 +349,7 @@ public void wiremock(String namespace, String path, Phase phase, boolean withIng | |
|
|
||
| deployment.getMetadata().setNamespace(namespace); | ||
| service.getMetadata().setNamespace(namespace); | ||
| createAndWait(namespace, "wiremock", deployment, service, ingress, false); | ||
| createAndWait(namespace, deployment, service, ingress, false); | ||
| } | ||
| else { | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -65,9 +65,7 @@ | |
|
|
||
| import static org.awaitility.Awaitility.await; | ||
| import static org.junit.jupiter.api.Assertions.fail; | ||
| import static org.springframework.cloud.kubernetes.integration.tests.commons.Commons.loadImage; | ||
| import static org.springframework.cloud.kubernetes.integration.tests.commons.Commons.pomVersion; | ||
| import static org.springframework.cloud.kubernetes.integration.tests.commons.Commons.pullImage; | ||
|
|
||
| /** | ||
| * @author wind57 | ||
|
|
@@ -84,8 +82,6 @@ public final class Util { | |
|
|
||
| private final RbacAuthorizationV1Api rbacApi; | ||
|
|
||
| private final K3sContainer container; | ||
|
|
||
| public Util(K3sContainer container) { | ||
|
|
||
| ApiClient client; | ||
|
|
@@ -99,7 +95,6 @@ public Util(K3sContainer container) { | |
| client.setDebugging(false); | ||
| Configuration.setDefaultApiClient(client); | ||
|
|
||
| this.container = container; | ||
| this.coreV1Api = new CoreV1Api(); | ||
| this.appsV1Api = new AppsV1Api(); | ||
| this.networkingV1Api = new NetworkingV1Api(); | ||
|
|
@@ -113,8 +108,8 @@ public Util(K3sContainer container) { | |
| * tight as possible, providing reasonable defaults. | ||
| * | ||
| */ | ||
| public void createAndWait(String namespace, String name, V1Deployment deployment, V1Service service, | ||
| @Nullable V1Ingress ingress, boolean changeVersion) { | ||
| public void createAndWait(String namespace, V1Deployment deployment, V1Service service, @Nullable V1Ingress ingress, | ||
| boolean changeVersion) { | ||
| try { | ||
|
|
||
| coreV1Api.createNamespacedService(namespace, service, null, null, null, null); | ||
|
|
@@ -134,11 +129,6 @@ public void createAndWait(String namespace, String name, V1Deployment deployment | |
| .get(0) | ||
| .setImage(imageFromDeployment + ":" + pomVersion()); | ||
| } | ||
| else { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same comment as above
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same comment as above ;) |
||
| String[] image = imageFromDeployment.split(":", 2); | ||
| pullImage(image[0], image[1], container); | ||
| loadImage(image[0], image[1], name, container); | ||
| } | ||
|
|
||
| appsV1Api.createNamespacedDeployment(namespace, deployment, null, null, null, null); | ||
| waitForDeployment(namespace, deployment); | ||
|
|
@@ -252,7 +242,7 @@ public void busybox(String namespace, Phase phase) { | |
|
|
||
| V1Service service = (V1Service) yaml("busybox/service.yaml"); | ||
| if (phase.equals(Phase.CREATE)) { | ||
| createAndWait(namespace, "busybox", deployment, service, null, false); | ||
| createAndWait(namespace, deployment, service, null, false); | ||
| } | ||
| else if (phase.equals(Phase.DELETE)) { | ||
| deleteAndWait(namespace, deployment, service, null); | ||
|
|
@@ -271,7 +261,7 @@ public void kafka(String namespace, Phase phase) { | |
|
|
||
| if (phase.equals(Phase.CREATE)) { | ||
| createAndWait(namespace, configMap, null); | ||
| createAndWait(namespace, "kafka", deployment, service, null, false); | ||
| createAndWait(namespace, deployment, service, null, false); | ||
| } | ||
| else if (phase.equals(Phase.DELETE)) { | ||
| deleteAndWait(namespace, configMap, null); | ||
|
|
@@ -289,7 +279,7 @@ public void rabbitMq(String namespace, Phase phase) { | |
| V1Service service = (V1Service) yaml("rabbitmq/rabbitmq-service.yaml"); | ||
|
|
||
| if (phase.equals(Phase.CREATE)) { | ||
| createAndWait(namespace, "rabbitmq", deployment, service, null, false); | ||
| createAndWait(namespace, deployment, service, null, false); | ||
| } | ||
| else if (phase.equals(Phase.DELETE)) { | ||
| deleteAndWait(namespace, deployment, service, null); | ||
|
|
@@ -479,7 +469,7 @@ public void wiremock(String namespace, String path, Phase phase, boolean withIng | |
|
|
||
| deployment.getMetadata().setNamespace(namespace); | ||
| service.getMetadata().setNamespace(namespace); | ||
| createAndWait(namespace, "wiremock", deployment, service, ingress, false); | ||
| createAndWait(namespace, deployment, service, ingress, false); | ||
| } | ||
| else { | ||
| if (withIngress) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we did this check in a previous PR for busybox, let's do it for every other image
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just move the check to
Commons.loadinstead?