diff --git a/.github/workflows/composites/env-variables/action.yaml b/.github/workflows/composites/env-variables/action.yaml index a1d6764ff3..a33383182f 100644 --- a/.github/workflows/composites/env-variables/action.yaml +++ b/.github/workflows/composites/env-variables/action.yaml @@ -21,4 +21,3 @@ runs: echo "BRANCH_NAME=$(echo $GITHUB_HEAD_REF)" >> $GITHUB_ENV echo "BASE_BRANCH_NAME=$(echo $GITHUB_BASE_REF)" >> $GITHUB_ENV - echo "DOCKER_IMAGES_KEY=$(echo $GITHUB_RUN_ID)" >> $GITHUB_ENV diff --git a/.github/workflows/composites/matrix-bounds-on-test-times-cache-hit/action.yaml b/.github/workflows/composites/matrix-bounds-on-test-times-cache-hit/action.yaml index 4badaf1b57..d79b978389 100644 --- a/.github/workflows/composites/matrix-bounds-on-test-times-cache-hit/action.yaml +++ b/.github/workflows/composites/matrix-bounds-on-test-times-cache-hit/action.yaml @@ -19,7 +19,7 @@ runs: steps: - name: restore test times cache - uses: actions/cache/restore@v3 + uses: actions/cache/restore@v4 with: path: /tmp/sorted.txt key: ${{ runner.os }}-spring-cloud-k8s-existing-test-times-cache-${{ github.run_id }} @@ -117,13 +117,13 @@ runs: echo "AVERAGE_TIME_PER_INSTANCE=$(echo $average_time_per_instance_json)" >> $GITHUB_ENV - name: upload test with times - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: tests-with-times-sorted.txt path: /tmp/tests-with-times-sorted.txt - name: upload test without times - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: tests-without-times.txt path: /tmp/tests-without-times.txt diff --git a/.github/workflows/composites/maven-build-with-dry-run-for-tests/action.yaml b/.github/workflows/composites/maven-build-with-dry-run-for-tests/action.yaml index 202705c0d4..6a4b927ab1 100644 --- a/.github/workflows/composites/maven-build-with-dry-run-for-tests/action.yaml +++ b/.github/workflows/composites/maven-build-with-dry-run-for-tests/action.yaml @@ -30,7 +30,7 @@ runs: run: cat /tmp/tests.txt - name: upload test - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: tests.txt path: /tmp/tests.txt diff --git a/.github/workflows/composites/pre-test-actions/action.yaml b/.github/workflows/composites/pre-test-actions/action.yaml index 657c55e886..2b372d2737 100644 --- a/.github/workflows/composites/pre-test-actions/action.yaml +++ b/.github/workflows/composites/pre-test-actions/action.yaml @@ -15,13 +15,12 @@ runs: uses: ./.github/workflows/composites/setup-jdk17 if: env.BASE_BRANCH == 'main' - - name: setup project jdk-8 - uses: ./.github/workflows/composites/setup-jdk1.8 - if: env.BASE_BRANCH == '2.1.x' - - name: cache local maven repository uses: ./.github/workflows/composites/cache + - name: restore common images + uses: ./.github/workflows/composites/restore-docker-images + - name: build project shell: bash run: | @@ -34,7 +33,7 @@ runs: uses: ./.github/workflows/composites/build-integration-tests-project - name: download tests - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: tests.txt path: /tmp diff --git a/.github/workflows/composites/restore-docker-images/action.yaml b/.github/workflows/composites/restore-docker-images/action.yaml new file mode 100644 index 0000000000..f6d77c5cf0 --- /dev/null +++ b/.github/workflows/composites/restore-docker-images/action.yaml @@ -0,0 +1,40 @@ +name: restore-docker-images +description: upload docker images +runs: + using: "composite" + steps: + + - name: restore images if cache matches + uses: actions/cache/restore@v4 + id: images-cache + with: + path: /tmp/docker/images + key: docker-images-github-cache-${{ hashFiles('**/current-images.txt') }} + + - name: pull docker images + shell: bash + if: steps.images-cache.outputs.cache-hit != 'true' + run: | + echo 'start pulling common images' + mkdir -p /tmp/docker/images + result=$(find . -name 'current-images.txt') + while read line; do + docker pull "$line" + replace_slash=$(tr '/' '-' <<< "$line") + docker save "${line}" > "/tmp/docker/images/${replace_slash}.tar" + done <$result + + - name: save docker images + id: save-docker-images + uses: actions/cache/save@v4 + if: steps.images-cache.outputs.cache-hit != 'true' + with: + path: | + /tmp/docker/images + + - name: print images + shell: bash + run: | + echo 'printing images' + ls /tmp/docker/images + diff --git a/.github/workflows/composites/run-and-save-test-times-when-cache-missing/action.yaml b/.github/workflows/composites/run-and-save-test-times-when-cache-missing/action.yaml index d262d89bbd..786cd0ce95 100644 --- a/.github/workflows/composites/run-and-save-test-times-when-cache-missing/action.yaml +++ b/.github/workflows/composites/run-and-save-test-times-when-cache-missing/action.yaml @@ -37,39 +37,17 @@ runs: TEST_ARG=$(echo ${sliced_array[@]} | sed 's/ /,/g') echo "$TEST_ARG" - if [[ $baseBranch == "2.1.x" ]]; then - - ./mvnw -s .settings.xml -pl '-:kubernetes-leader-election-example' -pl '-:kubernetes-hello-world-example' \ - -pl '-:kubernetes-reload-example' -pl '-:kubernetes-loadbalancer-example' \ - -pl '-:spring-cloud-kubernetes-configserver' -pl '-:spring-cloud-kubernetes-configuration-watcher' \ - -pl '-:spring-cloud-kubernetes-discoveryserver' \ - -DtestsToRun=${TEST_ARG[@]} \ - -e clean install \ - -U -P sonar -nsu --batch-mode \ - -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \ - -Dhttp.keepAlive=false \ - -Dmaven.wagon.http.pool=false \ - -Dmaven.wagon.http.retryHandler.class=standard \ - -Dmaven.wagon.http.retryHandler.count=3 \ - -Dskip.build.image=true - - else - - version=$(java -version) - echo "version of java: $version" - - ./mvnw -s .settings.xml \ - -DtestsToRun=${TEST_ARG[@]} \ - -DCURRENT_INSTANCE=${CURRENT_INDEX} \ - -e clean install \ - -P sonar -nsu --batch-mode \ - -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \ - -Dhttp.keepAlive=false \ - -Dmaven.wagon.http.pool=false \ - -Dmaven.wagon.http.retryHandler.class=standard \ - -Dmaven.wagon.http.retryHandler.count=3 \ - -Dskip.build.image=true - fi + ./mvnw -s .settings.xml \ + -DtestsToRun=${TEST_ARG[@]} \ + -DCURRENT_INSTANCE=${CURRENT_INDEX} \ + -e clean install \ + -P sonar -nsu --batch-mode \ + -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \ + -Dhttp.keepAlive=false \ + -Dmaven.wagon.http.pool=false \ + -Dmaven.wagon.http.retryHandler.class=standard \ + -Dmaven.wagon.http.retryHandler.count=3 \ + -Dskip.build.image=true touch /tmp/test_times_${{ env.CURRENT_INDEX }}.txt @@ -85,12 +63,10 @@ runs: - name: show individual test times shell: bash - if: env.BASE_BRANCH != '2.1.x' run: cat /tmp/test_times_${{ env.CURRENT_INDEX }}.txt - name: upload individual tests - if: env.BASE_BRANCH != '2.1.x' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: test_times_${{ env.CURRENT_INDEX }}.txt path: /tmp/test_times_${{ env.CURRENT_INDEX }}.txt diff --git a/.github/workflows/composites/run-and-save-test-times-when-cache-present/action.yaml b/.github/workflows/composites/run-and-save-test-times-when-cache-present/action.yaml index c81655555f..15fb3abd1b 100644 --- a/.github/workflows/composites/run-and-save-test-times-when-cache-present/action.yaml +++ b/.github/workflows/composites/run-and-save-test-times-when-cache-present/action.yaml @@ -6,15 +6,13 @@ runs: steps: - name: download tests with times - if: env.BASE_BRANCH != '2.1.x' - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: tests-with-times-sorted.txt path: /tmp/ - name: download tests without times - if: env.BASE_BRANCH != '2.1.x' - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: tests-without-times.txt path: /tmp/ @@ -187,12 +185,10 @@ runs: - name: show individual test times shell: bash - if: env.BASE_BRANCH != '2.1.x' run: cat /tmp/test_times_${{ env.CURRENT_INDEX }}.txt - name: upload individual tests - if: env.BASE_BRANCH != '2.1.x' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: test_times_${{ env.CURRENT_INDEX }}.txt path: /tmp/test_times_${{ env.CURRENT_INDEX }}.txt diff --git a/.github/workflows/composites/setup-jdk1.8/action.yaml b/.github/workflows/composites/setup-jdk1.8/action.yaml deleted file mode 100755 index 7dab637584..0000000000 --- a/.github/workflows/composites/setup-jdk1.8/action.yaml +++ /dev/null @@ -1,9 +0,0 @@ -name: setup project with jdk-8 -description: setup project with jdk-8 -runs: - using: "composite" - steps: - - uses: actions/setup-java@v3 - with: - distribution: 'temurin' - java-version: '8' diff --git a/.github/workflows/composites/setup-jdk17/action.yaml b/.github/workflows/composites/setup-jdk17/action.yaml index 19dcd374ab..1e491f1e73 100755 --- a/.github/workflows/composites/setup-jdk17/action.yaml +++ b/.github/workflows/composites/setup-jdk17/action.yaml @@ -3,7 +3,7 @@ description: setup project with jdk-17 runs: using: "composite" steps: - - uses: actions/setup-java@v3 + - uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: '17' diff --git a/.github/workflows/composites/test-times/action.yaml b/.github/workflows/composites/test-times/action.yaml index 33d2c13bfe..1fa1bd4170 100644 --- a/.github/workflows/composites/test-times/action.yaml +++ b/.github/workflows/composites/test-times/action.yaml @@ -15,18 +15,15 @@ runs: # we omit the name, as such all artifacts are downloaded - name: download all artifacts - if: env.BASE_BRANCH != '2.1.x' - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: path: /tmp/all-artifacts - name: show all artifacts - if: env.BASE_BRANCH != '2.1.x' shell: bash run: ls -l /tmp/all-artifacts - name: merge all artifacts into a single file and sort by time - if: env.BASE_BRANCH != '2.1.x' shell: bash run: | arr=($(find /tmp/all-artifacts/ -type f -name "test_times*")) @@ -41,7 +38,6 @@ runs: cat /tmp/sorted.txt - name: show all tests in a sorted manner - if: env.BASE_BRANCH != '2.1.x' shell: bash run: cat /tmp/sorted.txt @@ -51,8 +47,7 @@ runs: # meaning there could be many of them already present and this is not an exact match # github in this case will pick up the latest one, exactly what we want. - name: save test times in cache - uses: actions/cache/save@v3 - if: env.BASE_BRANCH != '2.1.x' + uses: actions/cache/save@v4 with: path: /tmp/sorted.txt key: ${{ runner.os }}-spring-cloud-k8s-existing-test-times-cache-${{ github.run_id }} diff --git a/.github/workflows/composites/upload-docker-images/action.yaml b/.github/workflows/composites/upload-docker-images/action.yaml deleted file mode 100644 index 83c7657e19..0000000000 --- a/.github/workflows/composites/upload-docker-images/action.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# we are not going to use upload/download actions, since it is slower than cache usage -# as key to the cache we are going to use DOCKER_IMAGES_KEY, which is the same as GITHUB_RUN_ID - -name: upload docker images -description: upload docker images -runs: - using: "composite" - steps: - - - uses: Wandalen/wretry.action@master - with: - attempt_limit: 3 - action: buildjet/cache@v3 - with: | - path: /tmp/docker/images - key: docker-images-cache-${{ env.DOCKER_IMAGES_KEY }} - restore-keys: docker-images-cache-${{ env.DOCKER_IMAGES_KEY }} - - diff --git a/.github/workflows/maven.yaml b/.github/workflows/maven.yaml index fd2779105d..a68e5d45a8 100644 --- a/.github/workflows/maven.yaml +++ b/.github/workflows/maven.yaml @@ -2,9 +2,9 @@ name: github-workflow on: push: - branches: [ main, 2.1.x, 3.0.x ] + branches: [ main, 3.0.x ] pull_request: - branches: [ main, 2.1.x, 3.0.x ] + branches: [ main, 3.0.x ] jobs: build: @@ -27,7 +27,7 @@ jobs: steps: - name: checkout project - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: set env variables uses: ./.github/workflows/composites/env-variables @@ -37,10 +37,6 @@ jobs: uses: ./.github/workflows/composites/setup-jdk17 if: env.BASE_BRANCH == 'main' || env.BASE_BRANCH == '3.0.x' - - name: setup project jdk-8 - uses: ./.github/workflows/composites/setup-jdk1.8 - if: env.BASE_BRANCH == '2.1.x' - - name: cache local maven repository uses: ./.github/workflows/composites/cache @@ -61,8 +57,7 @@ jobs: - name: restore test times cache if it exists id: restore_test_times_cache - if: env.BASE_BRANCH != '2.1.x' - uses: actions/cache/restore@v3 + uses: actions/cache/restore@v4 with: path: /tmp/sorted.txt key: ${{ runner.os }}-spring-cloud-k8s-existing-test-times-cache-${{ github.run_id }} @@ -110,7 +105,7 @@ jobs: steps: - name: checkout project - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: clean space uses: ./.github/workflows/composites/clean-space @@ -122,10 +117,6 @@ jobs: uses: ./.github/workflows/composites/setup-jdk17 if: env.BASE_BRANCH == 'main' || env.BASE_BRANCH == '3.0.x' - - name: setup project jdk-8 - uses: ./.github/workflows/composites/setup-jdk1.8 - if: env.BASE_BRANCH == '2.1.x' - - name: pre-test-actions uses: ./.github/workflows/composites/pre-test-actions @@ -158,7 +149,7 @@ jobs: steps: - name: checkout project - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: clean space uses: ./.github/workflows/composites/clean-space @@ -170,10 +161,6 @@ jobs: uses: ./.github/workflows/composites/setup-jdk17 if: env.BASE_BRANCH == 'main' || env.BASE_BRANCH == '3.0.x' - - name: setup project jdk-8 - uses: ./.github/workflows/composites/setup-jdk1.8 - if: env.BASE_BRANCH == '2.1.x' - - name: pre-test-actions uses: ./.github/workflows/composites/pre-test-actions @@ -190,7 +177,6 @@ jobs: - name: run and save individual test times env: CURRENT_INDEX: ${{ matrix.current_index }} - if: env.BASE_BRANCH != '2.1.x' uses: ./.github/workflows/composites/run-and-save-test-times-when-cache-missing save_test_times_when_cache_missing: @@ -200,10 +186,9 @@ jobs: steps: - name: checkout project - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: compute and save running time of tests - if: env.BASE_BRANCH != '2.1.x' uses: ./.github/workflows/composites/test-times save_test_times_when_cache_present: @@ -213,8 +198,7 @@ jobs: steps: - name: checkout project - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: compute and save running time of tests - if: env.BASE_BRANCH != '2.1.x' uses: ./.github/workflows/composites/test-times diff --git a/spring-cloud-kubernetes-client-loadbalancer/src/test/java/org/springframework/cloud/kubernetes/client/loadbalancer/KubernetesClientServicesListSupplierTests.java b/spring-cloud-kubernetes-client-loadbalancer/src/test/java/org/springframework/cloud/kubernetes/client/loadbalancer/KubernetesClientServicesListSupplierTests.java index cbfa69a7b8..be18b3fb02 100644 --- a/spring-cloud-kubernetes-client-loadbalancer/src/test/java/org/springframework/cloud/kubernetes/client/loadbalancer/KubernetesClientServicesListSupplierTests.java +++ b/spring-cloud-kubernetes-client-loadbalancer/src/test/java/org/springframework/cloud/kubernetes/client/loadbalancer/KubernetesClientServicesListSupplierTests.java @@ -23,7 +23,6 @@ import com.github.tomakehurst.wiremock.WireMockServer; import com.github.tomakehurst.wiremock.client.WireMock; -import com.github.tomakehurst.wiremock.common.ConsoleNotifier; import io.kubernetes.client.openapi.ApiClient; import io.kubernetes.client.openapi.Configuration; import io.kubernetes.client.openapi.JSON; @@ -100,7 +99,7 @@ class KubernetesClientServicesListSupplierTests { @BeforeAll static void setup() { - wireMockServer = new WireMockServer(options().dynamicPort().notifier(new ConsoleNotifier(true))); + wireMockServer = new WireMockServer(options().dynamicPort()); wireMockServer.start(); WireMock.configureFor("localhost", wireMockServer.port()); diff --git a/spring-cloud-kubernetes-client-loadbalancer/src/test/java/org/springframework/cloud/kubernetes/client/loadbalancer/it/mode/service/AllNamespacesTest.java b/spring-cloud-kubernetes-client-loadbalancer/src/test/java/org/springframework/cloud/kubernetes/client/loadbalancer/it/mode/service/AllNamespacesTest.java index 27ec8b26ee..3ec2160cbc 100644 --- a/spring-cloud-kubernetes-client-loadbalancer/src/test/java/org/springframework/cloud/kubernetes/client/loadbalancer/it/mode/service/AllNamespacesTest.java +++ b/spring-cloud-kubernetes-client-loadbalancer/src/test/java/org/springframework/cloud/kubernetes/client/loadbalancer/it/mode/service/AllNamespacesTest.java @@ -18,7 +18,6 @@ import com.github.tomakehurst.wiremock.WireMockServer; import com.github.tomakehurst.wiremock.client.WireMock; -import com.github.tomakehurst.wiremock.common.ConsoleNotifier; import io.kubernetes.client.openapi.ApiClient; import io.kubernetes.client.openapi.models.V1Endpoints; import io.kubernetes.client.openapi.models.V1EndpointsList; @@ -90,7 +89,7 @@ class AllNamespacesTest { @BeforeAll static void beforeAll() { - wireMockServer = new WireMockServer(options().dynamicPort().notifier(new ConsoleNotifier(true))); + wireMockServer = new WireMockServer(options().dynamicPort()); wireMockServer.start(); WireMock.configureFor("localhost", wireMockServer.port()); mockWatchers(); diff --git a/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/leader/LeaderProperties.java b/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/leader/LeaderProperties.java index f135246154..c5a5bf073d 100644 --- a/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/leader/LeaderProperties.java +++ b/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/leader/LeaderProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2019 the original author or authors. + * Copyright 2013-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,29 +26,15 @@ @ConfigurationProperties("spring.cloud.kubernetes.leader") public class LeaderProperties { - private static final boolean DEFAULT_ENABLED = true; - - private static final String DEFAULT_LEADER_ID_PREFIX = "leader.id."; - - private static final boolean DEFAULT_AUTO_STARTUP = true; - - private static final String DEFAULT_CONFIG_MAP_NAME = "leaders"; - - private static final Duration DEFAULT_UPDATE_PERIOD = Duration.ofMillis(60000); - - private static final boolean DEFAULT_PUBLISH_FAILED_EVENTS = false; - - private static final boolean DEFAULT_CREATE_CONFIG_MAP = true; - /** * Should leader election be enabled. Default: true */ - private boolean enabled = DEFAULT_ENABLED; + private boolean enabled = true; /** * Should leader election be started automatically on startup. Default: true */ - private boolean autoStartup = DEFAULT_AUTO_STARTUP; + private boolean autoStartup = true; /** * Role for which leadership this candidate will compete. @@ -63,31 +49,31 @@ public class LeaderProperties { /** * Kubernetes ConfigMap where leaders information will be stored. Default: leaders */ - private String configMapName = DEFAULT_CONFIG_MAP_NAME; + private String configMapName = "leaders"; /** * Leader id property prefix for the ConfigMap. Default: leader.id. */ - private String leaderIdPrefix = DEFAULT_LEADER_ID_PREFIX; + private String leaderIdPrefix = "leader.id."; /** * Leadership status check period. Default: 60s */ - private Duration updatePeriod = DEFAULT_UPDATE_PERIOD; + private Duration updatePeriod = Duration.ofMillis(60000); /** * Enable/disable publishing events in case leadership acquisition fails. Default: * false */ - private boolean publishFailedEvents = DEFAULT_PUBLISH_FAILED_EVENTS; + private boolean publishFailedEvents = false; /** * Enable/disable creating ConfigMap if it does not exist. Default: true */ - private boolean createConfigMap = DEFAULT_CREATE_CONFIG_MAP; + private boolean createConfigMap = true; public boolean isEnabled() { - return this.enabled; + return enabled; } public void setEnabled(boolean enabled) { @@ -95,7 +81,7 @@ public void setEnabled(boolean enabled) { } public boolean isAutoStartup() { - return this.autoStartup; + return autoStartup; } public void setAutoStartup(boolean autoStartup) { @@ -103,7 +89,7 @@ public void setAutoStartup(boolean autoStartup) { } public String getRole() { - return this.role; + return role; } public void setRole(String role) { @@ -111,7 +97,7 @@ public void setRole(String role) { } public String getNamespace() { - return this.namespace; + return namespace; } public void setNamespace(String namespace) { @@ -119,15 +105,15 @@ public void setNamespace(String namespace) { } public String getNamespace(String defaultValue) { - if (this.namespace == null || this.namespace.isEmpty()) { + if (namespace == null || namespace.isEmpty()) { return defaultValue; } - return this.namespace; + return namespace; } public String getConfigMapName() { - return this.configMapName; + return configMapName; } public void setConfigMapName(String configMapName) { @@ -135,7 +121,7 @@ public void setConfigMapName(String configMapName) { } public String getLeaderIdPrefix() { - return this.leaderIdPrefix; + return leaderIdPrefix; } public void setLeaderIdPrefix(String leaderIdPrefix) { @@ -143,7 +129,7 @@ public void setLeaderIdPrefix(String leaderIdPrefix) { } public Duration getUpdatePeriod() { - return this.updatePeriod; + return updatePeriod; } public void setUpdatePeriod(Duration updatePeriod) { @@ -151,7 +137,7 @@ public void setUpdatePeriod(Duration updatePeriod) { } public boolean isPublishFailedEvents() { - return this.publishFailedEvents; + return publishFailedEvents; } public void setPublishFailedEvents(boolean publishFailedEvents) { @@ -159,7 +145,7 @@ public void setPublishFailedEvents(boolean publishFailedEvents) { } public boolean isCreateConfigMap() { - return this.createConfigMap; + return createConfigMap; } public void setCreateConfigMap(boolean createConfigMap) { diff --git a/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/leader/LeaderUtils.java b/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/leader/LeaderUtils.java new file mode 100644 index 0000000000..dda9752899 --- /dev/null +++ b/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/leader/LeaderUtils.java @@ -0,0 +1,47 @@ +/* + * Copyright 2013-2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.cloud.kubernetes.commons.leader; + +import java.net.InetAddress; +import java.net.UnknownHostException; + +import org.springframework.cloud.kubernetes.commons.EnvReader; +import org.springframework.util.StringUtils; + +/** + * @author wind57 + */ +public final class LeaderUtils { + + // k8s environment variable responsible for host name + private static final String HOSTNAME = "HOSTNAME"; + + private LeaderUtils() { + + } + + public static String hostName() throws UnknownHostException { + String hostName = EnvReader.getEnv(HOSTNAME); + if (StringUtils.hasText(hostName)) { + return hostName; + } + else { + return InetAddress.getLocalHost().getHostName(); + } + } + +} diff --git a/spring-cloud-kubernetes-commons/src/test/java/org/springframework/cloud/kubernetes/commons/leader/LeaderUtilsTests.java b/spring-cloud-kubernetes-commons/src/test/java/org/springframework/cloud/kubernetes/commons/leader/LeaderUtilsTests.java new file mode 100644 index 0000000000..6fbfcbc206 --- /dev/null +++ b/spring-cloud-kubernetes-commons/src/test/java/org/springframework/cloud/kubernetes/commons/leader/LeaderUtilsTests.java @@ -0,0 +1,65 @@ +/* + * Copyright 2013-2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.cloud.kubernetes.commons.leader; + +import java.net.InetAddress; +import java.net.UnknownHostException; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.MockedStatic; +import org.mockito.Mockito; + +import org.springframework.cloud.kubernetes.commons.EnvReader; + +/** + * @author wind57 + */ +class LeaderUtilsTests { + + @Test + void hostNameReadFromEnvProperty() throws UnknownHostException { + + MockedStatic envReaderMockedStatic = Mockito.mockStatic(EnvReader.class); + envReaderMockedStatic.when(() -> EnvReader.getEnv("HOSTNAME")).thenReturn("from-env"); + + String hostname = LeaderUtils.hostName(); + Assertions.assertEquals("from-env", hostname); + + envReaderMockedStatic.close(); + + } + + @Test + void hostNameReadFromApiCall() throws UnknownHostException { + + MockedStatic envReaderMockedStatic = Mockito.mockStatic(EnvReader.class); + envReaderMockedStatic.when(() -> EnvReader.getEnv("HOSTNAME")).thenReturn(""); + + MockedStatic inet4AddressMockedStatic = Mockito.mockStatic(InetAddress.class); + InetAddress inetAddress = Mockito.mock(InetAddress.class); + Mockito.when(inetAddress.getHostName()).thenReturn("from-api-call"); + inet4AddressMockedStatic.when(InetAddress::getLocalHost).thenReturn(inetAddress); + + String hostname = LeaderUtils.hostName(); + Assertions.assertEquals("from-api-call", hostname); + + envReaderMockedStatic.close(); + inet4AddressMockedStatic.close(); + } + +} diff --git a/spring-cloud-kubernetes-fabric8-leader/src/main/java/org/springframework/cloud/kubernetes/fabric8/leader/Fabric8LeaderAutoConfiguration.java b/spring-cloud-kubernetes-fabric8-leader/src/main/java/org/springframework/cloud/kubernetes/fabric8/leader/Fabric8LeaderAutoConfiguration.java index 10de2f7552..7e58819167 100644 --- a/spring-cloud-kubernetes-fabric8-leader/src/main/java/org/springframework/cloud/kubernetes/fabric8/leader/Fabric8LeaderAutoConfiguration.java +++ b/spring-cloud-kubernetes-fabric8-leader/src/main/java/org/springframework/cloud/kubernetes/fabric8/leader/Fabric8LeaderAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2019 the original author or authors. + * Copyright 2013-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,6 @@ package org.springframework.cloud.kubernetes.fabric8.leader; -import java.net.Inet4Address; import java.net.UnknownHostException; import io.fabric8.kubernetes.client.KubernetesClient; @@ -30,6 +29,7 @@ import org.springframework.cloud.kubernetes.commons.leader.LeaderInfoContributor; import org.springframework.cloud.kubernetes.commons.leader.LeaderInitiator; import org.springframework.cloud.kubernetes.commons.leader.LeaderProperties; +import org.springframework.cloud.kubernetes.commons.leader.LeaderUtils; import org.springframework.context.ApplicationEventPublisher; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -55,7 +55,7 @@ public LeaderEventPublisher defaultLeaderEventPublisher(ApplicationEventPublishe @Bean public Candidate candidate(LeaderProperties leaderProperties) throws UnknownHostException { - String id = Inet4Address.getLocalHost().getHostName(); + String id = LeaderUtils.hostName(); String role = leaderProperties.getRole(); return new DefaultCandidate(id, role); diff --git a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-catalog-watcher/src/test/java/org/springframework/cloud/kubernetes/fabric8/catalog/watch/Fabric8CatalogWatchIT.java b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-catalog-watcher/src/test/java/org/springframework/cloud/kubernetes/fabric8/catalog/watch/Fabric8CatalogWatchIT.java index 92360824b9..bd82dfbb29 100644 --- a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-catalog-watcher/src/test/java/org/springframework/cloud/kubernetes/fabric8/catalog/watch/Fabric8CatalogWatchIT.java +++ b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-catalog-watcher/src/test/java/org/springframework/cloud/kubernetes/fabric8/catalog/watch/Fabric8CatalogWatchIT.java @@ -33,6 +33,7 @@ import org.springframework.cloud.kubernetes.commons.discovery.EndpointNameAndNamespace; import org.springframework.cloud.kubernetes.integration.tests.commons.Commons; +import org.springframework.cloud.kubernetes.integration.tests.commons.Images; import org.springframework.cloud.kubernetes.integration.tests.commons.Phase; import org.springframework.cloud.kubernetes.integration.tests.commons.fabric8_client.Util; import org.springframework.core.ParameterizedTypeReference; @@ -73,6 +74,8 @@ static void beforeAll() throws Exception { Commons.validateImage(IMAGE_NAME, K3S); Commons.loadSpringCloudKubernetesImage(IMAGE_NAME, K3S); + Images.loadBusybox(K3S); + util = new Util(K3S); util.createNamespace(NAMESPACE_A); diff --git a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-discovery/src/test/java/org/springframework/cloud/kubernetes/fabric8/client/discovery/Fabric8DiscoveryPodMetadataIT.java b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-discovery/src/test/java/org/springframework/cloud/kubernetes/fabric8/client/discovery/Fabric8DiscoveryPodMetadataIT.java index 242310ca01..9aba3e0821 100644 --- a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-discovery/src/test/java/org/springframework/cloud/kubernetes/fabric8/client/discovery/Fabric8DiscoveryPodMetadataIT.java +++ b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-discovery/src/test/java/org/springframework/cloud/kubernetes/fabric8/client/discovery/Fabric8DiscoveryPodMetadataIT.java @@ -42,6 +42,7 @@ import org.springframework.cloud.kubernetes.commons.discovery.DefaultKubernetesServiceInstance; import org.springframework.cloud.kubernetes.integration.tests.commons.Commons; +import org.springframework.cloud.kubernetes.integration.tests.commons.Images; import org.springframework.cloud.kubernetes.integration.tests.commons.Phase; import org.springframework.cloud.kubernetes.integration.tests.commons.fabric8_client.Util; import org.springframework.core.ParameterizedTypeReference; @@ -92,6 +93,9 @@ static void beforeAll() throws Exception { Commons.validateImage(IMAGE_NAME, K3S); Commons.loadSpringCloudKubernetesImage(IMAGE_NAME, K3S); + Images.loadBusybox(K3S); + Images.loadWiremock(K3S); + util = new Util(K3S); client = util.client(); diff --git a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-istio/src/test/java/org/springframework/cloud/kubernetes/fabric8/client/istio/Fabric8IstioIT.java b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-istio/src/test/java/org/springframework/cloud/kubernetes/fabric8/client/istio/Fabric8IstioIT.java index 5411874e9f..5cd75c50cb 100644 --- a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-istio/src/test/java/org/springframework/cloud/kubernetes/fabric8/client/istio/Fabric8IstioIT.java +++ b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-istio/src/test/java/org/springframework/cloud/kubernetes/fabric8/client/istio/Fabric8IstioIT.java @@ -35,6 +35,7 @@ import reactor.util.retry.RetryBackoffSpec; import org.springframework.cloud.kubernetes.integration.tests.commons.Commons; +import org.springframework.cloud.kubernetes.integration.tests.commons.Images; import org.springframework.cloud.kubernetes.integration.tests.commons.Phase; import org.springframework.cloud.kubernetes.integration.tests.commons.fabric8_client.Util; import org.springframework.http.HttpMethod; @@ -52,10 +53,6 @@ class Fabric8IstioIT { private static final String IMAGE_NAME = "spring-cloud-kubernetes-fabric8-client-istio"; - private static final String ISTIO_PROXY = "istio/proxyv2"; - - private static final String ISTIO_PILOT = "istio/pilot"; - private static Util util; private static K3sContainer K3S; @@ -68,21 +65,25 @@ static void beforeAll() throws Exception { Commons.validateImage(IMAGE_NAME, K3S); Commons.loadSpringCloudKubernetesImage(IMAGE_NAME, K3S); - Commons.pullImage(ISTIO_PROXY, Commons.ISTIO_VERSION, K3S); - Commons.loadImage(ISTIO_PROXY, Commons.ISTIO_VERSION, "istioproxy", K3S); - Commons.pullImage(ISTIO_PILOT, Commons.ISTIO_VERSION, K3S); - Commons.loadImage(ISTIO_PILOT, Commons.ISTIO_VERSION, "istiopilot", K3S); + Images.loadIstioctl(K3S); processExecResult(K3S.execInContainer("sh", "-c", "kubectl create namespace istio-test")); processExecResult( K3S.execInContainer("sh", "-c", "kubectl label namespace istio-test istio-injection=enabled")); + util.setUpIstioctl(NAMESPACE, Phase.CREATE); + + String istioctlPodName = istioctlPodName(); + K3S.execInContainer("sh", "-c", + "kubectl cp istio-test/" + istioctlPodName + ":/usr/local/bin/istioctl /tmp/istioctl"); + K3S.execInContainer("sh", "-c", "chmod +x /tmp/istioctl"); + processExecResult(K3S.execInContainer("sh", "-c", "/tmp/istioctl" + " --kubeconfig=/etc/rancher/k3s/k3s.yaml install --set profile=minimal -y")); util.setUpIstio(NAMESPACE); - manifests(Phase.CREATE); + appManifests(Phase.CREATE); } @AfterAll @@ -94,7 +95,8 @@ static void afterAll() throws Exception { @AfterAll static void after() { - manifests(Phase.DELETE); + appManifests(Phase.DELETE); + util.setUpIstioctl(NAMESPACE, Phase.DELETE); } @Test @@ -109,13 +111,14 @@ void test() { Assertions.assertTrue(result.contains("istio")); } - private static void manifests(Phase phase) { + private static void appManifests(Phase phase) { InputStream deploymentStream = util.inputStream("istio-deployment.yaml"); InputStream serviceStream = util.inputStream("istio-service.yaml"); InputStream ingressStream = util.inputStream("istio-ingress.yaml"); Deployment deployment = Serialization.unmarshal(deploymentStream, Deployment.class); + Service service = Serialization.unmarshal(serviceStream, Service.class); Ingress ingress = Serialization.unmarshal(ingressStream, Ingress.class); @@ -136,4 +139,16 @@ private RetryBackoffSpec retrySpec() { return Retry.fixedDelay(15, Duration.ofSeconds(1)).filter(Objects::nonNull); } + private static String istioctlPodName() { + try { + return K3S + .execInContainer("sh", "-c", + "kubectl get pods -n istio-test -l app=istio-ctl -o=name --no-headers | tr -d '\n'") + .getStdout().split("/")[1]; + } + catch (Exception e) { + throw new RuntimeException(e); + } + } + } diff --git a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-catalog-watcher/src/test/java/org/springframework/cloud/kubernetes/k8s/client/catalog/watcher/KubernetesClientCatalogWatchIT.java b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-catalog-watcher/src/test/java/org/springframework/cloud/kubernetes/k8s/client/catalog/watcher/KubernetesClientCatalogWatchIT.java index 2dd5769748..26e582ace1 100644 --- a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-catalog-watcher/src/test/java/org/springframework/cloud/kubernetes/k8s/client/catalog/watcher/KubernetesClientCatalogWatchIT.java +++ b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-catalog-watcher/src/test/java/org/springframework/cloud/kubernetes/k8s/client/catalog/watcher/KubernetesClientCatalogWatchIT.java @@ -39,6 +39,7 @@ import org.springframework.cloud.kubernetes.commons.discovery.EndpointNameAndNamespace; import org.springframework.cloud.kubernetes.integration.tests.commons.Commons; +import org.springframework.cloud.kubernetes.integration.tests.commons.Images; import org.springframework.cloud.kubernetes.integration.tests.commons.Phase; import org.springframework.cloud.kubernetes.integration.tests.commons.native_client.Util; import org.springframework.core.ParameterizedTypeReference; @@ -75,6 +76,9 @@ static void beforeAll() throws Exception { K3S.start(); Commons.validateImage(APP_NAME, K3S); Commons.loadSpringCloudKubernetesImage(APP_NAME, K3S); + + Images.loadBusybox(K3S); + util = new Util(K3S); util.setUp(NAMESPACE); app(Phase.CREATE); diff --git a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-configuration-watcher/src/test/java/org/springframework/cloud/kubernetes/configuration/watcher/ActuatorRefreshIT.java b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-configuration-watcher/src/test/java/org/springframework/cloud/kubernetes/configuration/watcher/ActuatorRefreshIT.java index 38f0e15d12..4237ab13e8 100644 --- a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-configuration-watcher/src/test/java/org/springframework/cloud/kubernetes/configuration/watcher/ActuatorRefreshIT.java +++ b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-configuration-watcher/src/test/java/org/springframework/cloud/kubernetes/configuration/watcher/ActuatorRefreshIT.java @@ -34,6 +34,7 @@ import org.testcontainers.k3s.K3sContainer; import org.springframework.cloud.kubernetes.integration.tests.commons.Commons; +import org.springframework.cloud.kubernetes.integration.tests.commons.Images; import org.springframework.cloud.kubernetes.integration.tests.commons.Phase; import org.springframework.cloud.kubernetes.integration.tests.commons.native_client.Util; @@ -66,6 +67,9 @@ static void beforeAll() throws Exception { K3S.start(); Commons.validateImage(SPRING_CLOUD_K8S_CONFIG_WATCHER_APP_NAME, K3S); Commons.loadSpringCloudKubernetesImage(SPRING_CLOUD_K8S_CONFIG_WATCHER_APP_NAME, K3S); + + Images.loadWiremock(K3S); + util = new Util(K3S); util.setUp(NAMESPACE); diff --git a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-discovery-server/src/test/java/org/springframework/cloud/kubernetes/discoveryclient/it/DiscoveryClientIT.java b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-discovery-server/src/test/java/org/springframework/cloud/kubernetes/discoveryclient/it/DiscoveryClientIT.java index be2e90a71d..b2987a8e7a 100644 --- a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-discovery-server/src/test/java/org/springframework/cloud/kubernetes/discoveryclient/it/DiscoveryClientIT.java +++ b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-discovery-server/src/test/java/org/springframework/cloud/kubernetes/discoveryclient/it/DiscoveryClientIT.java @@ -37,6 +37,7 @@ import org.springframework.boot.test.json.BasicJsonTester; import org.springframework.cloud.kubernetes.integration.tests.commons.Commons; +import org.springframework.cloud.kubernetes.integration.tests.commons.Images; import org.springframework.cloud.kubernetes.integration.tests.commons.Phase; import org.springframework.cloud.kubernetes.integration.tests.commons.native_client.Util; import org.springframework.http.HttpMethod; @@ -153,6 +154,8 @@ static void beforeAll() throws Exception { Commons.validateImage(SPRING_CLOUD_K8S_DISCOVERY_CLIENT_APP_NAME, K3S); Commons.loadSpringCloudKubernetesImage(SPRING_CLOUD_K8S_DISCOVERY_CLIENT_APP_NAME, K3S); + Images.loadWiremock(K3S); + util = new Util(K3S); rbacApi = new RbacAuthorizationV1Api(); util.setUp(NAMESPACE); diff --git a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-discovery/src/test/java/org/springframework/cloud/kubernetes/k8s/client/discovery/KubernetesClientDiscoveryClientIT.java b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-discovery/src/test/java/org/springframework/cloud/kubernetes/k8s/client/discovery/KubernetesClientDiscoveryClientIT.java index a844f47506..02c0bc7178 100644 --- a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-discovery/src/test/java/org/springframework/cloud/kubernetes/k8s/client/discovery/KubernetesClientDiscoveryClientIT.java +++ b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-discovery/src/test/java/org/springframework/cloud/kubernetes/k8s/client/discovery/KubernetesClientDiscoveryClientIT.java @@ -43,6 +43,7 @@ import org.springframework.cloud.client.ServiceInstance; import org.springframework.cloud.kubernetes.commons.discovery.DefaultKubernetesServiceInstance; import org.springframework.cloud.kubernetes.integration.tests.commons.Commons; +import org.springframework.cloud.kubernetes.integration.tests.commons.Images; import org.springframework.cloud.kubernetes.integration.tests.commons.Phase; import org.springframework.cloud.kubernetes.integration.tests.commons.native_client.Util; import org.springframework.core.ParameterizedTypeReference; @@ -80,6 +81,9 @@ static void beforeAll() throws Exception { Commons.validateImage(IMAGE_NAME, K3S); Commons.loadSpringCloudKubernetesImage(IMAGE_NAME, K3S); + Images.loadWiremock(K3S); + Images.loadBusybox(K3S); + util = new Util(K3S); util.setUp(NAMESPACE); manifests(Phase.CREATE); diff --git a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-discovery/src/test/java/org/springframework/cloud/kubernetes/k8s/client/discovery/KubernetesClientDiscoverySelectiveNamespacesIT.java b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-discovery/src/test/java/org/springframework/cloud/kubernetes/k8s/client/discovery/KubernetesClientDiscoverySelectiveNamespacesIT.java index a8e51d5c1c..43aeb1732b 100644 --- a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-discovery/src/test/java/org/springframework/cloud/kubernetes/k8s/client/discovery/KubernetesClientDiscoverySelectiveNamespacesIT.java +++ b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-discovery/src/test/java/org/springframework/cloud/kubernetes/k8s/client/discovery/KubernetesClientDiscoverySelectiveNamespacesIT.java @@ -42,6 +42,7 @@ import org.springframework.cloud.kubernetes.commons.discovery.DefaultKubernetesServiceInstance; import org.springframework.cloud.kubernetes.integration.tests.commons.Commons; +import org.springframework.cloud.kubernetes.integration.tests.commons.Images; import org.springframework.cloud.kubernetes.integration.tests.commons.Phase; import org.springframework.cloud.kubernetes.integration.tests.commons.native_client.Util; import org.springframework.core.ParameterizedTypeReference; @@ -79,6 +80,8 @@ static void beforeAll() throws Exception { Commons.validateImage(IMAGE_NAME, K3S); Commons.loadSpringCloudKubernetesImage(IMAGE_NAME, K3S); + Images.loadWiremock(K3S); + util = new Util(K3S); util.createNamespace(NAMESPACE_A); diff --git a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-kafka-configmap-reload-multiple-apps/kafka-configmap-test-app/src/test/java/org/springframework/cloud/kubernetes/configuration/watcher/multiple/apps/ConfigurationWatcherMultipleAppsIT.java b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-kafka-configmap-reload-multiple-apps/kafka-configmap-test-app/src/test/java/org/springframework/cloud/kubernetes/configuration/watcher/multiple/apps/ConfigurationWatcherMultipleAppsIT.java index 57c94a5b2b..5ffcf7f682 100644 --- a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-kafka-configmap-reload-multiple-apps/kafka-configmap-test-app/src/test/java/org/springframework/cloud/kubernetes/configuration/watcher/multiple/apps/ConfigurationWatcherMultipleAppsIT.java +++ b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-kafka-configmap-reload-multiple-apps/kafka-configmap-test-app/src/test/java/org/springframework/cloud/kubernetes/configuration/watcher/multiple/apps/ConfigurationWatcherMultipleAppsIT.java @@ -36,6 +36,7 @@ import reactor.util.retry.RetryBackoffSpec; import org.springframework.cloud.kubernetes.integration.tests.commons.Commons; +import org.springframework.cloud.kubernetes.integration.tests.commons.Images; import org.springframework.cloud.kubernetes.integration.tests.commons.Phase; import org.springframework.cloud.kubernetes.integration.tests.commons.native_client.Util; import org.springframework.http.HttpMethod; @@ -77,6 +78,8 @@ static void beforeAll() throws Exception { Commons.validateImage(CONFIG_WATCHER_APP_B_IMAGE, K3S); Commons.loadSpringCloudKubernetesImage(CONFIG_WATCHER_APP_B_IMAGE, K3S); + Images.loadKafka(K3S); + util = new Util(K3S); util.setUp(NAMESPACE); } diff --git a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-rabbitmq-secret-reload-multiple-apps/rabbitmq-secret-test-app/src/test/java/org/springframework/cloud/kubernetes/configuration/watcher/multiple/apps/ConfigurationWatcherMultipleAppIT.java b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-rabbitmq-secret-reload-multiple-apps/rabbitmq-secret-test-app/src/test/java/org/springframework/cloud/kubernetes/configuration/watcher/multiple/apps/ConfigurationWatcherMultipleAppIT.java index 6ebc617304..2f0429d12a 100644 --- a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-rabbitmq-secret-reload-multiple-apps/rabbitmq-secret-test-app/src/test/java/org/springframework/cloud/kubernetes/configuration/watcher/multiple/apps/ConfigurationWatcherMultipleAppIT.java +++ b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-rabbitmq-secret-reload-multiple-apps/rabbitmq-secret-test-app/src/test/java/org/springframework/cloud/kubernetes/configuration/watcher/multiple/apps/ConfigurationWatcherMultipleAppIT.java @@ -36,6 +36,7 @@ import reactor.util.retry.RetryBackoffSpec; import org.springframework.cloud.kubernetes.integration.tests.commons.Commons; +import org.springframework.cloud.kubernetes.integration.tests.commons.Images; import org.springframework.cloud.kubernetes.integration.tests.commons.Phase; import org.springframework.cloud.kubernetes.integration.tests.commons.native_client.Util; import org.springframework.http.HttpMethod; @@ -76,6 +77,8 @@ static void beforeAll() throws Exception { Commons.validateImage(CONFIG_WATCHER_APP_B_IMAGE, K3S); Commons.loadSpringCloudKubernetesImage(CONFIG_WATCHER_APP_B_IMAGE, K3S); + Images.loadRabbitmq(K3S); + util = new Util(K3S); util.setUp(NAMESPACE); } diff --git a/spring-cloud-kubernetes-test-support/src/main/java/org/springframework/cloud/kubernetes/integration/tests/commons/Commons.java b/spring-cloud-kubernetes-test-support/src/main/java/org/springframework/cloud/kubernetes/integration/tests/commons/Commons.java index 3b44f35c80..9cf7b0b27e 100644 --- a/spring-cloud-kubernetes-test-support/src/main/java/org/springframework/cloud/kubernetes/integration/tests/commons/Commons.java +++ b/spring-cloud-kubernetes-test-support/src/main/java/org/springframework/cloud/kubernetes/integration/tests/commons/Commons.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2022 the original author or authors. + * Copyright 2013-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,6 +26,7 @@ import java.time.Duration; import java.util.Arrays; import java.util.List; +import java.util.Optional; import java.util.concurrent.TimeUnit; import com.github.dockerjava.api.command.ListImagesCmd; @@ -38,7 +39,6 @@ import org.testcontainers.containers.Container; import org.testcontainers.k3s.K3sContainer; import org.testcontainers.utility.DockerImageName; -import org.testcontainers.utility.MountableFile; import org.springframework.core.io.ClassPathResource; import org.springframework.util.ReflectionUtils; @@ -58,11 +58,9 @@ public final class Commons { private static final Log LOG = LogFactory.getLog(Commons.class); /** - * istio version used in our integration tests. + * this path is generated by the pipeline of github actions. */ - public static final String ISTIO_VERSION = "1.16.0"; - - private static final String LOCAL_ISTIO_BIN_PATH = "istio-cli/istio-" + ISTIO_VERSION + "/bin"; + private static final String TMP_IMAGES = "/tmp/docker/images"; private Commons() { throw new AssertionError("No instance provided"); @@ -73,7 +71,7 @@ private Commons() { /** * Rancher version to use for test-containers. */ - public static final String RANCHER = "rancher/k3s:v1.25.4-k3s1"; + public static final String RANCHER = "rancher/k3s:v1.28.8-k3s1"; /** * Command to use when starting rancher. Without "server" option, traefik is not @@ -93,9 +91,7 @@ private Commons() { private static final K3sContainer CONTAINER = new FixedPortsK3sContainer(DockerImageName.parse(Commons.RANCHER)) .configureFixedPorts(EXPOSED_PORTS).withFileSystemBind(TEMP_FOLDER, TEMP_FOLDER) - .withCopyFileToContainer(MountableFile.forClasspathResource(LOCAL_ISTIO_BIN_PATH + "/istioctl", 0744), - "/tmp/istioctl") - .withCommand(Commons.RANCHER_COMMAND).withReuse(true); + .withFileSystemBind(TMP_IMAGES, TMP_IMAGES).withCommand(Commons.RANCHER_COMMAND).withReuse(true); public static K3sContainer container() { return CONTAINER; @@ -171,6 +167,56 @@ public static void loadImage(String image, String tag, String tarName, K3sContai } + /** + * either get the tar from '/tmp/docker/images', or pull the image. + */ + public static void load(K3sContainer container, String tarName, String imageNameForDownload, String imageVersion) { + File dockerImagesRootDir = Paths.get(Commons.TMP_IMAGES).toFile(); + if (dockerImagesRootDir.exists() && dockerImagesRootDir.isDirectory()) { + File[] tars = dockerImagesRootDir.listFiles(); + if (tars != null && tars.length > 0) { + Optional found = Arrays.stream(tars).map(File::getName).filter(x -> x.contains(tarName)) + .findFirst(); + if (found.isPresent()) { + LOG.info("running in github actions, will load from : " + Commons.TMP_IMAGES + " tar : " + + found.get()); + Commons.loadImageFromPath(found.get(), container); + return; + } + else { + LOG.info(tarName + " not found, resorting to pulling the image"); + } + } + else { + LOG.info("no tars found, will resort to pulling the image"); + } + } + else { + LOG.info("running outside github actions"); + } + + try { + LOG.info("no tars found, will resort to pulling the image"); + LOG.info("using : " + imageVersion + " for : " + imageNameForDownload); + Commons.pullImage(imageNameForDownload, imageVersion, container); + Commons.loadImage(imageNameForDownload, imageVersion, tarName, container); + } + catch (Exception e) { + throw new RuntimeException(e); + } + } + + private static void loadImageFromPath(String tarName, K3sContainer container) { + await().atMost(Duration.ofMinutes(2)).pollInterval(Duration.ofSeconds(1)).until(() -> { + Container.ExecResult result = container.execInContainer("ctr", "i", "import", TMP_IMAGES + "/" + tarName); + boolean noErrors = result.getStderr() == null || result.getStderr().isEmpty(); + if (!noErrors) { + LOG.info("error is : " + result.getStderr()); + } + return noErrors; + }); + } + public static void cleanUp(String image, K3sContainer container) throws Exception { container.execInContainer("crictl", "rmi", "docker.io/springcloud/" + image + ":" + pomVersion()); container.execInContainer("rm", TEMP_FOLDER + "/" + image + ".tar"); diff --git a/spring-cloud-kubernetes-test-support/src/main/java/org/springframework/cloud/kubernetes/integration/tests/commons/Images.java b/spring-cloud-kubernetes-test-support/src/main/java/org/springframework/cloud/kubernetes/integration/tests/commons/Images.java new file mode 100644 index 0000000000..06a82370e4 --- /dev/null +++ b/spring-cloud-kubernetes-test-support/src/main/java/org/springframework/cloud/kubernetes/integration/tests/commons/Images.java @@ -0,0 +1,101 @@ +/* + * Copyright 2013-2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.cloud.kubernetes.integration.tests.commons; + +import java.io.BufferedReader; +import java.io.InputStreamReader; + +import org.testcontainers.k3s.K3sContainer; + +/** + * @author wind57 + */ +public final class Images { + + private static final String BUSYBOX = "busybox"; + + private static final String BUSYBOX_TAR = BUSYBOX + ":" + busyboxVersion(); + + private static final String WIREMOCK = "wiremock/wiremock"; + + private static final String WIREMOCK_TAR = WIREMOCK.replace('/', '-') + ":" + wiremockVersion(); + + private static final String ISTIOCTL = "istio/istioctl"; + + private static final String ISTIOCTL_TAR = ISTIOCTL.replace('/', '-') + ":" + istioctlVersion(); + + private static final String KAFKA = "confluentinc/cp-kafka"; + + private static final String KAFKA_TAR = KAFKA.replace('/', '-') + kafkaVersion(); + + private static final String RABBITMQ = "rabbitmq"; + + private static final String RABBITMQ_TAR = "rabbitmq"; + + private Images() { + + } + + public static String busyboxVersion() { + return imageVersion(BUSYBOX); + } + + public static String istioctlVersion() { + return imageVersion(ISTIOCTL); + } + + public static String kafkaVersion() { + return imageVersion(KAFKA); + } + + public static String rabbitMqVersion() { + return imageVersion(RABBITMQ); + } + + public static String wiremockVersion() { + return imageVersion(WIREMOCK); + } + + public static void loadBusybox(K3sContainer container) { + Commons.load(container, BUSYBOX_TAR, BUSYBOX, busyboxVersion()); + } + + public static void loadWiremock(K3sContainer container) { + Commons.load(container, WIREMOCK_TAR, WIREMOCK, wiremockVersion()); + } + + public static void loadIstioctl(K3sContainer container) { + Commons.load(container, ISTIOCTL_TAR, ISTIOCTL, istioctlVersion()); + } + + public static void loadKafka(K3sContainer container) { + Commons.load(container, KAFKA_TAR, KAFKA, kafkaVersion()); + } + + public static void loadRabbitmq(K3sContainer container) { + Commons.load(container, RABBITMQ_TAR, RABBITMQ, rabbitMqVersion()); + } + + // find the image version from current-images.txt + private static String imageVersion(String imageNameForDownload) { + BufferedReader reader = new BufferedReader( + new InputStreamReader(Commons.class.getClassLoader().getResourceAsStream("current-images.txt"))); + return reader.lines().filter(line -> line.contains(imageNameForDownload)).map(line -> line.split(":")[1]) + .findFirst().orElseThrow(); + } + +} diff --git a/spring-cloud-kubernetes-test-support/src/main/java/org/springframework/cloud/kubernetes/integration/tests/commons/fabric8_client/Util.java b/spring-cloud-kubernetes-test-support/src/main/java/org/springframework/cloud/kubernetes/integration/tests/commons/fabric8_client/Util.java index 738870119a..fe01d5312d 100644 --- a/spring-cloud-kubernetes-test-support/src/main/java/org/springframework/cloud/kubernetes/integration/tests/commons/fabric8_client/Util.java +++ b/spring-cloud-kubernetes-test-support/src/main/java/org/springframework/cloud/kubernetes/integration/tests/commons/fabric8_client/Util.java @@ -42,11 +42,13 @@ import io.fabric8.kubernetes.client.KubernetesClientBuilder; import io.fabric8.kubernetes.client.dsl.base.PatchContext; import io.fabric8.kubernetes.client.dsl.base.PatchType; +import io.fabric8.kubernetes.client.utils.Serialization; import jakarta.annotation.Nullable; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.testcontainers.k3s.K3sContainer; +import org.springframework.cloud.kubernetes.integration.tests.commons.Images; import org.springframework.cloud.kubernetes.integration.tests.commons.Phase; import static org.awaitility.Awaitility.await; @@ -62,6 +64,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; @@ -79,7 +84,7 @@ public Util(K3sContainer container) { * tight as possible, providing reasonable defaults. * */ - public void createAndWait(String namespace, String name, @Nullable Deployment deployment, Service service, + public void createAndWait(String namespace, String name, @Nullable Deployment deployment, @Nullable Service service, @Nullable Ingress ingress, boolean changeVersion) { try { @@ -100,7 +105,9 @@ public void createAndWait(String namespace, String name, @Nullable Deployment de waitForDeployment(namespace, deployment); } - client.services().inNamespace(namespace).resource(service).create(); + if (service != null) { + client.services().inNamespace(namespace).resource(service).create(); + } if (ingress != null) { client.network().v1().ingresses().inNamespace(namespace).resource(ingress).create(); @@ -116,6 +123,12 @@ public void busybox(String namespace, Phase phase) { InputStream deploymentStream = inputStream("busybox/deployment.yaml"); InputStream serviceStream = inputStream("busybox/service.yaml"); Deployment deployment = client.apps().deployments().load(deploymentStream).item(); + + String busyboxVersion = Images.busyboxVersion(); + String imageWithoutVersion = deployment.getSpec().getTemplate().getSpec().getContainers().get(0).getImage(); + String imageWithVersion = imageWithoutVersion + ":" + busyboxVersion; + deployment.getSpec().getTemplate().getSpec().getContainers().get(0).setImage(imageWithVersion); + Service service = client.services().load(serviceStream).item(); if (phase.equals(Phase.CREATE)) { @@ -248,6 +261,23 @@ public void setUpIstio(String namespace) { innerSetup(namespace, serviceAccountAsStream, roleBindingAsStream, roleAsStream); } + public void setUpIstioctl(String namespace, Phase phase) { + InputStream istioctlDeploymentStream = inputStream("istio/istioctl-deployment.yaml"); + Deployment istioctlDeployment = Serialization.unmarshal(istioctlDeploymentStream, Deployment.class); + + String imageWithoutVersion = istioctlDeployment.getSpec().getTemplate().getSpec().getContainers().get(0) + .getImage(); + String imageWithVersion = imageWithoutVersion + ":" + Images.istioctlVersion(); + istioctlDeployment.getSpec().getTemplate().getSpec().getContainers().get(0).setImage(imageWithVersion); + + if (phase.equals(Phase.CREATE)) { + createAndWait(namespace, null, istioctlDeployment, null, null, false); + } + else { + deleteAndWait(namespace, istioctlDeployment, null, null); + } + } + private void waitForConfigMap(String namespace, ConfigMap configMap, Phase phase) { String configMapName = configMapName(configMap); await().pollInterval(Duration.ofSeconds(1)).atMost(600, TimeUnit.SECONDS).until(() -> { @@ -270,6 +300,10 @@ public void wiremock(String namespace, String path, Phase phase, boolean withIng InputStream ingressStream = inputStream("wiremock/wiremock-ingress.yaml"); Deployment deployment = client.apps().deployments().load(deploymentStream).item(); + String imageWithoutVersion = deployment.getSpec().getTemplate().getSpec().getContainers().get(0).getImage(); + String imageWithVersion = imageWithoutVersion + ":" + Images.wiremockVersion(); + deployment.getSpec().getTemplate().getSpec().getContainers().get(0).setImage(imageWithVersion); + Service service = client.services().load(serviceStream).item(); Ingress ingress = null; diff --git a/spring-cloud-kubernetes-test-support/src/main/java/org/springframework/cloud/kubernetes/integration/tests/commons/native_client/Util.java b/spring-cloud-kubernetes-test-support/src/main/java/org/springframework/cloud/kubernetes/integration/tests/commons/native_client/Util.java index 6dd5c90046..2d225082d3 100644 --- a/spring-cloud-kubernetes-test-support/src/main/java/org/springframework/cloud/kubernetes/integration/tests/commons/native_client/Util.java +++ b/spring-cloud-kubernetes-test-support/src/main/java/org/springframework/cloud/kubernetes/integration/tests/commons/native_client/Util.java @@ -60,6 +60,7 @@ import org.apache.commons.logging.LogFactory; import org.testcontainers.k3s.K3sContainer; +import org.springframework.cloud.kubernetes.integration.tests.commons.Images; import org.springframework.cloud.kubernetes.integration.tests.commons.Phase; import static org.awaitility.Awaitility.await; @@ -233,6 +234,11 @@ public void deleteAndWait(String namespace, V1Deployment deployment, V1Service s public void busybox(String namespace, Phase phase) { V1Deployment deployment = (V1Deployment) yaml("busybox/deployment.yaml"); + + String imageWithoutVersion = deployment.getSpec().getTemplate().getSpec().getContainers().get(0).getImage(); + String imageWithVersion = imageWithoutVersion + ":" + Images.busyboxVersion(); + deployment.getSpec().getTemplate().getSpec().getContainers().get(0).setImage(imageWithVersion); + V1Service service = (V1Service) yaml("busybox/service.yaml"); if (phase.equals(Phase.CREATE)) { createAndWait(namespace, "busybox", deployment, service, null, false); @@ -244,6 +250,11 @@ else if (phase.equals(Phase.DELETE)) { public void kafka(String namespace, Phase phase) { V1Deployment deployment = (V1Deployment) yaml("kafka/kafka-deployment.yaml"); + + String imageWithoutVersion = deployment.getSpec().getTemplate().getSpec().getContainers().get(0).getImage(); + String imageWithVersion = imageWithoutVersion + ":" + Images.kafkaVersion(); + deployment.getSpec().getTemplate().getSpec().getContainers().get(0).setImage(imageWithVersion); + V1Service service = (V1Service) yaml("kafka/kafka-service.yaml"); V1ConfigMap configMap = (V1ConfigMap) yaml("kafka/kafka-configmap-startup-script.yaml"); @@ -259,6 +270,11 @@ else if (phase.equals(Phase.DELETE)) { public void rabbitMq(String namespace, Phase phase) { V1Deployment deployment = (V1Deployment) yaml("rabbitmq/rabbitmq-deployment.yaml"); + + String imageWithoutVersion = deployment.getSpec().getTemplate().getSpec().getContainers().get(0).getImage(); + String imageWithVersion = imageWithoutVersion + ":" + Images.rabbitMqVersion(); + deployment.getSpec().getTemplate().getSpec().getContainers().get(0).setImage(imageWithVersion); + V1Service service = (V1Service) yaml("rabbitmq/rabbitmq-service.yaml"); if (phase.equals(Phase.CREATE)) { @@ -430,6 +446,11 @@ public void wiremock(String namespace, String path, Phase phase) { public void wiremock(String namespace, String path, Phase phase, boolean withIngress) { V1Deployment deployment = (V1Deployment) yaml("wiremock/wiremock-deployment.yaml"); + + String imageWithoutVersion = deployment.getSpec().getTemplate().getSpec().getContainers().get(0).getImage(); + String imageWithVersion = imageWithoutVersion + ":" + Images.wiremockVersion(); + deployment.getSpec().getTemplate().getSpec().getContainers().get(0).setImage(imageWithVersion); + V1Service service = (V1Service) yaml("wiremock/wiremock-service.yaml"); V1Ingress ingress = null; diff --git a/spring-cloud-kubernetes-test-support/src/main/resources/busybox/deployment.yaml b/spring-cloud-kubernetes-test-support/src/main/resources/busybox/deployment.yaml index 052a911e03..55405c2c57 100644 --- a/spring-cloud-kubernetes-test-support/src/main/resources/busybox/deployment.yaml +++ b/spring-cloud-kubernetes-test-support/src/main/resources/busybox/deployment.yaml @@ -17,6 +17,6 @@ spec: containers: - name: busybox # image: arm64/busybox:latest - image: busybox:1.35 + image: busybox command: ["/bin/sh"] args: ["-c", "sleep 100000"] diff --git a/spring-cloud-kubernetes-test-support/src/main/resources/current-images.txt b/spring-cloud-kubernetes-test-support/src/main/resources/current-images.txt new file mode 100644 index 0000000000..de0626cdf0 --- /dev/null +++ b/spring-cloud-kubernetes-test-support/src/main/resources/current-images.txt @@ -0,0 +1,5 @@ +busybox:1.36.1 +istio/istioctl:1.20.5 +confluentinc/cp-kafka:7.2.1 +rabbitmq:3-management +wiremock/wiremock:3.4.2 diff --git a/spring-cloud-kubernetes-test-support/src/main/resources/istio-cli/istio-1.16.0/bin/istioctl b/spring-cloud-kubernetes-test-support/src/main/resources/istio-cli/istio-1.16.0/bin/istioctl deleted file mode 100755 index 65494bd853..0000000000 Binary files a/spring-cloud-kubernetes-test-support/src/main/resources/istio-cli/istio-1.16.0/bin/istioctl and /dev/null differ diff --git a/spring-cloud-kubernetes-test-support/src/main/resources/istio/istioctl-deployment.yaml b/spring-cloud-kubernetes-test-support/src/main/resources/istio/istioctl-deployment.yaml new file mode 100644 index 0000000000..ed5667da94 --- /dev/null +++ b/spring-cloud-kubernetes-test-support/src/main/resources/istio/istioctl-deployment.yaml @@ -0,0 +1,21 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: istio-ctl + labels: + app: istio-ctl +spec: + selector: + matchLabels: + app: istio-ctl + template: + metadata: + labels: + app: istio-ctl + spec: + containers: + - name: istio-ctl + image: istio/istioctl + imagePullPolicy: IfNotPresent + command: [ "/bin/bash" ] + args: [ "-c", "trap : TERM INT; sleep infinity & wait" ] diff --git a/spring-cloud-kubernetes-test-support/src/main/resources/kafka/kafka-deployment.yaml b/spring-cloud-kubernetes-test-support/src/main/resources/kafka/kafka-deployment.yaml index f0870b68c4..8a8db71379 100644 --- a/spring-cloud-kubernetes-test-support/src/main/resources/kafka/kafka-deployment.yaml +++ b/spring-cloud-kubernetes-test-support/src/main/resources/kafka/kafka-deployment.yaml @@ -33,7 +33,7 @@ spec: mountPath: /tmp command: - /tmp/kafka_start.sh - image: confluentinc/cp-kafka:7.2.1 + image: confluentinc/cp-kafka ports: - containerPort: 9092 env: diff --git a/spring-cloud-kubernetes-test-support/src/main/resources/rabbitmq/rabbitmq-deployment.yaml b/spring-cloud-kubernetes-test-support/src/main/resources/rabbitmq/rabbitmq-deployment.yaml index 9f5e7cd97a..89f34d428a 100644 --- a/spring-cloud-kubernetes-test-support/src/main/resources/rabbitmq/rabbitmq-deployment.yaml +++ b/spring-cloud-kubernetes-test-support/src/main/resources/rabbitmq/rabbitmq-deployment.yaml @@ -18,7 +18,7 @@ spec: spec: containers: - name: taskqueue - image: rabbitmq:3-management + image: rabbitmq imagePullPolicy: IfNotPresent diff --git a/spring-cloud-kubernetes-test-support/src/main/resources/wiremock/wiremock-deployment.yaml b/spring-cloud-kubernetes-test-support/src/main/resources/wiremock/wiremock-deployment.yaml index b429648107..6ac4dd06bc 100644 --- a/spring-cloud-kubernetes-test-support/src/main/resources/wiremock/wiremock-deployment.yaml +++ b/spring-cloud-kubernetes-test-support/src/main/resources/wiremock/wiremock-deployment.yaml @@ -13,7 +13,7 @@ spec: spec: containers: - name: service-wiremock - image: wiremock/wiremock:3.4.2 + image: wiremock/wiremock args: ["--verbose"] imagePullPolicy: IfNotPresent readinessProbe: