Merge branch 'integration-test-remove-local-registry' of https://github.com/yue9944882/spring-cloud-kubernetes into yue9944882-integration-test-remove-local-registry
This commit is contained in:
@@ -14,16 +14,30 @@ KIND="${BIN_DIR}/kind"
|
||||
|
||||
ISTIOCTL="${BIN_DIR}/istio-1.6.2/bin/istioctl"
|
||||
|
||||
MVN_VERSION=$(mvn -q \
|
||||
-Dexec.executable=echo \
|
||||
-Dexec.args='${project.version}' \
|
||||
--non-recursive \
|
||||
exec:exec)
|
||||
|
||||
ALL_INTEGRATION_PROJECTS=(
|
||||
"spring-cloud-kubernetes-core-k8s-client-it"
|
||||
"spring-cloud-kubernetes-client-config-it"
|
||||
"spring-cloud-kubernetes-configuration-watcher-it"
|
||||
)
|
||||
INTEGRATION_PROJECTS=(${INTEGRATION_PROJECTS:-${ALL_INTEGRATION_PROJECTS[@]}})
|
||||
|
||||
DEFAULT_PULLING_IMAGES=(
|
||||
"docker.io/springcloud/spring-cloud-kubernetes-configuration-watcher:${MVN_VERSION}"
|
||||
)
|
||||
PULLING_IMAGES=(${PULLING_IMAGES:-${DEFAULT_PULLING_IMAGES[@]}})
|
||||
|
||||
CURRENT_DIR="$(pwd)"
|
||||
|
||||
# cleanup on exit (useful for running locally)
|
||||
cleanup() {
|
||||
"${KIND}" delete cluster || true
|
||||
rm -rf "${BIN_DIR}"
|
||||
|
||||
docker kill kind-registry
|
||||
docker rm kind-registry
|
||||
docker network rm kind
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
@@ -56,40 +70,6 @@ install_kind_release() {
|
||||
chmod +x "${KIND}"
|
||||
}
|
||||
|
||||
setup_registry() {
|
||||
set -o errexit
|
||||
|
||||
# create registry container unless it already exists
|
||||
reg_name='kind-registry'
|
||||
reg_port='5000'
|
||||
running="$(docker inspect -f '{{.State.Running}}' "${reg_name}" 2>/dev/null || true)"
|
||||
if [ "${running}" != 'true' ]; then
|
||||
docker run \
|
||||
-d --restart=always -p "${reg_port}:5000" --name "${reg_name}" \
|
||||
registry:2
|
||||
fi
|
||||
|
||||
# create a cluster with the local registry enabled in containerd
|
||||
cat <<EOF | "${KIND}" create cluster --config=-
|
||||
kind: Cluster
|
||||
apiVersion: kind.x-k8s.io/v1alpha4
|
||||
containerdConfigPatches:
|
||||
- |-
|
||||
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."localhost:${reg_port}"]
|
||||
endpoint = ["http://${reg_name}:${reg_port}"]
|
||||
EOF
|
||||
|
||||
# connect the registry to the cluster network
|
||||
docker network connect "kind" "${reg_name}"
|
||||
|
||||
# tell https://tilt.dev to use the registry
|
||||
# https://docs.tilt.dev/choosing_clusters.html#discovering-the-registry
|
||||
for node in $("${KIND}" get nodes); do
|
||||
kubectl annotate node "${node}" "kind.x-k8s.io/registry=localhost:${reg_port}";
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
main() {
|
||||
# get kind
|
||||
install_latest_kind
|
||||
@@ -97,33 +77,8 @@ main() {
|
||||
# create a cluster
|
||||
cd $CURRENT_DIR
|
||||
|
||||
# create registry container unless it already exists
|
||||
reg_name='kind-registry'
|
||||
reg_port='5000'
|
||||
running="$(docker inspect -f '{{.State.Running}}' "${reg_name}" 2>/dev/null || true)"
|
||||
if [ "${running}" != 'true' ]; then
|
||||
# If the container is not running but has exited remove it before trying to start it
|
||||
if [ "$(docker ps -aq -f status=exited -f name=${reg_name})" ]; then
|
||||
# cleanup
|
||||
docker rm "${reg_name}"
|
||||
fi
|
||||
|
||||
docker run \
|
||||
-d --restart=always -p "${reg_port}:5000" --name "${reg_name}" \
|
||||
registry:2
|
||||
fi
|
||||
|
||||
#TODO what happens if cluster is already there????
|
||||
"${KIND}" create cluster --config kind-config.yaml --loglevel=debug
|
||||
|
||||
# connect the registry to the cluster network
|
||||
docker network connect "kind" "${reg_name}"
|
||||
|
||||
# tell https://tilt.dev to use the registry
|
||||
# https://docs.tilt.dev/choosing_clusters.html#discovering-the-registry
|
||||
for node in $("${KIND}" get nodes); do
|
||||
kubectl annotate node "${node}" "kind.x-k8s.io/registry=localhost:${reg_port}";
|
||||
done
|
||||
"${KIND}" create cluster --config=kind-config.yaml --loglevel=debug
|
||||
|
||||
# set KUBECONFIG to point to the cluster
|
||||
kubectl cluster-info --context kind-kind
|
||||
@@ -131,26 +86,36 @@ main() {
|
||||
#setup nginx ingress
|
||||
# kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/provider/kind/deploy.yaml
|
||||
kubectl apply -fhttps://raw.githubusercontent.com/kubernetes/ingress-nginx/12150e318b972a03fb49d827e6cabb8ef62247ef/deploy/static/provider/kind/deploy.yaml
|
||||
sleep 5 # hold 5 sec so that the pods can be created
|
||||
kubectl wait --namespace ingress-nginx --for=condition=ready pod --selector=app.kubernetes.io/component=controller --timeout=360s
|
||||
|
||||
# This creates the service account, role, and role binding necessary for Spring Cloud k8s apps
|
||||
kubectl apply -f ./permissions.yaml
|
||||
|
||||
# cd ${BIN_DIR}
|
||||
# curl -L https://istio.io/downloadIstio | sh -
|
||||
# cd ${BIN_DIR}
|
||||
# curl -L https://istio.io/downloadIstio | sh -
|
||||
#"${ISTIOCTL}" install --set profile=demo
|
||||
|
||||
cd $CURRENT_DIR
|
||||
|
||||
# TODO: invoke your tests here
|
||||
cd spring-cloud-kubernetes-core-k8s-client-it
|
||||
../../mvnw clean install -P it
|
||||
cd ../
|
||||
cd spring-cloud-kubernetes-client-config-it
|
||||
../../mvnw clean install -P it
|
||||
cd ../
|
||||
cd spring-cloud-kubernetes-configuration-watcher-it
|
||||
../../mvnw clean install -P it
|
||||
# pulling necessary images for setting up the integration test environment
|
||||
for i in "${PULLING_IMAGES[@]}"; do
|
||||
echo "Pull images for prepping testing environment: $i"
|
||||
docker pull $i
|
||||
"${KIND}" load docker-image $i
|
||||
done
|
||||
|
||||
# running tests..
|
||||
for p in "${INTEGRATION_PROJECTS[@]}"; do
|
||||
echo "Running test: $p"
|
||||
cd $p
|
||||
../../mvnw spring-boot:build-image \
|
||||
-Dspring-boot.build-image.imageName=docker.io/springcloud/$p:${MVN_VERSION}
|
||||
"${KIND}" load docker-image docker.io/springcloud/$p:${MVN_VERSION}
|
||||
../../mvnw clean install -P it
|
||||
cd ..
|
||||
done
|
||||
|
||||
# teardown will happen automatically on exit
|
||||
}
|
||||
|
||||
|
||||
@@ -63,28 +63,4 @@
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<image>
|
||||
<name>${env.IMAGE}</name>
|
||||
</image>
|
||||
<goal>build-image</goal>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>build-image</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
</project>
|
||||
|
||||
@@ -20,12 +20,6 @@ import java.io.IOException;
|
||||
import java.time.Duration;
|
||||
import java.util.Map;
|
||||
|
||||
import com.github.dockerjava.api.DockerClient;
|
||||
import com.github.dockerjava.core.DefaultDockerClientConfig;
|
||||
import com.github.dockerjava.core.DockerClientConfig;
|
||||
import com.github.dockerjava.core.DockerClientImpl;
|
||||
import com.github.dockerjava.httpclient5.ApacheDockerHttpClient;
|
||||
import com.github.dockerjava.transport.DockerHttpClient;
|
||||
import io.kubernetes.client.openapi.ApiClient;
|
||||
import io.kubernetes.client.openapi.Configuration;
|
||||
import io.kubernetes.client.openapi.apis.AppsV1Api;
|
||||
@@ -108,15 +102,6 @@ public class ConfigMapAndSecretIT {
|
||||
appsApi = new AppsV1Api();
|
||||
networkingApi = new NetworkingV1beta1Api();
|
||||
k8SUtils = new K8SUtils(api, appsApi);
|
||||
|
||||
DockerClientConfig config = DefaultDockerClientConfig.createDefaultConfigBuilder()
|
||||
.withRegistryUrl(KIND_REPO_URL).build();
|
||||
DockerHttpClient httpClient = new ApacheDockerHttpClient.Builder().dockerHost(config.getDockerHost())
|
||||
.sslConfig(config.getSSLConfig()).build();
|
||||
|
||||
DockerClient dockerClient = DockerClientImpl.getInstance(config, httpClient);
|
||||
dockerClient.tagImageCmd(LOCAL_IMAGE, KIND_IMAGE, IMAGE_TAG).exec();
|
||||
dockerClient.pushImageCmd(KIND_IMAGE_WITH_TAG).start();
|
||||
}
|
||||
|
||||
@After
|
||||
|
||||
@@ -14,7 +14,7 @@ spec:
|
||||
serviceAccountName: spring-cloud-kubernetes-serviceaccount
|
||||
containers:
|
||||
- name: spring-cloud-kubernetes-client-config-it
|
||||
image: localhost:5000/spring-cloud-kubernetes-client-config-it:2.0.0-SNAPSHOT
|
||||
image: docker.io/springcloud/spring-cloud-kubernetes-client-config-it:2.0.0-SNAPSHOT
|
||||
imagePullPolicy: IfNotPresent
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
|
||||
@@ -14,7 +14,7 @@ spec:
|
||||
serviceAccountName: spring-cloud-kubernetes-serviceaccount
|
||||
containers:
|
||||
- name: spring-cloud-kubernetes-client-config-it
|
||||
image: localhost:5000/spring-cloud-kubernetes-client-config-it:2.0.0-SNAPSHOT
|
||||
image: docker.io/springcloud/spring-cloud-kubernetes-client-config-it:2.0.0-SNAPSHOT
|
||||
imagePullPolicy: IfNotPresent
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
|
||||
@@ -76,27 +76,4 @@
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<image>
|
||||
<name>springcloud/${project.artifactId}:${project.version}</name>
|
||||
</image>
|
||||
<goal>build-image</goal>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>build-image</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@@ -18,12 +18,6 @@ package org.springframework.cloud.kubernetes.configuration.watcher;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
import com.github.dockerjava.api.DockerClient;
|
||||
import com.github.dockerjava.core.DefaultDockerClientConfig;
|
||||
import com.github.dockerjava.core.DockerClientConfig;
|
||||
import com.github.dockerjava.core.DockerClientImpl;
|
||||
import com.github.dockerjava.httpclient5.ApacheDockerHttpClient;
|
||||
import com.github.dockerjava.transport.DockerHttpClient;
|
||||
import com.github.tomakehurst.wiremock.client.WireMock;
|
||||
import io.kubernetes.client.openapi.ApiClient;
|
||||
import io.kubernetes.client.openapi.Configuration;
|
||||
@@ -104,6 +98,7 @@ public class ActuatorRefreshIT {
|
||||
@Before
|
||||
public void setup() throws Exception {
|
||||
this.client = Config.defaultClient();
|
||||
this.client.setHttpClient(this.client.getHttpClient().newBuilder().readTimeout(Duration.ofSeconds(15)).build());
|
||||
// client.setDebugging(true);
|
||||
Configuration.setDefaultApiClient(client);
|
||||
this.api = new CoreV1Api();
|
||||
@@ -111,15 +106,6 @@ public class ActuatorRefreshIT {
|
||||
this.networkingApi = new NetworkingV1beta1Api();
|
||||
this.k8SUtils = new K8SUtils(api, appsApi);
|
||||
|
||||
DockerClientConfig config = DefaultDockerClientConfig.createDefaultConfigBuilder()
|
||||
.withRegistryUrl(KIND_REPO_URL).build();
|
||||
DockerHttpClient httpClient = new ApacheDockerHttpClient.Builder().dockerHost(config.getDockerHost())
|
||||
.sslConfig(config.getSSLConfig()).build();
|
||||
|
||||
DockerClient dockerClient = DockerClientImpl.getInstance(config, httpClient);
|
||||
dockerClient.tagImageCmd(LOCAL_IMAGE, KIND_IMAGE, IMAGE_TAG).exec();
|
||||
dockerClient.pushImageCmd(KIND_IMAGE_WITH_TAG).start();
|
||||
|
||||
deployWiremock();
|
||||
|
||||
// Check to make sure the wiremock deployment is ready
|
||||
|
||||
@@ -18,12 +18,6 @@ package org.springframework.cloud.kubernetes.configuration.watcher;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
import com.github.dockerjava.api.DockerClient;
|
||||
import com.github.dockerjava.core.DefaultDockerClientConfig;
|
||||
import com.github.dockerjava.core.DockerClientConfig;
|
||||
import com.github.dockerjava.core.DockerClientImpl;
|
||||
import com.github.dockerjava.httpclient5.ApacheDockerHttpClient;
|
||||
import com.github.dockerjava.transport.DockerHttpClient;
|
||||
import io.kubernetes.client.openapi.ApiClient;
|
||||
import io.kubernetes.client.openapi.Configuration;
|
||||
import io.kubernetes.client.openapi.apis.AppsV1Api;
|
||||
@@ -112,25 +106,14 @@ public class ActuatorRefreshKafkaIT {
|
||||
@Before
|
||||
public void setup() throws Exception {
|
||||
this.client = Config.defaultClient();
|
||||
client.setDebugging(true);
|
||||
// client.setDebugging(true);
|
||||
this.client.setHttpClient(this.client.getHttpClient().newBuilder().readTimeout(Duration.ofSeconds(15)).build());
|
||||
Configuration.setDefaultApiClient(client);
|
||||
this.api = new CoreV1Api();
|
||||
this.appsApi = new AppsV1Api();
|
||||
this.networkingApi = new NetworkingV1beta1Api();
|
||||
this.k8SUtils = new K8SUtils(api, appsApi);
|
||||
|
||||
DockerClientConfig config = DefaultDockerClientConfig.createDefaultConfigBuilder()
|
||||
.withRegistryUrl(KIND_REPO_URL).build();
|
||||
DockerHttpClient httpClient = new ApacheDockerHttpClient.Builder().dockerHost(config.getDockerHost())
|
||||
.sslConfig(config.getSSLConfig()).build();
|
||||
|
||||
DockerClient dockerClient = DockerClientImpl.getInstance(config, httpClient);
|
||||
dockerClient.tagImageCmd(CONFIG_WATCHER_LOCAL_IMAGE, CONFIG_WATCHER_KIND_IMAGE, IMAGE_TAG).exec();
|
||||
dockerClient.pushImageCmd(CONFIG_WATCHER_KIND_IMAGE_WITH_TAG).start();
|
||||
|
||||
dockerClient.tagImageCmd(CONFIG_WATCHER_IT_LOCAL_IMAGE, CONFIG_WATCHER_IT_KIND_IMAGE, IMAGE_TAG).exec();
|
||||
dockerClient.pushImageCmd(CONFIG_WATCHER_IT_KIND_IMAGE_WITH_TAG).start();
|
||||
|
||||
deployZookeeper();
|
||||
|
||||
k8SUtils.waitForDeployment(ZOOKEEPER_DEPLOYMENT, NAMESPACE);
|
||||
|
||||
@@ -18,12 +18,6 @@ package org.springframework.cloud.kubernetes.configuration.watcher;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
import com.github.dockerjava.api.DockerClient;
|
||||
import com.github.dockerjava.core.DefaultDockerClientConfig;
|
||||
import com.github.dockerjava.core.DockerClientConfig;
|
||||
import com.github.dockerjava.core.DockerClientImpl;
|
||||
import com.github.dockerjava.httpclient5.ApacheDockerHttpClient;
|
||||
import com.github.dockerjava.transport.DockerHttpClient;
|
||||
import io.kubernetes.client.openapi.ApiClient;
|
||||
import io.kubernetes.client.openapi.Configuration;
|
||||
import io.kubernetes.client.openapi.apis.AppsV1Api;
|
||||
@@ -107,6 +101,7 @@ public class ActuatorRefreshRabbitMQIT {
|
||||
@Before
|
||||
public void setup() throws Exception {
|
||||
this.client = Config.defaultClient();
|
||||
this.client.setHttpClient(this.client.getHttpClient().newBuilder().readTimeout(Duration.ofSeconds(15)).build());
|
||||
// client.setDebugging(true);
|
||||
Configuration.setDefaultApiClient(client);
|
||||
this.api = new CoreV1Api();
|
||||
@@ -114,18 +109,6 @@ public class ActuatorRefreshRabbitMQIT {
|
||||
this.networkingApi = new NetworkingV1beta1Api();
|
||||
this.k8SUtils = new K8SUtils(api, appsApi);
|
||||
|
||||
DockerClientConfig config = DefaultDockerClientConfig.createDefaultConfigBuilder()
|
||||
.withRegistryUrl(KIND_REPO_URL).build();
|
||||
DockerHttpClient httpClient = new ApacheDockerHttpClient.Builder().dockerHost(config.getDockerHost())
|
||||
.sslConfig(config.getSSLConfig()).build();
|
||||
|
||||
DockerClient dockerClient = DockerClientImpl.getInstance(config, httpClient);
|
||||
dockerClient.tagImageCmd(CONFIG_WATCHER_LOCAL_IMAGE, CONFIG_WATCHER_KIND_IMAGE, IMAGE_TAG).exec();
|
||||
dockerClient.pushImageCmd(CONFIG_WATCHER_KIND_IMAGE_WITH_TAG).start();
|
||||
|
||||
dockerClient.tagImageCmd(CONFIG_WATCHER_IT_LOCAL_IMAGE, CONFIG_WATCHER_IT_KIND_IMAGE, IMAGE_TAG).exec();
|
||||
dockerClient.pushImageCmd(CONFIG_WATCHER_IT_KIND_IMAGE_WITH_TAG).start();
|
||||
|
||||
deployRabbitMQ();
|
||||
|
||||
k8SUtils.waitForReplicationController(RABBIT_MQ_CONTROLLER_NAME, NAMESPACE);
|
||||
|
||||
@@ -14,7 +14,7 @@ spec:
|
||||
serviceAccountName: spring-cloud-kubernetes-serviceaccount
|
||||
containers:
|
||||
- name: spring-cloud-kubernetes-configuration-watcher
|
||||
image: localhost:5000/spring-cloud-kubernetes-configuration-watcher:2.0.0-SNAPSHOT
|
||||
image: docker.io/springcloud/spring-cloud-kubernetes-configuration-watcher:2.0.0-SNAPSHOT
|
||||
imagePullPolicy: IfNotPresent
|
||||
env:
|
||||
- name: SPRING_PROFILES_ACTIVE
|
||||
|
||||
@@ -14,7 +14,7 @@ spec:
|
||||
serviceAccountName: spring-cloud-kubernetes-serviceaccount
|
||||
containers:
|
||||
- name: spring-cloud-kubernetes-configuration-watcher
|
||||
image: localhost:5000/spring-cloud-kubernetes-configuration-watcher:2.0.0-SNAPSHOT
|
||||
image: docker.io/springcloud/spring-cloud-kubernetes-configuration-watcher:2.0.0-SNAPSHOT
|
||||
imagePullPolicy: IfNotPresent
|
||||
env:
|
||||
- name: SPRING_PROFILES_ACTIVE
|
||||
|
||||
@@ -14,7 +14,7 @@ spec:
|
||||
serviceAccountName: spring-cloud-kubernetes-serviceaccount
|
||||
containers:
|
||||
- name: spring-cloud-kubernetes-configuration-watcher
|
||||
image: localhost:5000/spring-cloud-kubernetes-configuration-watcher:2.0.0-SNAPSHOT
|
||||
image: docker.io/springcloud/spring-cloud-kubernetes-configuration-watcher:2.0.0-SNAPSHOT
|
||||
imagePullPolicy: IfNotPresent
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
|
||||
@@ -13,7 +13,7 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: spring-cloud-kubernetes-configuration-watcher-it
|
||||
image: localhost:5000/spring-cloud-kubernetes-configuration-watcher-it:2.0.0-SNAPSHOT
|
||||
image: docker.io/springcloud/spring-cloud-kubernetes-configuration-watcher-it:2.0.0-SNAPSHOT
|
||||
imagePullPolicy: IfNotPresent
|
||||
env:
|
||||
- name: SPRING_PROFILES_ACTIVE
|
||||
|
||||
@@ -13,7 +13,7 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: spring-cloud-kubernetes-configuration-watcher-it
|
||||
image: localhost:5000/spring-cloud-kubernetes-configuration-watcher-it:2.0.0-SNAPSHOT
|
||||
image: docker.io/springcloud/spring-cloud-kubernetes-configuration-watcher-it:2.0.0-SNAPSHOT
|
||||
imagePullPolicy: IfNotPresent
|
||||
env:
|
||||
- name: SPRING_PROFILES_ACTIVE
|
||||
|
||||
@@ -63,27 +63,4 @@
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<image>
|
||||
<name>${env.IMAGE}</name>
|
||||
</image>
|
||||
<goal>build-image</goal>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>build-image</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -20,12 +20,6 @@ import java.io.IOException;
|
||||
import java.time.Duration;
|
||||
import java.util.Map;
|
||||
|
||||
import com.github.dockerjava.api.DockerClient;
|
||||
import com.github.dockerjava.core.DefaultDockerClientConfig;
|
||||
import com.github.dockerjava.core.DockerClientConfig;
|
||||
import com.github.dockerjava.core.DockerClientImpl;
|
||||
import com.github.dockerjava.httpclient5.ApacheDockerHttpClient;
|
||||
import com.github.dockerjava.transport.DockerHttpClient;
|
||||
import io.kubernetes.client.openapi.ApiClient;
|
||||
import io.kubernetes.client.openapi.Configuration;
|
||||
import io.kubernetes.client.openapi.apis.AppsV1Api;
|
||||
@@ -104,15 +98,6 @@ public class ActuatorEndpointIT {
|
||||
networkingApi = new NetworkingV1beta1Api();
|
||||
k8SUtils = new K8SUtils(api, appsApi);
|
||||
|
||||
DockerClientConfig config = DefaultDockerClientConfig.createDefaultConfigBuilder()
|
||||
.withRegistryUrl(KIND_REPO_URL).build();
|
||||
DockerHttpClient httpClient = new ApacheDockerHttpClient.Builder().dockerHost(config.getDockerHost())
|
||||
.sslConfig(config.getSSLConfig()).build();
|
||||
|
||||
DockerClient dockerClient = DockerClientImpl.getInstance(config, httpClient);
|
||||
dockerClient.tagImageCmd(LOCAL_IMAGE, KIND_IMAGE, IMAGE_TAG).exec();
|
||||
dockerClient.pushImageCmd(KIND_IMAGE_WITH_TAG).start();
|
||||
|
||||
deployCoreK8sClientIt();
|
||||
|
||||
// Check to make sure the controller deployment is ready
|
||||
|
||||
@@ -14,7 +14,7 @@ spec:
|
||||
serviceAccountName: spring-cloud-kubernetes-serviceaccount
|
||||
containers:
|
||||
- name: spring-cloud-kubernetes-core-k8s-client-it
|
||||
image: localhost:5000/spring-cloud-kubernetes-core-k8s-client-it:2.0.0-SNAPSHOT
|
||||
image: docker.io/springcloud/spring-cloud-kubernetes-core-k8s-client-it:2.0.0-SNAPSHOT
|
||||
imagePullPolicy: IfNotPresent
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
|
||||
Reference in New Issue
Block a user