Merge branch 'bump-kubernetes-client-11' of https://github.com/yue9944882/spring-cloud-kubernetes into yue9944882-bump-kubernetes-client-11
# Conflicts: # spring-cloud-kubernetes-dependencies/pom.xml # spring-cloud-kubernetes-integration-tests/run.sh # spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-client-config-it/k8s/deployment-it.yaml # spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-client-config-it/k8s/deployment-polling-it.yaml # spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-client-config-it/src/test/resources/spring-cloud-kubernetes-client-config-it-deployment.yaml # spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-client-config-it/src/test/resources/spring-cloud-kubernetes-client-config-it-polling-deployment.yaml # spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-client-loadbalancer-it/k8s/deployment-it.yaml # spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-client-loadbalancer-it/src/test/java/org/springframework/cloud/kubernetes/client/loadbalancer/it/LoadBalancerIT.java # spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-client-loadbalancer-it/src/test/resources/spring-cloud-kubernetes-client-loadbalancer-pod-it-deployment.yaml # spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-client-loadbalancer-it/src/test/resources/spring-cloud-kubernetes-client-loadbalancer-service-it-deployment.yaml # spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-client-reactive-discovery-client-it/k8s/deployment-it.yaml # spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-client-reactive-discovery-client-it/src/test/java/org/springframework/cloud/kubernetes/client/reactive/discovery/it/ReactiveDiscoveryClientIT.java # spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-client-reactive-discovery-client-it/src/test/resources/spring-cloud-kubernetes-client-reactive-discovery-it-deployment.yaml # spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-configuration-watcher-it/deployment-it.yaml # spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-configuration-watcher-it/src/test/resources/spring-cloud-kubernetes-configuration-watcher-bus-amqp-deployment.yaml # spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-configuration-watcher-it/src/test/resources/spring-cloud-kubernetes-configuration-watcher-bus-kafka-deployment.yaml # spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-configuration-watcher-it/src/test/resources/spring-cloud-kubernetes-configuration-watcher-http-deployment.yaml # spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-configuration-watcher-it/src/test/resources/spring-cloud-kubernetes-configuration-watcher-it-bus-amqp-deployment.yaml # spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-configuration-watcher-it/src/test/resources/spring-cloud-kubernetes-configuration-watcher-it-bus-kafka-deployment.yaml # spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-core-k8s-client-it/k8s/deployment-it.yaml # spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-core-k8s-client-it/src/test/resources/spring-cloud-kubernetes-core-k8s-client-it-deployment.yaml # spring-cloud-kubernetes-test-support/src/main/java/org/springframework/cloud/kubernetes/integration/tests/commons/K8SUtils.java
This commit is contained in:
@@ -16,7 +16,14 @@
|
||||
|
||||
package org.springframework.cloud.kubernetes.client.example;
|
||||
|
||||
import io.kubernetes.client.openapi.ApiClient;
|
||||
import okhttp3.OkHttpClient;
|
||||
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
/**
|
||||
* @author wind57
|
||||
@@ -24,4 +31,11 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
@SpringBootApplication
|
||||
public class App {
|
||||
|
||||
@Bean
|
||||
public ApiClient apiClient() {
|
||||
ApiClient apiClient = mock(ApiClient.class);
|
||||
when(apiClient.getHttpClient()).thenReturn(new OkHttpClient.Builder().build());
|
||||
return apiClient;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ public class KubernetesClientConfigMapPropertySource extends ConfigMapPropertySo
|
||||
}
|
||||
}
|
||||
Map<String, Object> result = new LinkedHashMap<>();
|
||||
coreV1Api.listNamespacedConfigMap(namespace, null, null, null, null, null, null, null, null, null)
|
||||
coreV1Api.listNamespacedConfigMap(namespace, null, null, null, null, null, null, null, null, null, null)
|
||||
.getItems().stream().filter(cm -> names.contains(cm.getMetadata().getName()))
|
||||
.forEach(map -> result.putAll(processAllEntries(map.getData(), environment)));
|
||||
|
||||
|
||||
@@ -56,11 +56,12 @@ public class KubernetesClientSecretsPropertySource extends SecretsPropertySource
|
||||
if (!StringUtils.hasText(namespace)) {
|
||||
|
||||
// There could technically be more than one, just return the first
|
||||
secret = api.listSecretForAllNamespaces(null, null, null, null, null, null, null, null, null)
|
||||
secret = api.listSecretForAllNamespaces(null, null, null, null, null, null, null, null, null, null)
|
||||
.getItems().stream().filter(s -> name.equals(s.getMetadata().getName())).findFirst();
|
||||
}
|
||||
else {
|
||||
secret = api.listNamespacedSecret(namespace, null, null, null, null, null, null, null, null, null)
|
||||
secret = api
|
||||
.listNamespacedSecret(namespace, null, null, null, null, null, null, null, null, null, null)
|
||||
.getItems().stream().filter(s -> name.equals(s.getMetadata().getName())).findFirst();
|
||||
}
|
||||
|
||||
@@ -71,11 +72,11 @@ public class KubernetesClientSecretsPropertySource extends SecretsPropertySource
|
||||
if (labels != null && !labels.isEmpty()) {
|
||||
if (!StringUtils.hasText(namespace)) {
|
||||
api.listSecretForAllNamespaces(null, null, null, createLabelsSelector(labels), null, null, null,
|
||||
null, null).getItems().forEach(s -> putAll(s, result));
|
||||
null, null, null).getItems().forEach(s -> putAll(s, result));
|
||||
}
|
||||
else {
|
||||
api.listNamespacedSecret(namespace, null, null, null, null, createLabelsSelector(labels), null,
|
||||
null, null, null).getItems().forEach(s -> putAll(s, result));
|
||||
null, null, null, null).getItems().forEach(s -> putAll(s, result));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ public class KubernetesClientEventBasedConfigMapChangeDetector extends Configura
|
||||
SharedIndexInformer<V1ConfigMap> configMapInformer = factory.sharedIndexInformerFor(
|
||||
(CallGeneratorParams params) -> coreV1Api.listNamespacedConfigMapCall(
|
||||
kubernetesClientProperties.getNamespace(), null, null, null, null, null, null,
|
||||
params.resourceVersion, params.timeoutSeconds, params.watch, null),
|
||||
params.resourceVersion, null, params.timeoutSeconds, params.watch, null),
|
||||
V1ConfigMap.class, V1ConfigMapList.class);
|
||||
configMapInformer.addEventHandler(new ResourceEventHandler<V1ConfigMap>() {
|
||||
@Override
|
||||
|
||||
@@ -93,7 +93,7 @@ public class KubernetesClientEventBasedSecretsChangeDetector extends Configurati
|
||||
SharedIndexInformer<V1Secret> configMapInformer = factory.sharedIndexInformerFor(
|
||||
(CallGeneratorParams params) -> coreV1Api.listNamespacedSecretCall(
|
||||
kubernetesClientProperties.getNamespace(), null, null, null, null, null, null,
|
||||
params.resourceVersion, params.timeoutSeconds, params.watch, null),
|
||||
params.resourceVersion, null, params.timeoutSeconds, params.watch, null),
|
||||
V1Secret.class, V1SecretList.class);
|
||||
configMapInformer.addEventHandler(new ResourceEventHandler<V1Secret>() {
|
||||
@Override
|
||||
|
||||
@@ -24,10 +24,11 @@ import io.kubernetes.client.openapi.models.V1Endpoints;
|
||||
import io.kubernetes.client.openapi.models.V1EndpointsList;
|
||||
import io.kubernetes.client.openapi.models.V1Service;
|
||||
import io.kubernetes.client.openapi.models.V1ServiceList;
|
||||
import io.kubernetes.client.spring.extended.controller.KubernetesInformerFactoryProcessor;
|
||||
import io.kubernetes.client.spring.extended.controller.KubernetesInformerConfigurer;
|
||||
import io.kubernetes.client.spring.extended.controller.annotation.GroupVersionResource;
|
||||
import io.kubernetes.client.spring.extended.controller.annotation.KubernetesInformer;
|
||||
import io.kubernetes.client.spring.extended.controller.annotation.KubernetesInformers;
|
||||
import io.kubernetes.client.spring.extended.controller.config.KubernetesInformerAutoConfiguration;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
@@ -44,7 +45,10 @@ import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnKubernetesDiscoveryEnabled
|
||||
@AutoConfigureBefore({ SimpleDiscoveryClientAutoConfiguration.class, CommonsClientAutoConfiguration.class })
|
||||
@AutoConfigureBefore({ SimpleDiscoveryClientAutoConfiguration.class, CommonsClientAutoConfiguration.class,
|
||||
// So that CatalogSharedInformerFactory can be processed in prior to the default
|
||||
// factory
|
||||
KubernetesInformerAutoConfiguration.class })
|
||||
@AutoConfigureAfter({ KubernetesClientAutoConfiguration.class })
|
||||
@EnableConfigurationProperties(KubernetesDiscoveryProperties.class)
|
||||
public class KubernetesDiscoveryClientAutoConfiguration {
|
||||
@@ -55,8 +59,9 @@ public class KubernetesDiscoveryClientAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public KubernetesInformerFactoryProcessor kubernetesInformerFactoryProcessor() {
|
||||
return new KubernetesInformerFactoryProcessor();
|
||||
public KubernetesInformerConfigurer discoveryInformerConfigurer(ApiClient apiClient,
|
||||
CatalogSharedInformerFactory sharedInformerFactory) {
|
||||
return new KubernetesInformerConfigurer(apiClient, sharedInformerFactory);
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -16,13 +16,8 @@
|
||||
|
||||
package org.springframework.cloud.kubernetes.client.discovery;
|
||||
|
||||
import io.kubernetes.client.informer.SharedInformer;
|
||||
import io.kubernetes.client.informer.SharedInformerFactory;
|
||||
import io.kubernetes.client.informer.cache.Lister;
|
||||
import io.kubernetes.client.openapi.ApiClient;
|
||||
import io.kubernetes.client.openapi.JSON;
|
||||
import io.kubernetes.client.openapi.models.V1Endpoints;
|
||||
import io.kubernetes.client.openapi.models.V1Service;
|
||||
import okhttp3.OkHttpClient;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -68,31 +63,6 @@ public class KubernetesDiscoveryClientAutoConfigurationTests {
|
||||
return apiClient;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Lister<V1Service> serviceLister() {
|
||||
return mock(Lister.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Lister<V1Endpoints> endpointsLister() {
|
||||
return mock(Lister.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SharedInformerFactory sharedInformerFactory() {
|
||||
return mock(SharedInformerFactory.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SharedInformer<V1Endpoints> sharedInformerEndpoints() {
|
||||
return mock(SharedInformer.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SharedInformer<V1Service> sharedInformerService() {
|
||||
return mock(SharedInformer.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,13 +16,8 @@
|
||||
|
||||
package org.springframework.cloud.kubernetes.client.discovery.reactive;
|
||||
|
||||
import io.kubernetes.client.informer.SharedInformer;
|
||||
import io.kubernetes.client.informer.SharedInformerFactory;
|
||||
import io.kubernetes.client.informer.cache.Lister;
|
||||
import io.kubernetes.client.openapi.ApiClient;
|
||||
import io.kubernetes.client.openapi.JSON;
|
||||
import io.kubernetes.client.openapi.models.V1Endpoints;
|
||||
import io.kubernetes.client.openapi.models.V1Service;
|
||||
import okhttp3.OkHttpClient;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -71,31 +66,6 @@ public class KubernetesInformerReactiveDiscoveryClientAutoConfigurationTests {
|
||||
return apiClient;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Lister<V1Service> serviceLister() {
|
||||
return mock(Lister.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Lister<V1Endpoints> endpointsLister() {
|
||||
return mock(Lister.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SharedInformerFactory sharedInformerFactory() {
|
||||
return mock(SharedInformerFactory.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SharedInformer<V1Endpoints> sharedInformerEndpoints() {
|
||||
return mock(SharedInformer.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SharedInformer<V1Service> sharedInformerService() {
|
||||
return mock(SharedInformer.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -60,11 +60,11 @@ public class KubernetesClientServicesListSupplier extends KubernetesServicesList
|
||||
try {
|
||||
if (discoveryProperties.isAllNamespaces()) {
|
||||
services = coreV1Api.listServiceForAllNamespaces(null, null, "metadata.name=" + this.getServiceId(),
|
||||
null, null, null, null, null, null).getItems();
|
||||
null, null, null, null, null, null, null).getItems();
|
||||
}
|
||||
else {
|
||||
services = coreV1Api.listNamespacedService(kubernetesClientProperties.getNamespace(), null, null, null,
|
||||
"metadata.name=" + this.getServiceId(), null, null, null, null, null).getItems();
|
||||
"metadata.name=" + this.getServiceId(), null, null, null, null, null, null).getItems();
|
||||
}
|
||||
services.forEach(service -> result.add(mapper.map(service)));
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.web.client.TestRestTemplate;
|
||||
import org.springframework.boot.web.client.RestTemplateBuilder;
|
||||
import org.springframework.cloud.client.DefaultServiceInstance;
|
||||
import org.springframework.cloud.client.ServiceInstance;
|
||||
@@ -38,11 +37,9 @@ import org.springframework.cloud.kubernetes.client.discovery.KubernetesInformerD
|
||||
import org.springframework.cloud.loadbalancer.blocking.client.BlockingLoadBalancerClient;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.http.client.ClientHttpResponse;
|
||||
import org.springframework.mock.http.client.MockClientHttpResponse;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
@@ -63,12 +60,12 @@ import static org.mockito.Mockito.when;
|
||||
public class KubernetesClientLoadBalancerPodModeTests {
|
||||
|
||||
@Autowired
|
||||
private TestRestTemplate rest;
|
||||
private RestTemplate restTemplate;
|
||||
|
||||
@Test
|
||||
public void testLoadBalancer() {
|
||||
ResponseEntity<String> map = rest.getForEntity("/servicea", String.class);
|
||||
assertThat(map.getStatusCode()).isEqualTo(HttpStatus.OK);
|
||||
String resp = restTemplate.getForObject("http://servicea-wiremock", String.class);
|
||||
assertThat(resp).isEqualTo("hello");
|
||||
}
|
||||
|
||||
@RestController
|
||||
@@ -114,11 +111,6 @@ public class KubernetesClientLoadBalancerPodModeTests {
|
||||
return new RestTemplateBuilder().build();
|
||||
}
|
||||
|
||||
@GetMapping("/servicea")
|
||||
public String greeting() {
|
||||
return restTemplate().getForObject("http://servicea-wiremock", String.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.web.client.TestRestTemplate;
|
||||
import org.springframework.boot.web.client.RestTemplateBuilder;
|
||||
import org.springframework.cloud.client.ServiceInstance;
|
||||
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
|
||||
@@ -44,11 +43,9 @@ import org.springframework.cloud.kubernetes.client.discovery.KubernetesInformerD
|
||||
import org.springframework.cloud.loadbalancer.blocking.client.BlockingLoadBalancerClient;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.http.client.ClientHttpResponse;
|
||||
import org.springframework.mock.http.client.MockClientHttpResponse;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
@@ -83,12 +80,12 @@ public class KubernetesClientLoadBalancerServiceModeTests {
|
||||
.build();
|
||||
|
||||
@Autowired
|
||||
private TestRestTemplate rest;
|
||||
private RestTemplate restTemplate;
|
||||
|
||||
@Test
|
||||
public void testLoadBalancer() {
|
||||
ResponseEntity<String> map = rest.getForEntity("/servicea", String.class);
|
||||
assertThat(map.getStatusCode()).isEqualTo(HttpStatus.OK);
|
||||
String resp = restTemplate.getForObject("http://servicea-wiremock", String.class);
|
||||
assertThat(resp).isEqualTo("hello");
|
||||
}
|
||||
|
||||
@RestController
|
||||
@@ -109,8 +106,8 @@ public class KubernetesClientLoadBalancerServiceModeTests {
|
||||
CoreV1Api coreV1Api = mock(CoreV1Api.class);
|
||||
try {
|
||||
when(coreV1Api.listNamespacedService(eq("default"), eq(null), eq(null), eq(null),
|
||||
eq("metadata.name=servicea-wiremock"), eq(null), eq(null), eq(null), eq(null), eq(null)))
|
||||
.thenReturn(SERVICE_LIST);
|
||||
eq("metadata.name=servicea-wiremock"), eq(null), eq(null), eq(null), eq(null), eq(null),
|
||||
eq(null))).thenReturn(SERVICE_LIST);
|
||||
}
|
||||
catch (ApiException e) {
|
||||
e.printStackTrace();
|
||||
@@ -147,11 +144,6 @@ public class KubernetesClientLoadBalancerServiceModeTests {
|
||||
return new RestTemplateBuilder().build();
|
||||
}
|
||||
|
||||
@GetMapping("/servicea")
|
||||
public String greeting() {
|
||||
return restTemplate().getForObject("http://servicea-wiremock", String.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
<arquillian-cube.version>1.15.2</arquillian-cube.version>
|
||||
<hoverfly.version>0.13.0</hoverfly.version>
|
||||
<kubernetes-client.version>4.13.2</kubernetes-client.version>
|
||||
<kubernetes-java-client.version>10.0.0</kubernetes-java-client.version>
|
||||
<kubernetes-java-client.version>11.0.0</kubernetes-java-client.version>
|
||||
<istio-client.version>1.5.5</istio-client.version>
|
||||
<mockwebserver.version>0.1.2</mockwebserver.version>
|
||||
<okhttp.version>3.14.4</okhttp.version>
|
||||
|
||||
@@ -160,6 +160,11 @@
|
||||
<module>discovery</module>
|
||||
<module>load-balancer</module>
|
||||
<!-- Add this module back once we convert everything over to kind -->
|
||||
<!-- <module>spring-cloud-kubernetes-configuration-watcher-it</module>-->
|
||||
<!-- <module>spring-cloud-kubernetes-client-config-it</module>-->
|
||||
<!-- <module>spring-cloud-kubernetes-client-loadbalancer-it</module>-->
|
||||
<!-- <module>spring-cloud-kubernetes-client-reactive-discovery-client-it</module>-->
|
||||
<!-- <module>spring-cloud-kubernetes-configuration-watcher-it</module>-->
|
||||
<!-- <module>spring-cloud-kubernetes-configuration-watcher-it</module>-->
|
||||
<!-- <module>spring-cloud-kubernetes-core-k8s-client-it</module>-->
|
||||
</modules>
|
||||
</project>
|
||||
|
||||
@@ -14,7 +14,11 @@ KIND="${BIN_DIR}/kind"
|
||||
|
||||
ISTIOCTL="${BIN_DIR}/istio-1.6.2/bin/istioctl"
|
||||
|
||||
MVN_VERSION=$(../mvnw -q \
|
||||
CURRENT_DIR="$(pwd)"
|
||||
|
||||
MVN="${CURRENT_DIR}/../mvnw"
|
||||
|
||||
MVN_VERSION=$($MVN -q \
|
||||
-Dexec.executable=echo \
|
||||
-Dexec.args='${project.version}' \
|
||||
--non-recursive \
|
||||
@@ -39,9 +43,6 @@ DEFAULT_PULLING_IMAGES=(
|
||||
PULLING_IMAGES=(${PULLING_IMAGES:-${DEFAULT_PULLING_IMAGES[@]}})
|
||||
|
||||
LOADING_IMAGES=(${LOADING_IMAGES:-${DEFAULT_PULLING_IMAGES[@]}} "docker.io/springcloud/spring-cloud-kubernetes-configuration-watcher:${MVN_VERSION}")
|
||||
|
||||
CURRENT_DIR="$(pwd)"
|
||||
|
||||
# cleanup on exit (useful for running locally)
|
||||
cleanup() {
|
||||
"${KIND}" delete cluster || true
|
||||
@@ -115,17 +116,14 @@ main() {
|
||||
# curl -L https://istio.io/downloadIstio | sh -
|
||||
#"${ISTIOCTL}" install --set profile=demo
|
||||
|
||||
cd $CURRENT_DIR
|
||||
|
||||
|
||||
# running tests..
|
||||
for p in "${INTEGRATION_PROJECTS[@]}"; do
|
||||
echo "Running test: $p"
|
||||
cd $p
|
||||
../../mvnw spring-boot:build-image \
|
||||
${MVN} 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
|
||||
${MVN} clean install -P it
|
||||
cd ..
|
||||
done
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ public class ConfigMapAndSecretIT {
|
||||
@After
|
||||
public void after() throws Exception {
|
||||
appsApi.deleteCollectionNamespacedDeployment(NAMESPACE, null, null, null,
|
||||
"metadata.name=" + K8S_CONFIG_CLIENT_IT_NAME, null, null, null, null, null, null, null, null);
|
||||
"metadata.name=" + K8S_CONFIG_CLIENT_IT_NAME, null, null, null, null, null, null, null, null, null);
|
||||
api.deleteNamespacedService(K8S_CONFIG_CLIENT_IT_SERVICE_NAME, NAMESPACE, null, null, null, null, null, null);
|
||||
networkingApi.deleteNamespacedIngress("it-ingress", NAMESPACE, null, null, null, null, null, null);
|
||||
api.deleteNamespacedConfigMap(APP_NAME, NAMESPACE, null, null, null, null, null, null);
|
||||
|
||||
@@ -120,7 +120,7 @@ public class LoadBalancerIT {
|
||||
private void cleanup() throws ApiException {
|
||||
appsApi.deleteCollectionNamespacedDeployment(NAMESPACE, null, null, null,
|
||||
"metadata.name=" + SPRING_CLOUD_K8S_LOADBALANCER_DEPLOYMENT_NAME, null, null, null, null, null, null,
|
||||
null, null);
|
||||
null, null, null);
|
||||
api.deleteNamespacedService(SPRING_CLOUD_K8S_LOADBALANCER_APP_NAME, NAMESPACE, null, null, null, null, null,
|
||||
null);
|
||||
networkingApi.deleteNamespacedIngress("it-ingress", NAMESPACE, null, null, null, null, null, null);
|
||||
@@ -159,7 +159,7 @@ public class LoadBalancerIT {
|
||||
@After
|
||||
public void after() throws Exception {
|
||||
appsApi.deleteCollectionNamespacedDeployment(NAMESPACE, null, null, null,
|
||||
"metadata.name=" + WIREMOCK_DEPLOYMENT_NAME, null, null, null, null, null, null, null, null);
|
||||
"metadata.name=" + WIREMOCK_DEPLOYMENT_NAME, null, null, null, null, null, null, null, null, null);
|
||||
|
||||
api.deleteNamespacedService(WIREMOCK_APP_NAME, NAMESPACE, null, null, null, null, null, null);
|
||||
networkingApi.deleteNamespacedIngress("wiremock-ingress", NAMESPACE, null, null, null, null, null, null);
|
||||
|
||||
@@ -112,7 +112,7 @@ public class ReactiveDiscoveryClientIT {
|
||||
private void cleanup() throws ApiException {
|
||||
appsApi.deleteCollectionNamespacedDeployment(NAMESPACE, null, null, null,
|
||||
"metadata.name=" + SPRING_CLOUD_K8S_REACTIVE_DISCOVERY_DEPLOYMENT_NAME, null, null, null, null, null,
|
||||
null, null, null);
|
||||
null, null, null, null);
|
||||
api.deleteNamespacedService(SPRING_CLOUD_K8S_REACTIVE_DISCOVERY_APP_NAME, NAMESPACE, null, null, null, null,
|
||||
null, null);
|
||||
networkingApi.deleteNamespacedIngress("it-ingress", NAMESPACE, null, null, null, null, null, null);
|
||||
@@ -150,7 +150,7 @@ public class ReactiveDiscoveryClientIT {
|
||||
@After
|
||||
public void after() throws Exception {
|
||||
appsApi.deleteCollectionNamespacedDeployment(NAMESPACE, null, null, null,
|
||||
"metadata.name=" + WIREMOCK_DEPLOYMENT_NAME, null, null, null, null, null, null, null, null);
|
||||
"metadata.name=" + WIREMOCK_DEPLOYMENT_NAME, null, null, null, null, null, null, null, null, null);
|
||||
|
||||
api.deleteNamespacedService(WIREMOCK_APP_NAME, NAMESPACE, null, null, null, null, null, null);
|
||||
networkingApi.deleteNamespacedIngress("wiremock-ingress", NAMESPACE, null, null, null, null, null, null);
|
||||
|
||||
@@ -59,7 +59,7 @@ public class ActuatorRefreshIT {
|
||||
|
||||
private static final String IMAGE = "spring-cloud-kubernetes-configuration-watcher";
|
||||
|
||||
private static final String IMAGE_TAG = "2.0.0-SNAPSHOT";
|
||||
private static final String IMAGE_TAG = "2.0.1-SNAPSHOT";
|
||||
|
||||
private static final String LOCAL_REPO = "docker.io/springcloud";
|
||||
|
||||
@@ -142,10 +142,10 @@ public class ActuatorRefreshIT {
|
||||
|
||||
appsApi.deleteCollectionNamespacedDeployment(NAMESPACE, null, null, null,
|
||||
"metadata.name=" + SPRING_CLOUD_K8S_CONFIG_WATCHER_DEPLOYMENT_NAME, null, null, null, null, null, null,
|
||||
null, null);
|
||||
null, null, null);
|
||||
appsApi.deleteCollectionNamespacedDeployment(NAMESPACE, null, null, null,
|
||||
"metadata.name=" + CONFIG_WATCHER_WIREMOCK_DEPLOYMENT_NAME, null, null, null, null, null, null, null,
|
||||
null);
|
||||
null, null);
|
||||
api.deleteNamespacedService(SPRING_CLOUD_K8S_CONFIG_WATCHER_APP_NAME, NAMESPACE, null, null, null, null, null,
|
||||
null);
|
||||
api.deleteNamespacedService(CONFIG_WATCHER_WIREMOCK_APP_NAME, NAMESPACE, null, null, null, null, null, null);
|
||||
|
||||
@@ -54,31 +54,8 @@ public class ActuatorRefreshKafkaIT {
|
||||
|
||||
private Log log = LogFactory.getLog(getClass());
|
||||
|
||||
private static final String KIND_REPO_HOST_PORT = "localhost:5000";
|
||||
|
||||
private static final String KIND_REPO_URL = "http://" + KIND_REPO_HOST_PORT;
|
||||
|
||||
private static final String CONFIG_WATCHER_IMAGE = "spring-cloud-kubernetes-configuration-watcher";
|
||||
|
||||
private static final String CONFIG_WATCHER_IT_IMAGE = "spring-cloud-kubernetes-configuration-watcher-it";
|
||||
|
||||
private static final String IMAGE_TAG = "2.0.0-SNAPSHOT";
|
||||
|
||||
private static final String LOCAL_REPO = "docker.io/springcloud";
|
||||
|
||||
private static final String CONFIG_WATCHER_LOCAL_IMAGE = LOCAL_REPO + "/" + CONFIG_WATCHER_IMAGE + ":" + IMAGE_TAG;
|
||||
|
||||
private static final String CONFIG_WATCHER_IT_LOCAL_IMAGE = LOCAL_REPO + "/" + CONFIG_WATCHER_IT_IMAGE + ":"
|
||||
+ IMAGE_TAG;
|
||||
|
||||
private static final String CONFIG_WATCHER_KIND_IMAGE = KIND_REPO_HOST_PORT + "/" + CONFIG_WATCHER_IMAGE;
|
||||
|
||||
private static final String CONFIG_WATCHER_IT_KIND_IMAGE = KIND_REPO_HOST_PORT + "/" + CONFIG_WATCHER_IT_IMAGE;
|
||||
|
||||
private static final String CONFIG_WATCHER_KIND_IMAGE_WITH_TAG = CONFIG_WATCHER_KIND_IMAGE + ":" + IMAGE_TAG;
|
||||
|
||||
private static final String CONFIG_WATCHER_IT_KIND_IMAGE_WITH_TAG = CONFIG_WATCHER_IT_KIND_IMAGE + ":" + IMAGE_TAG;
|
||||
|
||||
private static final String SPRING_CLOUD_K8S_CONFIG_WATCHER_DEPLOYMENT_NAME = "spring-cloud-kubernetes-configuration-watcher-deployment";
|
||||
|
||||
private static final String SPRING_CLOUD_K8S_CONFIG_WATCHER_IT_DEPLOYMENT_NAME = "spring-cloud-kubernetes-configuration-watcher-it-deployment";
|
||||
@@ -151,8 +128,8 @@ public class ActuatorRefreshKafkaIT {
|
||||
|
||||
// Sometimes the NGINX ingress takes a bit to catch up and realize the service is
|
||||
// available and we get a 503, we just need to wait a bit
|
||||
await().timeout(Duration.ofSeconds(60))
|
||||
.until(() -> rest.getForEntity("http://localhost:80/it", String.class).getStatusCode().is2xxSuccessful());
|
||||
await().timeout(Duration.ofSeconds(60)).until(
|
||||
() -> rest.getForEntity("http://localhost:80/it", String.class).getStatusCode().is2xxSuccessful());
|
||||
// Wait a bit before we verify
|
||||
await().pollInterval(Duration.ofSeconds(1)).atMost(Duration.ofSeconds(90)).until(() -> {
|
||||
Boolean value = rest.getForObject("http://localhost:80/it", Boolean.class);
|
||||
|
||||
@@ -52,6 +52,7 @@ import static org.springframework.cloud.kubernetes.integration.tests.commons.K8S
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class ActuatorRefreshRabbitMQIT {
|
||||
|
||||
private static final Log LOG = LogFactory.getLog(ActuatorRefreshRabbitMQIT.class);
|
||||
|
||||
private Log log = LogFactory.getLog(getClass());
|
||||
@@ -122,8 +123,8 @@ public class ActuatorRefreshRabbitMQIT {
|
||||
|
||||
// Sometimes the NGINX ingress takes a bit to catch up and realize the service is
|
||||
// available and we get a 503, we just need to wait a bit
|
||||
await().timeout(Duration.ofSeconds(60))
|
||||
.until(() -> rest.getForEntity("http://localhost:80/it", String.class).getStatusCode().is2xxSuccessful());
|
||||
await().timeout(Duration.ofSeconds(60)).until(
|
||||
() -> rest.getForEntity("http://localhost:80/it", String.class).getStatusCode().is2xxSuccessful());
|
||||
|
||||
// Wait a bit before we verify
|
||||
await().pollInterval(Duration.ofSeconds(1)).atMost(Duration.ofSeconds(90)).until(() -> {
|
||||
|
||||
@@ -192,7 +192,7 @@ public class ActuatorEndpointIT {
|
||||
@AfterClass
|
||||
public static void after() throws Exception {
|
||||
appsApi.deleteCollectionNamespacedDeployment(NAMESPACE, null, null, null,
|
||||
"metadata.name=" + K8S_CONFIG_CLIENT_IT_NAME, null, null, null, null, null, null, null, null);
|
||||
"metadata.name=" + K8S_CONFIG_CLIENT_IT_NAME, null, null, null, null, null, null, null, null, null);
|
||||
api.deleteNamespacedService(K8S_CONFIG_CLIENT_IT_SERVICE_NAME, NAMESPACE, null, null, null, null, null, null);
|
||||
networkingApi.deleteNamespacedIngress("it-ingress", NAMESPACE, null, null, null, null, null, null);
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ public class K8SUtils {
|
||||
|
||||
public boolean isEndpointReady(String name, String namespace) throws ApiException {
|
||||
V1EndpointsList endpoints = api.listNamespacedEndpoints(namespace, null, null, null, "metadata.name=" + name,
|
||||
null, null, null, null, null);
|
||||
null, null, null, null, null, null);
|
||||
if (endpoints.getItems().isEmpty()) {
|
||||
fail("no endpoints for " + name);
|
||||
}
|
||||
@@ -154,7 +154,7 @@ public class K8SUtils {
|
||||
|
||||
public boolean isReplicationControllerReady(String name, String namespace) throws ApiException {
|
||||
V1ReplicationControllerList controllerList = api.listNamespacedReplicationController(namespace, null, null,
|
||||
null, "metadata.name=" + name, null, null, null, null, null);
|
||||
null, "metadata.name=" + name, null, null, null, null, null, null);
|
||||
if (controllerList.getItems().size() < 1) {
|
||||
fail("Replication controller with name " + name + "could not be found");
|
||||
}
|
||||
@@ -188,7 +188,7 @@ public class K8SUtils {
|
||||
|
||||
public boolean isDeployentReady(String deploymentName, String namespace) throws ApiException {
|
||||
V1DeploymentList deployments = appsApi.listNamespacedDeployment(namespace, null, null, null,
|
||||
"metadata.name=" + deploymentName, null, null, null, null, null);
|
||||
"metadata.name=" + deploymentName, null, null, null, null, null, null);
|
||||
if (deployments.getItems().size() < 1) {
|
||||
fail("No deployments with the name " + deploymentName);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user