Bump version to 16.0.2 (#1163)
Co-authored-by: Ryan Baxter <524254+ryanjbaxter@users.noreply.github.com>
This commit is contained in:
@@ -82,7 +82,7 @@ public class KubernetesClientPodUtils implements PodUtils<V1Pod> {
|
||||
private V1Pod internalGetPod() {
|
||||
try {
|
||||
if (isServiceHostEnvVarPresent() && isHostNameEnvVarPresent() && isServiceAccountFound()) {
|
||||
return client.readNamespacedPod(hostName, namespace, null, null, null);
|
||||
return client.readNamespacedPod(hostName, namespace, null);
|
||||
}
|
||||
}
|
||||
catch (Throwable t) {
|
||||
|
||||
@@ -168,7 +168,7 @@ public class KubernetesClientPodUtilsTests {
|
||||
}
|
||||
|
||||
private void mockPodResult() throws ApiException {
|
||||
Mockito.when(client.readNamespacedPod(POD_HOSTNAME, "namespace", null, null, null)).thenReturn(POD);
|
||||
Mockito.when(client.readNamespacedPod(POD_HOSTNAME, "namespace", null)).thenReturn(POD);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,8 +30,8 @@ import io.kubernetes.client.extended.wait.Wait;
|
||||
import io.kubernetes.client.informer.SharedInformer;
|
||||
import io.kubernetes.client.informer.SharedInformerFactory;
|
||||
import io.kubernetes.client.informer.cache.Lister;
|
||||
import io.kubernetes.client.openapi.models.CoreV1EndpointPort;
|
||||
import io.kubernetes.client.openapi.models.V1EndpointAddress;
|
||||
import io.kubernetes.client.openapi.models.V1EndpointPort;
|
||||
import io.kubernetes.client.openapi.models.V1Endpoints;
|
||||
import io.kubernetes.client.openapi.models.V1Service;
|
||||
import org.apache.commons.logging.Log;
|
||||
@@ -48,7 +48,6 @@ import org.springframework.util.StringUtils;
|
||||
|
||||
import static org.springframework.cloud.kubernetes.commons.discovery.KubernetesDiscoveryConstants.HTTP;
|
||||
import static org.springframework.cloud.kubernetes.commons.discovery.KubernetesDiscoveryConstants.HTTPS;
|
||||
import static org.springframework.cloud.kubernetes.commons.discovery.KubernetesDiscoveryConstants.PRIMARY_PORT_NAME_LABEL_KEY;
|
||||
import static org.springframework.cloud.kubernetes.commons.discovery.KubernetesDiscoveryConstants.UNSET_PORT_NAME;
|
||||
|
||||
/**
|
||||
@@ -155,7 +154,7 @@ public class KubernetesInformerDiscoveryClient implements DiscoveryClient, Initi
|
||||
return ep.getSubsets().stream().filter(subset -> subset.getPorts() != null && subset.getPorts().size() > 0) // safeguard
|
||||
.flatMap(subset -> {
|
||||
Map<String, String> metadata = new HashMap<>(svcMetadata);
|
||||
List<V1EndpointPort> endpointPorts = subset.getPorts();
|
||||
List<CoreV1EndpointPort> endpointPorts = subset.getPorts();
|
||||
if (this.properties.metadata() != null && this.properties.metadata().addPorts()) {
|
||||
endpointPorts.forEach(
|
||||
p -> metadata.put(StringUtils.hasText(p.getName()) ? p.getName() : UNSET_PORT_NAME,
|
||||
@@ -190,13 +189,13 @@ public class KubernetesInformerDiscoveryClient implements DiscoveryClient, Initi
|
||||
return Boolean.parseBoolean(securedOpt.orElse("false"));
|
||||
}
|
||||
|
||||
private int findEndpointPort(List<V1EndpointPort> endpointPorts, String primaryPortName, String serviceId) {
|
||||
private int findEndpointPort(List<CoreV1EndpointPort> endpointPorts, String primaryPortName, String serviceId) {
|
||||
if (endpointPorts.size() == 1) {
|
||||
return endpointPorts.get(0).getPort();
|
||||
}
|
||||
else {
|
||||
Map<String, Integer> ports = endpointPorts.stream().filter(p -> StringUtils.hasText(p.getName()))
|
||||
.collect(Collectors.toMap(V1EndpointPort::getName, V1EndpointPort::getPort));
|
||||
.collect(Collectors.toMap(CoreV1EndpointPort::getName, CoreV1EndpointPort::getPort));
|
||||
// This oneliner is looking for a port with a name equal to the primary port
|
||||
// name specified in the service label
|
||||
// or in spring.cloud.kubernetes.discovery.primary-port-name, equal to https,
|
||||
|
||||
@@ -94,10 +94,10 @@ public class KubernetesDiscoveryClientAutoConfigurationTests {
|
||||
WireMock.configureFor(wireMockServer.port());
|
||||
stubFor(get("/api/v1/namespaces/test/endpoints?resourceVersion=0&watch=false")
|
||||
.willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(new V1EndpointsListBuilder()
|
||||
.withMetadata(new V1ListMetaBuilder().withNewResourceVersion("0").build()).build()))));
|
||||
.withMetadata(new V1ListMetaBuilder().withResourceVersion("0").build()).build()))));
|
||||
stubFor(get("/api/v1/namespaces/test/services?resourceVersion=0&watch=false")
|
||||
.willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(new V1ServiceListBuilder()
|
||||
.withMetadata(new V1ListMetaBuilder().withNewResourceVersion("0").build()).build()))));
|
||||
.withMetadata(new V1ListMetaBuilder().withResourceVersion("0").build()).build()))));
|
||||
ApiClient apiClient = new ClientBuilder().setBasePath(wireMockServer.baseUrl()).build();
|
||||
return apiClient;
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ import java.util.Set;
|
||||
import io.kubernetes.client.informer.SharedInformerFactory;
|
||||
import io.kubernetes.client.informer.cache.Cache;
|
||||
import io.kubernetes.client.informer.cache.Lister;
|
||||
import io.kubernetes.client.openapi.models.CoreV1EndpointPort;
|
||||
import io.kubernetes.client.openapi.models.V1EndpointAddress;
|
||||
import io.kubernetes.client.openapi.models.V1EndpointPort;
|
||||
import io.kubernetes.client.openapi.models.V1EndpointSubset;
|
||||
import io.kubernetes.client.openapi.models.V1Endpoints;
|
||||
import io.kubernetes.client.openapi.models.V1ObjectMeta;
|
||||
@@ -72,17 +72,17 @@ public class KubernetesInformerDiscoveryClientTests {
|
||||
|
||||
private static final V1Endpoints testEndpoints1 = new V1Endpoints()
|
||||
.metadata(new V1ObjectMeta().name("test-svc-1").namespace("namespace1"))
|
||||
.addSubsetsItem(new V1EndpointSubset().addPortsItem(new V1EndpointPort().port(8080))
|
||||
.addSubsetsItem(new V1EndpointSubset().addPortsItem(new CoreV1EndpointPort().port(8080))
|
||||
.addAddressesItem(new V1EndpointAddress().ip("2.2.2.2")));
|
||||
|
||||
private static final V1Endpoints testEndpoints2 = new V1Endpoints()
|
||||
.metadata(new V1ObjectMeta().name("test-svc-1").namespace("namespace2"))
|
||||
.addSubsetsItem(new V1EndpointSubset().addPortsItem(new V1EndpointPort().port(8080))
|
||||
.addSubsetsItem(new V1EndpointSubset().addPortsItem(new CoreV1EndpointPort().port(8080))
|
||||
.addAddressesItem(new V1EndpointAddress().ip("2.2.2.2")));
|
||||
|
||||
private static final V1Endpoints testEndpointWithoutReadyAddresses = new V1Endpoints()
|
||||
.metadata(new V1ObjectMeta().name("test-svc-1").namespace("namespace1"))
|
||||
.addSubsetsItem(new V1EndpointSubset().addPortsItem(new V1EndpointPort().port(8080))
|
||||
.addSubsetsItem(new V1EndpointSubset().addPortsItem(new CoreV1EndpointPort().port(8080))
|
||||
.addNotReadyAddressesItem(new V1EndpointAddress().ip("2.2.2.2")));
|
||||
|
||||
private static final V1Endpoints testEndpointWithoutPorts = new V1Endpoints()
|
||||
@@ -91,30 +91,30 @@ public class KubernetesInformerDiscoveryClientTests {
|
||||
|
||||
private static final V1Endpoints testEndpointWithUnsetPortName = new V1Endpoints()
|
||||
.metadata(new V1ObjectMeta().name("test-svc-1").namespace("namespace1"))
|
||||
.addSubsetsItem(new V1EndpointSubset().addPortsItem(new V1EndpointPort().port(80))
|
||||
.addSubsetsItem(new V1EndpointSubset().addPortsItem(new CoreV1EndpointPort().port(80))
|
||||
.addAddressesItem(new V1EndpointAddress().ip("1.1.1.1")));
|
||||
|
||||
private static final V1Endpoints testEndpointWithMultiplePorts = new V1Endpoints()
|
||||
.metadata(new V1ObjectMeta().name("test-svc-1").namespace("namespace1"))
|
||||
.addSubsetsItem(new V1EndpointSubset().addPortsItem(new V1EndpointPort().name("http").port(80))
|
||||
.addPortsItem(new V1EndpointPort().name("https").port(443))
|
||||
.addSubsetsItem(new V1EndpointSubset().addPortsItem(new CoreV1EndpointPort().name("http").port(80))
|
||||
.addPortsItem(new CoreV1EndpointPort().name("https").port(443))
|
||||
.addAddressesItem(new V1EndpointAddress().ip("1.1.1.1")));
|
||||
|
||||
private static final V1Endpoints testEndpointWithMultiplePortsWithoutHttps = new V1Endpoints()
|
||||
.metadata(new V1ObjectMeta().name("test-svc-1").namespace("namespace1"))
|
||||
.addSubsetsItem(new V1EndpointSubset().addPortsItem(new V1EndpointPort().name("http").port(80))
|
||||
.addPortsItem(new V1EndpointPort().name("tcp").port(443))
|
||||
.addSubsetsItem(new V1EndpointSubset().addPortsItem(new CoreV1EndpointPort().name("http").port(80))
|
||||
.addPortsItem(new CoreV1EndpointPort().name("tcp").port(443))
|
||||
.addAddressesItem(new V1EndpointAddress().ip("1.1.1.1")));
|
||||
|
||||
private static final V1Endpoints testEndpointWithMultiplePortsWithoutSupportedPortNames = new V1Endpoints()
|
||||
.metadata(new V1ObjectMeta().name("test-svc-1").namespace("namespace1"))
|
||||
.addSubsetsItem(new V1EndpointSubset().addPortsItem(new V1EndpointPort().name("tcp1").port(80))
|
||||
.addPortsItem(new V1EndpointPort().name("tcp2").port(443))
|
||||
.addSubsetsItem(new V1EndpointSubset().addPortsItem(new CoreV1EndpointPort().name("tcp1").port(80))
|
||||
.addPortsItem(new CoreV1EndpointPort().name("tcp2").port(443))
|
||||
.addAddressesItem(new V1EndpointAddress().ip("1.1.1.1")));
|
||||
|
||||
private static final V1Endpoints testEndpoints3 = new V1Endpoints()
|
||||
.metadata(new V1ObjectMeta().name("test-svc-3").namespace("namespace1"))
|
||||
.addSubsetsItem(new V1EndpointSubset().addPortsItem(new V1EndpointPort().port(8080))
|
||||
.addSubsetsItem(new V1EndpointSubset().addPortsItem(new CoreV1EndpointPort().port(8080))
|
||||
.addAddressesItem(new V1EndpointAddress().ip("2.2.2.2")));
|
||||
|
||||
@Test
|
||||
|
||||
@@ -90,10 +90,10 @@ public class KubernetesInformerReactiveDiscoveryClientAutoConfigurationTests {
|
||||
WireMock.configureFor(wireMockServer.port());
|
||||
stubFor(get("/api/v1/namespaces/test/endpoints?resourceVersion=0&watch=false")
|
||||
.willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(new V1EndpointsListBuilder()
|
||||
.withMetadata(new V1ListMetaBuilder().withNewResourceVersion("0").build()).build()))));
|
||||
.withMetadata(new V1ListMetaBuilder().withResourceVersion("0").build()).build()))));
|
||||
stubFor(get("/api/v1/namespaces/test/services?resourceVersion=0&watch=false")
|
||||
.willReturn(aResponse().withStatus(200).withBody(new JSON().serialize(new V1ServiceListBuilder()
|
||||
.withMetadata(new V1ListMetaBuilder().withNewResourceVersion("0").build()).build()))));
|
||||
.withMetadata(new V1ListMetaBuilder().withResourceVersion("0").build()).build()))));
|
||||
ApiClient apiClient = new ClientBuilder().setBasePath(wireMockServer.baseUrl()).build();
|
||||
return apiClient;
|
||||
}
|
||||
|
||||
@@ -22,8 +22,8 @@ import java.util.Set;
|
||||
import io.kubernetes.client.informer.SharedInformerFactory;
|
||||
import io.kubernetes.client.informer.cache.Cache;
|
||||
import io.kubernetes.client.informer.cache.Lister;
|
||||
import io.kubernetes.client.openapi.models.CoreV1EndpointPort;
|
||||
import io.kubernetes.client.openapi.models.V1EndpointAddress;
|
||||
import io.kubernetes.client.openapi.models.V1EndpointPort;
|
||||
import io.kubernetes.client.openapi.models.V1EndpointSubset;
|
||||
import io.kubernetes.client.openapi.models.V1Endpoints;
|
||||
import io.kubernetes.client.openapi.models.V1ObjectMeta;
|
||||
@@ -63,7 +63,7 @@ public class KubernetesInformerReactiveDiscoveryClientTests {
|
||||
|
||||
private static final V1Endpoints testEndpoints1 = new V1Endpoints()
|
||||
.metadata(new V1ObjectMeta().name("test-svc-1").namespace("namespace1"))
|
||||
.addSubsetsItem(new V1EndpointSubset().addPortsItem(new V1EndpointPort().port(8080))
|
||||
.addSubsetsItem(new V1EndpointSubset().addPortsItem(new CoreV1EndpointPort().port(8080))
|
||||
.addAddressesItem(new V1EndpointAddress().ip("2.2.2.2")));
|
||||
|
||||
@Test
|
||||
|
||||
@@ -25,9 +25,9 @@ import com.github.tomakehurst.wiremock.WireMockServer;
|
||||
import com.github.tomakehurst.wiremock.client.WireMock;
|
||||
import com.github.tomakehurst.wiremock.core.WireMockConfiguration;
|
||||
import io.kubernetes.client.openapi.apis.CoreV1Api;
|
||||
import io.kubernetes.client.openapi.models.CoreV1EndpointPort;
|
||||
import io.kubernetes.client.openapi.models.V1ConfigMap;
|
||||
import io.kubernetes.client.openapi.models.V1EndpointAddress;
|
||||
import io.kubernetes.client.openapi.models.V1EndpointPort;
|
||||
import io.kubernetes.client.openapi.models.V1ObjectMeta;
|
||||
import io.kubernetes.client.util.ClientBuilder;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
@@ -159,7 +159,7 @@ class HttpBasedConfigMapWatchChangeDetectorTests {
|
||||
V1EndpointAddress fooEndpointAddress = new V1EndpointAddress();
|
||||
fooEndpointAddress.setIp("127.0.0.1");
|
||||
fooEndpointAddress.setHostname("localhost");
|
||||
V1EndpointPort fooEndpointPort = new V1EndpointPort();
|
||||
CoreV1EndpointPort fooEndpointPort = new CoreV1EndpointPort();
|
||||
fooEndpointPort.setPort(port);
|
||||
List<ServiceInstance> instances = new ArrayList<>();
|
||||
DefaultKubernetesServiceInstance fooServiceInstance = new DefaultKubernetesServiceInstance("foo", "foo",
|
||||
@@ -183,7 +183,7 @@ class HttpBasedConfigMapWatchChangeDetectorTests {
|
||||
fooEndpointAddress.setIp("127.0.0.1");
|
||||
fooEndpointAddress.setHostname("localhost");
|
||||
|
||||
V1EndpointPort fooEndpointPort = new V1EndpointPort();
|
||||
CoreV1EndpointPort fooEndpointPort = new CoreV1EndpointPort();
|
||||
fooEndpointPort.setPort(WIRE_MOCK_SERVER.port());
|
||||
|
||||
List<ServiceInstance> instances = new ArrayList<>();
|
||||
|
||||
@@ -25,8 +25,8 @@ import com.github.tomakehurst.wiremock.WireMockServer;
|
||||
import com.github.tomakehurst.wiremock.client.WireMock;
|
||||
import com.github.tomakehurst.wiremock.core.WireMockConfiguration;
|
||||
import io.kubernetes.client.openapi.apis.CoreV1Api;
|
||||
import io.kubernetes.client.openapi.models.CoreV1EndpointPort;
|
||||
import io.kubernetes.client.openapi.models.V1EndpointAddress;
|
||||
import io.kubernetes.client.openapi.models.V1EndpointPort;
|
||||
import io.kubernetes.client.openapi.models.V1ObjectMeta;
|
||||
import io.kubernetes.client.openapi.models.V1Secret;
|
||||
import io.kubernetes.client.util.ClientBuilder;
|
||||
@@ -153,7 +153,7 @@ class HttpBasedSecretsWatchChangeDetectorTests {
|
||||
V1EndpointAddress fooEndpointAddress = new V1EndpointAddress();
|
||||
fooEndpointAddress.setIp("127.0.0.1");
|
||||
fooEndpointAddress.setHostname("localhost");
|
||||
V1EndpointPort fooEndpointPort = new V1EndpointPort();
|
||||
CoreV1EndpointPort fooEndpointPort = new CoreV1EndpointPort();
|
||||
fooEndpointPort.setPort(WIRE_MOCK_SERVER.port());
|
||||
List<ServiceInstance> instances = new ArrayList<>();
|
||||
DefaultKubernetesServiceInstance fooServiceInstance = new DefaultKubernetesServiceInstance("foo", "foo",
|
||||
@@ -174,7 +174,7 @@ class HttpBasedSecretsWatchChangeDetectorTests {
|
||||
V1EndpointAddress fooEndpointAddress = new V1EndpointAddress();
|
||||
fooEndpointAddress.setIp("127.0.0.1");
|
||||
fooEndpointAddress.setHostname("localhost");
|
||||
V1EndpointPort fooEndpointPort = new V1EndpointPort();
|
||||
CoreV1EndpointPort fooEndpointPort = new CoreV1EndpointPort();
|
||||
fooEndpointPort.setPort(WIRE_MOCK_SERVER.port());
|
||||
List<ServiceInstance> instances = new ArrayList<>();
|
||||
DefaultKubernetesServiceInstance fooServiceInstance = new DefaultKubernetesServiceInstance("foo", "foo",
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<properties>
|
||||
<hoverfly.version>0.13.0</hoverfly.version>
|
||||
<kubernetes-fabric8-client.version>5.12.2</kubernetes-fabric8-client.version>
|
||||
<kubernetes-native-client.version>13.0.2</kubernetes-native-client.version>
|
||||
<kubernetes-native-client.version>16.0.2</kubernetes-native-client.version>
|
||||
<istio-client.version>1.7.7.1</istio-client.version>
|
||||
<wiremock.version>2.26.3</wiremock.version>
|
||||
<spring-retry.version>1.3.1</spring-retry.version>
|
||||
|
||||
@@ -141,7 +141,7 @@ class ConfigMapAndSecretIT {
|
||||
Map<String, String> data = configMap.getData();
|
||||
data.replace("application.yaml", data.get("application.yaml").replace("from-config-map", "from-unit-test"));
|
||||
configMap.data(data);
|
||||
api.replaceNamespacedConfigMap(APP_NAME, NAMESPACE, configMap, null, null, null);
|
||||
api.replaceNamespacedConfigMap(APP_NAME, NAMESPACE, configMap, null, null, null, null);
|
||||
Awaitility.await().timeout(Duration.ofSeconds(60)).pollInterval(Duration.ofSeconds(2))
|
||||
.until(() -> propertyClient.method(HttpMethod.GET).retrieve().bodyToMono(String.class).block()
|
||||
.equals("from-unit-test"));
|
||||
@@ -149,30 +149,30 @@ class ConfigMapAndSecretIT {
|
||||
Map<String, byte[]> secretData = v1Secret.getData();
|
||||
secretData.replace("my.config.mySecret", "p455w1rd".getBytes());
|
||||
v1Secret.setData(secretData);
|
||||
api.replaceNamespacedSecret(APP_NAME, NAMESPACE, v1Secret, null, null, null);
|
||||
api.replaceNamespacedSecret(APP_NAME, NAMESPACE, v1Secret, null, null, null, null);
|
||||
Awaitility.await().timeout(Duration.ofSeconds(60)).pollInterval(Duration.ofSeconds(2)).until(() -> secretClient
|
||||
.method(HttpMethod.GET).retrieve().bodyToMono(String.class).block().equals("p455w1rd"));
|
||||
}
|
||||
|
||||
private static void deployConfigK8sClientIt() throws Exception {
|
||||
k8SUtils.waitForDeploymentToBeDeleted(K8S_CONFIG_CLIENT_IT_NAME, NAMESPACE);
|
||||
api.createNamespacedSecret(NAMESPACE, getConfigK8sClientItCSecret(), null, null, null);
|
||||
api.createNamespacedConfigMap(NAMESPACE, getConfigK8sClientItConfigMap(), null, null, null);
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getConfigK8sClientItDeployment(), null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getConfigK8sClientItService(), null, null, null);
|
||||
api.createNamespacedSecret(NAMESPACE, getConfigK8sClientItCSecret(), null, null, null, null);
|
||||
api.createNamespacedConfigMap(NAMESPACE, getConfigK8sClientItConfigMap(), null, null, null, null);
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getConfigK8sClientItDeployment(), null, null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getConfigK8sClientItService(), null, null, null, null);
|
||||
|
||||
V1Ingress ingress = getConfigK8sClientItIngress();
|
||||
networkingApi.createNamespacedIngress(NAMESPACE, ingress, null, null, null);
|
||||
networkingApi.createNamespacedIngress(NAMESPACE, ingress, null, null, null, null);
|
||||
k8SUtils.waitForIngress(ingress.getMetadata().getName(), NAMESPACE);
|
||||
}
|
||||
|
||||
private static void deployConfigK8sClientPollingIt() throws Exception {
|
||||
k8SUtils.waitForDeploymentToBeDeleted(K8S_CONFIG_CLIENT_IT_NAME, NAMESPACE);
|
||||
api.createNamespacedSecret(NAMESPACE, getConfigK8sClientItCSecret(), null, null, null);
|
||||
api.createNamespacedConfigMap(NAMESPACE, getConfigK8sClientItConfigMap(), null, null, null);
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getConfigK8sClientItPollingDeployment(), null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getConfigK8sClientItService(), null, null, null);
|
||||
networkingApi.createNamespacedIngress(NAMESPACE, getConfigK8sClientItIngress(), null, null, null);
|
||||
api.createNamespacedSecret(NAMESPACE, getConfigK8sClientItCSecret(), null, null, null, null);
|
||||
api.createNamespacedConfigMap(NAMESPACE, getConfigK8sClientItConfigMap(), null, null, null, null);
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getConfigK8sClientItPollingDeployment(), null, null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getConfigK8sClientItService(), null, null, null, null);
|
||||
networkingApi.createNamespacedIngress(NAMESPACE, getConfigK8sClientItIngress(), null, null, null, null);
|
||||
}
|
||||
|
||||
private static V1Deployment getConfigK8sClientItDeployment() throws Exception {
|
||||
|
||||
@@ -161,7 +161,7 @@ class ConfigurationWatcherMultipleAppsIT {
|
||||
"spring-cloud-kubernetes-client-configuration-watcher-configmap-app-a, "
|
||||
+ "spring-cloud-kubernetes-client-configuration-watcher-configmap-app-b")
|
||||
.endMetadata().addToData("foo", "hello world").build();
|
||||
api.createNamespacedConfigMap(NAMESPACE, configMap, null, null, null);
|
||||
api.createNamespacedConfigMap(NAMESPACE, configMap, null, null, null, null);
|
||||
|
||||
WebClient.Builder builderA = builder();
|
||||
WebClient serviceClientA = builderA.baseUrl("http://localhost:80/app-a").build();
|
||||
@@ -197,12 +197,12 @@ class ConfigurationWatcherMultipleAppsIT {
|
||||
</pre>
|
||||
*/
|
||||
private void deployZookeeper() throws Exception {
|
||||
api.createNamespacedService(NAMESPACE, getZookeeperService(), null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getZookeeperService(), null, null, null, null);
|
||||
V1Deployment deployment = getZookeeperDeployment();
|
||||
String[] image = K8SUtils.getImageFromDeployment(deployment).split(":");
|
||||
Commons.pullImage(image[0], image[1], K3S);
|
||||
Commons.loadImage(image[0], image[1], "zookeeper", K3S);
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, deployment, null, null, null);
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, deployment, null, null, null, null);
|
||||
}
|
||||
|
||||
private V1Deployment getZookeeperDeployment() throws Exception {
|
||||
@@ -222,12 +222,12 @@ class ConfigurationWatcherMultipleAppsIT {
|
||||
</pre>
|
||||
*/
|
||||
private void deployKafka() throws Exception {
|
||||
api.createNamespacedService(NAMESPACE, getKafkaService(), null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getKafkaService(), null, null, null, null);
|
||||
V1Deployment deployment = getKafkaDeployment();
|
||||
String[] image = K8SUtils.getImageFromDeployment(deployment).split(":");
|
||||
Commons.pullImage(image[0], image[1], K3S);
|
||||
Commons.loadImage(image[0], image[1], "kafka", K3S);
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getKafkaDeployment(), null, null, null);
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getKafkaDeployment(), null, null, null, null);
|
||||
}
|
||||
|
||||
private V1Deployment getKafkaDeployment() throws Exception {
|
||||
@@ -247,8 +247,8 @@ class ConfigurationWatcherMultipleAppsIT {
|
||||
</pre>
|
||||
*/
|
||||
private void deployAppA() throws Exception {
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getAppADeployment(), null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getAppAService(), null, null, null);
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getAppADeployment(), null, null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getAppAService(), null, null, null, null);
|
||||
}
|
||||
|
||||
private V1Deployment getAppADeployment() throws Exception {
|
||||
@@ -272,8 +272,8 @@ class ConfigurationWatcherMultipleAppsIT {
|
||||
</pre>
|
||||
*/
|
||||
private void deployAppB() throws Exception {
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getAppBDeployment(), null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getAppBService(), null, null, null);
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getAppBDeployment(), null, null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getAppBService(), null, null, null, null);
|
||||
}
|
||||
|
||||
private V1Deployment getAppBDeployment() throws Exception {
|
||||
@@ -297,8 +297,8 @@ class ConfigurationWatcherMultipleAppsIT {
|
||||
</pre>
|
||||
*/
|
||||
private void deployConfigWatcher() throws Exception {
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getConfigWatcherDeployment(), null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getConfigWatcherService(), null, null, null);
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getConfigWatcherDeployment(), null, null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getConfigWatcherService(), null, null, null, null);
|
||||
}
|
||||
|
||||
private V1Deployment getConfigWatcherDeployment() throws Exception {
|
||||
@@ -327,7 +327,7 @@ class ConfigurationWatcherMultipleAppsIT {
|
||||
V1Ingress ingress = (V1Ingress) K8SUtils.readYamlFromClasspath(
|
||||
"ingress/spring-cloud-kubernetes-configuration-watcher-multiple-apps-ingress.yaml");
|
||||
|
||||
networkingApi.createNamespacedIngress(NAMESPACE, ingress, null, null, null);
|
||||
networkingApi.createNamespacedIngress(NAMESPACE, ingress, null, null, null, null);
|
||||
k8SUtils.waitForIngress(ingress.getMetadata().getName(), NAMESPACE);
|
||||
}
|
||||
|
||||
|
||||
@@ -269,16 +269,16 @@ class ConfigMapEventReloadIT {
|
||||
|
||||
V1ConfigMap leftConfigMap = leftConfigMap();
|
||||
leftConfigMapName = leftConfigMap.getMetadata().getName();
|
||||
api.createNamespacedConfigMap("left", leftConfigMap, null, null, null);
|
||||
api.createNamespacedConfigMap("left", leftConfigMap, null, null, null, null);
|
||||
|
||||
V1ConfigMap rightConfigMap = rightConfigMap();
|
||||
rightConfigMapName = rightConfigMap.getMetadata().getName();
|
||||
api.createNamespacedConfigMap("right", rightConfigMap, null, null, null);
|
||||
api.createNamespacedConfigMap("right", rightConfigMap, null, null, null, null);
|
||||
|
||||
if ("three".equals(deploymentRoot)) {
|
||||
V1ConfigMap rightWithLabelConfigMap = rightWithLabelConfigMap();
|
||||
rightWithLabelConfigMapName = rightWithLabelConfigMap.getMetadata().getName();
|
||||
api.createNamespacedConfigMap("right", rightWithLabelConfigMap, null, null, null);
|
||||
api.createNamespacedConfigMap("right", rightWithLabelConfigMap, null, null, null, null);
|
||||
}
|
||||
|
||||
V1Deployment deployment = getDeployment(deploymentRoot);
|
||||
@@ -286,15 +286,15 @@ class ConfigMapEventReloadIT {
|
||||
String currentImage = deployment.getSpec().getTemplate().getSpec().getContainers().get(0).getImage();
|
||||
deployment.getSpec().getTemplate().getSpec().getContainers().get(0).setImage(currentImage + ":" + version);
|
||||
deploymentName = deployment.getMetadata().getName();
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, deployment, null, null, null);
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, deployment, null, null, null, null);
|
||||
|
||||
V1Service service = getService();
|
||||
serviceName = service.getMetadata().getName();
|
||||
api.createNamespacedService(NAMESPACE, service, null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, service, null, null, null, null);
|
||||
|
||||
V1Ingress ingress = getIngress();
|
||||
ingressName = ingress.getMetadata().getName();
|
||||
networkingApi.createNamespacedIngress(NAMESPACE, ingress, null, null, null);
|
||||
networkingApi.createNamespacedIngress(NAMESPACE, ingress, null, null, null, null);
|
||||
|
||||
k8SUtils.waitForIngress(ingressName, NAMESPACE);
|
||||
k8SUtils.waitForDeployment("spring-cloud-kubernetes-client-configmap-deployment-event-reload", NAMESPACE);
|
||||
@@ -362,7 +362,7 @@ class ConfigMapEventReloadIT {
|
||||
|
||||
@SuppressWarnings({ "unchecked", "raw" })
|
||||
private static void replaceConfigMap(V1ConfigMap configMap, String name) throws ApiException {
|
||||
api.replaceNamespacedConfigMap(name, "right", configMap, null, null, null);
|
||||
api.replaceNamespacedConfigMap(name, "right", configMap, null, null, null, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -142,20 +142,20 @@ class LoadBalancerIT {
|
||||
}
|
||||
|
||||
private void deployLoadbalancerServiceIt() throws Exception {
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getLoadbalancerServiceItDeployment(), null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getLoadbalancerItService(), null, null, null);
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getLoadbalancerServiceItDeployment(), null, null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getLoadbalancerItService(), null, null, null, null);
|
||||
deployIngress();
|
||||
}
|
||||
|
||||
private void deployLoadbalancerPodIt() throws Exception {
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getLoadbalancerPodItDeployment(), null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getLoadbalancerItService(), null, null, null);
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getLoadbalancerPodItDeployment(), null, null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getLoadbalancerItService(), null, null, null, null);
|
||||
deployIngress();
|
||||
}
|
||||
|
||||
private void deployIngress() throws Exception {
|
||||
V1Ingress ingress = getLoadbalancerItIngress();
|
||||
networkingApi.createNamespacedIngress(NAMESPACE, ingress, null, null, null);
|
||||
networkingApi.createNamespacedIngress(NAMESPACE, ingress, null, null, null, null);
|
||||
k8SUtils.waitForIngress(ingress.getMetadata().getName(), NAMESPACE);
|
||||
}
|
||||
|
||||
|
||||
@@ -157,13 +157,13 @@ class ReactiveDiscoveryClientIT {
|
||||
}
|
||||
|
||||
private void deployIngress(V1Ingress ingress) throws Exception {
|
||||
networkingApi.createNamespacedIngress(NAMESPACE, ingress, null, null, null);
|
||||
networkingApi.createNamespacedIngress(NAMESPACE, ingress, null, null, null, null);
|
||||
k8SUtils.waitForIngress(ingress.getMetadata().getName(), NAMESPACE);
|
||||
}
|
||||
|
||||
private void deployReactiveDiscoveryIt() throws Exception {
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getReactiveDiscoveryItDeployment(), null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getReactiveDiscoveryService(), null, null, null);
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getReactiveDiscoveryItDeployment(), null, null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getReactiveDiscoveryService(), null, null, null, null);
|
||||
deployIngress(getReactiveDiscoveryItIngress());
|
||||
}
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ class ConfigurationWatcherMultipleAppIT {
|
||||
"spring-cloud-kubernetes-client-configuration-watcher-secret-app-a, "
|
||||
+ "spring-cloud-kubernetes-client-configuration-watcher-secret-app-b")
|
||||
.endMetadata().build();
|
||||
api.createNamespacedSecret(NAMESPACE, secret, null, null, null);
|
||||
api.createNamespacedSecret(NAMESPACE, secret, null, null, null, null);
|
||||
|
||||
WebClient.Builder builderA = builder();
|
||||
WebClient serviceClientA = builderA.baseUrl("http://localhost:80/app-a").build();
|
||||
@@ -185,12 +185,12 @@ class ConfigurationWatcherMultipleAppIT {
|
||||
</pre>
|
||||
*/
|
||||
private void deployRabbitMq() throws Exception {
|
||||
api.createNamespacedService(NAMESPACE, getRabbitMqService(), null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getRabbitMqService(), null, null, null, null);
|
||||
String[] image = getRabbitMQReplicationController().getSpec().getTemplate().getSpec().getContainers().get(0)
|
||||
.getImage().split(":");
|
||||
Commons.pullImage(image[0], image[1], K3S);
|
||||
Commons.loadImage(image[0], image[1], "rabbitmq", K3S);
|
||||
api.createNamespacedReplicationController(NAMESPACE, getRabbitMQReplicationController(), null, null, null);
|
||||
api.createNamespacedReplicationController(NAMESPACE, getRabbitMQReplicationController(), null, null, null, null);
|
||||
}
|
||||
|
||||
private V1ReplicationController getRabbitMQReplicationController() throws Exception {
|
||||
@@ -210,8 +210,8 @@ class ConfigurationWatcherMultipleAppIT {
|
||||
</pre>
|
||||
*/
|
||||
private void deployAppA() throws Exception {
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getAppADeployment(), null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getAppAService(), null, null, null);
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getAppADeployment(), null, null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getAppAService(), null, null, null, null);
|
||||
}
|
||||
|
||||
private V1Deployment getAppADeployment() throws Exception {
|
||||
@@ -235,8 +235,8 @@ class ConfigurationWatcherMultipleAppIT {
|
||||
</pre>
|
||||
*/
|
||||
private void deployAppB() throws Exception {
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getAppBDeployment(), null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getAppBService(), null, null, null);
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getAppBDeployment(), null, null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getAppBService(), null, null, null, null);
|
||||
}
|
||||
|
||||
private V1Deployment getAppBDeployment() throws Exception {
|
||||
@@ -260,8 +260,8 @@ class ConfigurationWatcherMultipleAppIT {
|
||||
</pre>
|
||||
*/
|
||||
private void deployConfigWatcher() throws Exception {
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getConfigWatcherDeployment(), null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getConfigWatcherService(), null, null, null);
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getConfigWatcherDeployment(), null, null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getConfigWatcherService(), null, null, null, null);
|
||||
}
|
||||
|
||||
private V1Deployment getConfigWatcherDeployment() throws Exception {
|
||||
@@ -290,7 +290,7 @@ class ConfigurationWatcherMultipleAppIT {
|
||||
V1Ingress ingress = (V1Ingress) K8SUtils.readYamlFromClasspath(
|
||||
"ingress/spring-cloud-kubernetes-configuration-watcher-multiple-apps-ingress.yaml");
|
||||
|
||||
networkingApi.createNamespacedIngress(NAMESPACE, ingress, null, null, null);
|
||||
networkingApi.createNamespacedIngress(NAMESPACE, ingress, null, null, null, null);
|
||||
k8SUtils.waitForIngress(ingress.getMetadata().getName(), NAMESPACE);
|
||||
}
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ class SecretsEventReloadIT {
|
||||
Map<String, byte[]> secretData = v1Secret.getData();
|
||||
secretData.replace("application.properties", "from.properties.key: after-change".getBytes());
|
||||
v1Secret.setData(secretData);
|
||||
api.replaceNamespacedSecret("event-reload", NAMESPACE, v1Secret, null, null, null);
|
||||
api.replaceNamespacedSecret("event-reload", NAMESPACE, v1Secret, null, null, null, null);
|
||||
|
||||
Awaitility.await().timeout(Duration.ofSeconds(120)).pollInterval(Duration.ofSeconds(2))
|
||||
.until(() -> secretClient.method(HttpMethod.GET).retrieve().bodyToMono(String.class)
|
||||
@@ -129,12 +129,12 @@ class SecretsEventReloadIT {
|
||||
|
||||
private static void deployConfigK8sClientIt() throws Exception {
|
||||
k8SUtils.waitForDeploymentToBeDeleted(SPRING_CLOUD_CLIENT_CONFIG_IT_DEPLOYMENT_NAME, NAMESPACE);
|
||||
api.createNamespacedSecret(NAMESPACE, getConfigK8sClientItCSecret(), null, null, null);
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getConfigK8sClientItDeployment(), null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getConfigK8sClientItService(), null, null, null);
|
||||
api.createNamespacedSecret(NAMESPACE, getConfigK8sClientItCSecret(), null, null, null, null);
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getConfigK8sClientItDeployment(), null, null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getConfigK8sClientItService(), null, null, null, null);
|
||||
|
||||
V1Ingress ingress = getConfigK8sClientItIngress();
|
||||
networkingApi.createNamespacedIngress(NAMESPACE, ingress, null, null, null);
|
||||
networkingApi.createNamespacedIngress(NAMESPACE, ingress, null, null, null, null);
|
||||
k8SUtils.waitForIngress(ingress.getMetadata().getName(), NAMESPACE);
|
||||
}
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ class ActuatorRefreshIT {
|
||||
// Create new configmap to trigger controller to signal app to refresh
|
||||
V1ConfigMap configMap = new V1ConfigMapBuilder().editOrNewMetadata().withName("servicea-wiremock")
|
||||
.addToLabels("spring.cloud.kubernetes.config", "true").endMetadata().addToData("foo", "bar").build();
|
||||
api.createNamespacedConfigMap(NAMESPACE, configMap, null, null, null);
|
||||
api.createNamespacedConfigMap(NAMESPACE, configMap, null, null, null, null);
|
||||
|
||||
// Wait a bit before we verify
|
||||
await().atMost(Duration.ofSeconds(30))
|
||||
@@ -141,9 +141,9 @@ class ActuatorRefreshIT {
|
||||
private void deployConfigWatcher() throws Exception {
|
||||
V1ConfigMap configMap = getConfigWatcherConfigMap();
|
||||
configWatcherConfigMapName = configMap.getMetadata().getName();
|
||||
api.createNamespacedConfigMap(NAMESPACE, configMap, null, null, null);
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getConfigWatcherDeployment(), null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getConfigWatcherService(), null, null, null);
|
||||
api.createNamespacedConfigMap(NAMESPACE, configMap, null, null, null, null);
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getConfigWatcherDeployment(), null, null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getConfigWatcherService(), null, null, null, null);
|
||||
|
||||
// Check to make sure the controller deployment is ready
|
||||
k8SUtils.waitForDeployment(SPRING_CLOUD_K8S_CONFIG_WATCHER_DEPLOYMENT_NAME, NAMESPACE);
|
||||
|
||||
@@ -146,7 +146,7 @@ class ActuatorRefreshKafkaIT {
|
||||
V1ConfigMap configMap = new V1ConfigMapBuilder().editOrNewMetadata().withName(CONFIG_WATCHER_IT_IMAGE)
|
||||
.addToLabels("spring.cloud.kubernetes.config", "true").endMetadata().addToData("foo", "hello world")
|
||||
.build();
|
||||
api.createNamespacedConfigMap(NAMESPACE, configMap, null, null, null);
|
||||
api.createNamespacedConfigMap(NAMESPACE, configMap, null, null, null, null);
|
||||
|
||||
WebClient.Builder builder = builder();
|
||||
WebClient serviceClient = builder.baseUrl("http://localhost:80/it").build();
|
||||
@@ -167,36 +167,36 @@ class ActuatorRefreshKafkaIT {
|
||||
}
|
||||
|
||||
private void deployTestApp() throws Exception {
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getItDeployment(), null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getItAppService(), null, null, null);
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getItDeployment(), null, null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getItAppService(), null, null, null, null);
|
||||
|
||||
V1Ingress ingress = getItIngress();
|
||||
networkingApi.createNamespacedIngress(NAMESPACE, ingress, null, null, null);
|
||||
networkingApi.createNamespacedIngress(NAMESPACE, ingress, null, null, null, null);
|
||||
k8SUtils.waitForIngress(ingress.getMetadata().getName(), NAMESPACE);
|
||||
}
|
||||
|
||||
private void deployConfigWatcher() throws Exception {
|
||||
api.createNamespacedConfigMap(NAMESPACE, getConfigWatcherConfigMap(), null, null, null);
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getConfigWatcherDeployment(), null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getConfigWatcherService(), null, null, null);
|
||||
api.createNamespacedConfigMap(NAMESPACE, getConfigWatcherConfigMap(), null, null, null, null);
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getConfigWatcherDeployment(), null, null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getConfigWatcherService(), null, null, null, null);
|
||||
}
|
||||
|
||||
private void deployZookeeper() throws Exception {
|
||||
api.createNamespacedService(NAMESPACE, getZookeeperService(), null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getZookeeperService(), null, null, null, null);
|
||||
V1Deployment deployment = getZookeeperDeployment();
|
||||
String[] image = K8SUtils.getImageFromDeployment(deployment).split(":");
|
||||
Commons.pullImage(image[0], image[1], K3S);
|
||||
Commons.loadImage(image[0], image[1], "zookeeper", K3S);
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, deployment, null, null, null);
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, deployment, null, null, null, null);
|
||||
}
|
||||
|
||||
private void deployKafka() throws Exception {
|
||||
api.createNamespacedService(NAMESPACE, getKafkaService(), null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getKafkaService(), null, null, null, null);
|
||||
V1Deployment deployment = getKafkaDeployment();
|
||||
String[] image = K8SUtils.getImageFromDeployment(deployment).split(":");
|
||||
Commons.pullImage(image[0], image[1], K3S);
|
||||
Commons.loadImage(image[0], image[1], "kafka", K3S);
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getKafkaDeployment(), null, null, null);
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getKafkaDeployment(), null, null, null, null);
|
||||
}
|
||||
|
||||
private void cleanUpKafka() throws Exception {
|
||||
|
||||
@@ -120,7 +120,7 @@ class ActuatorRefreshRabbitMQIT {
|
||||
V1ConfigMap configMap = new V1ConfigMapBuilder().editOrNewMetadata().withName(CONFIG_WATCHER_IT_IMAGE)
|
||||
.addToLabels("spring.cloud.kubernetes.config", "true").endMetadata().addToData("foo", "hello world")
|
||||
.build();
|
||||
api.createNamespacedConfigMap(NAMESPACE, configMap, null, null, null);
|
||||
api.createNamespacedConfigMap(NAMESPACE, configMap, null, null, null, null);
|
||||
|
||||
WebClient.Builder builder = builder();
|
||||
WebClient serviceClient = builder.baseUrl("http://localhost:80/it").build();
|
||||
@@ -170,27 +170,28 @@ class ActuatorRefreshRabbitMQIT {
|
||||
}
|
||||
|
||||
private void deployTestApp() throws Exception {
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getItDeployment(), null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getItAppService(), null, null, null);
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getItDeployment(), null, null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getItAppService(), null, null, null, null);
|
||||
|
||||
V1Ingress ingress = getItIngress();
|
||||
networkingApi.createNamespacedIngress(NAMESPACE, ingress, null, null, null);
|
||||
networkingApi.createNamespacedIngress(NAMESPACE, ingress, null, null, null, null);
|
||||
k8SUtils.waitForIngress(ingress.getMetadata().getName(), NAMESPACE);
|
||||
}
|
||||
|
||||
private void deployConfigWatcher() throws Exception {
|
||||
api.createNamespacedConfigMap(NAMESPACE, getConfigWatcherConfigMap(), null, null, null);
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getConfigWatcherDeployment(), null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getConfigWatcherService(), null, null, null);
|
||||
api.createNamespacedConfigMap(NAMESPACE, getConfigWatcherConfigMap(), null, null, null, null);
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getConfigWatcherDeployment(), null, null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getConfigWatcherService(), null, null, null, null);
|
||||
}
|
||||
|
||||
private void deployRabbitMQ() throws Exception {
|
||||
api.createNamespacedService(NAMESPACE, getRabbitMQService(), null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getRabbitMQService(), null, null, null, null);
|
||||
String[] image = getRabbitMQReplicationController().getSpec().getTemplate().getSpec().getContainers().get(0)
|
||||
.getImage().split(":");
|
||||
Commons.pullImage(image[0], image[1], K3S);
|
||||
Commons.loadImage(image[0], image[1], "rabbitmq", K3S);
|
||||
api.createNamespacedReplicationController(NAMESPACE, getRabbitMQReplicationController(), null, null, null);
|
||||
api.createNamespacedReplicationController(NAMESPACE, getRabbitMQReplicationController(), null, null, null,
|
||||
null);
|
||||
}
|
||||
|
||||
private V1Deployment getConfigWatcherDeployment() throws Exception {
|
||||
|
||||
@@ -153,11 +153,11 @@ class ActuatorEndpointIT {
|
||||
}
|
||||
|
||||
private static void deployCoreK8sClientIt() throws Exception {
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getCoreK8sClientItDeployment(), null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getCoreK8sClientItService(), null, null, null);
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getCoreK8sClientItDeployment(), null, null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getCoreK8sClientItService(), null, null, null, null);
|
||||
|
||||
V1Ingress ingress = getCoreK8sClientItIngress();
|
||||
networkingApi.createNamespacedIngress(NAMESPACE, ingress, null, null, null);
|
||||
networkingApi.createNamespacedIngress(NAMESPACE, ingress, null, null, null, null);
|
||||
k8SUtils.waitForIngress(ingress.getMetadata().getName(), NAMESPACE);
|
||||
}
|
||||
|
||||
|
||||
@@ -228,11 +228,11 @@ class DiscoveryClientFilterNamespaceIT {
|
||||
}
|
||||
|
||||
private void deployDiscoveryIt() throws Exception {
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getDiscoveryItDeployment(), null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getDiscoveryService(), null, null, null);
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getDiscoveryItDeployment(), null, null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getDiscoveryService(), null, null, null, null);
|
||||
|
||||
V1Ingress ingress = getDiscoveryItIngress();
|
||||
networkingApi.createNamespacedIngress(NAMESPACE, ingress, null, null, null);
|
||||
networkingApi.createNamespacedIngress(NAMESPACE, ingress, null, null, null, null);
|
||||
k8SUtils.waitForIngress(ingress.getMetadata().getName(), NAMESPACE);
|
||||
}
|
||||
|
||||
@@ -255,13 +255,13 @@ class DiscoveryClientFilterNamespaceIT {
|
||||
private static void deployDiscoveryServer() throws Exception {
|
||||
|
||||
V1ClusterRoleBinding clusterRoleBinding = getClusterRoleBinding();
|
||||
authApi.createClusterRoleBinding(clusterRoleBinding, null, null, null);
|
||||
authApi.createClusterRoleBinding(clusterRoleBinding, null, null, null, null);
|
||||
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getDiscoveryServerDeployment(), null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getDiscoveryServerService(), null, null, null);
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getDiscoveryServerDeployment(), null, null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getDiscoveryServerService(), null, null, null, null);
|
||||
|
||||
V1Ingress ingress = getDiscoveryServerIngress();
|
||||
networkingApi.createNamespacedIngress(NAMESPACE, ingress, null, null, null);
|
||||
networkingApi.createNamespacedIngress(NAMESPACE, ingress, null, null, null, null);
|
||||
k8SUtils.waitForIngress(ingress.getMetadata().getName(), NAMESPACE);
|
||||
}
|
||||
|
||||
@@ -272,20 +272,20 @@ class DiscoveryClientFilterNamespaceIT {
|
||||
meta.setName(namespace);
|
||||
v1Namespace.setMetadata(meta);
|
||||
|
||||
api.createNamespace(v1Namespace, null, null, null);
|
||||
api.createNamespace(v1Namespace, null, null, null, null);
|
||||
|
||||
V1Deployment deployment = getMockServiceDeployment();
|
||||
deployment.getMetadata().setNamespace(namespace);
|
||||
|
||||
appsApi.createNamespacedDeployment(namespace, deployment, null, null, null);
|
||||
appsApi.createNamespacedDeployment(namespace, deployment, null, null, null, null);
|
||||
V1Service service = getMockServiceService();
|
||||
service.getMetadata().setNamespace(namespace);
|
||||
api.createNamespacedService(namespace, service, null, null, null);
|
||||
api.createNamespacedService(namespace, service, null, null, null, null);
|
||||
V1Ingress ingress = getMockIngress();
|
||||
ingress.getMetadata().setNamespace(namespace);
|
||||
|
||||
ingress.getSpec().getRules().get(0).getHttp().getPaths().get(0).setPath("/wiremock-" + namespace);
|
||||
networkingApi.createNamespacedIngress(namespace, ingress, null, null, null);
|
||||
networkingApi.createNamespacedIngress(namespace, ingress, null, null, null, null);
|
||||
k8SUtils.waitForIngress(ingress.getMetadata().getName(), namespace);
|
||||
}
|
||||
|
||||
|
||||
@@ -171,11 +171,11 @@ class DiscoveryClientIT {
|
||||
}
|
||||
|
||||
private void deployDiscoveryIt() throws Exception {
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getDiscoveryItDeployment(), null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getDiscoveryService(), null, null, null);
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getDiscoveryItDeployment(), null, null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getDiscoveryService(), null, null, null, null);
|
||||
|
||||
V1Ingress ingress = getDiscoveryItIngress();
|
||||
networkingApi.createNamespacedIngress(NAMESPACE, ingress, null, null, null);
|
||||
networkingApi.createNamespacedIngress(NAMESPACE, ingress, null, null, null, null);
|
||||
k8SUtils.waitForIngress(ingress.getMetadata().getName(), NAMESPACE);
|
||||
}
|
||||
|
||||
@@ -189,11 +189,11 @@ class DiscoveryClientIT {
|
||||
}
|
||||
|
||||
private static void deployDiscoveryServer() throws Exception {
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getDiscoveryServerDeployment(), null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getDiscoveryServerService(), null, null, null);
|
||||
appsApi.createNamespacedDeployment(NAMESPACE, getDiscoveryServerDeployment(), null, null, null, null);
|
||||
api.createNamespacedService(NAMESPACE, getDiscoveryServerService(), null, null, null, null);
|
||||
|
||||
V1Ingress ingress = getDiscoveryServerIngress();
|
||||
networkingApi.createNamespacedIngress(NAMESPACE, ingress, null, null, null);
|
||||
networkingApi.createNamespacedIngress(NAMESPACE, ingress, null, null, null, null);
|
||||
k8SUtils.waitForIngress(ingress.getMetadata().getName(), NAMESPACE);
|
||||
}
|
||||
|
||||
|
||||
@@ -165,9 +165,9 @@ public class K8SUtils {
|
||||
public V1Service createService(String name, Map<String, String> labels, Map<String, String> specSelectors,
|
||||
String type, String portName, int port, int targetPort, String namespace) throws ApiException {
|
||||
V1Service wiremockService = new V1ServiceBuilder().editOrNewMetadata().withName(name).addToLabels(labels)
|
||||
.endMetadata().editOrNewSpec().addToSelector(specSelectors).withNewType(type).addNewPort()
|
||||
.endMetadata().editOrNewSpec().addToSelector(specSelectors).withType(type).addNewPort()
|
||||
.withName(portName).withPort(port).withNewTargetPort(targetPort).endPort().endSpec().build();
|
||||
return api.createNamespacedService(namespace, wiremockService, null, null, null);
|
||||
return api.createNamespacedService(namespace, wiremockService, null, null, null, null);
|
||||
}
|
||||
|
||||
public V1Deployment createDeployment(String name, Map<String, String> selectorMatchLabels,
|
||||
@@ -182,10 +182,10 @@ public class K8SUtils {
|
||||
.editOrNewSpec().withServiceAccountName(serviceAccountName).addNewContainer().withName(containerName)
|
||||
.withImage(image).withImagePullPolicy(pullPolicy).addNewPort().withContainerPort(containerPort)
|
||||
.endPort().editOrNewReadinessProbe().editOrNewHttpGet().withNewPort(readinessProbePort)
|
||||
.withNewPath(readinessProbePath).endHttpGet().endReadinessProbe().editOrNewLivenessProbe()
|
||||
.editOrNewHttpGet().withNewPort(livenessProbePort).withNewPath(livenessProbePath).endHttpGet()
|
||||
.withPath(readinessProbePath).endHttpGet().endReadinessProbe().editOrNewLivenessProbe()
|
||||
.editOrNewHttpGet().withNewPort(livenessProbePort).withPath(livenessProbePath).endHttpGet()
|
||||
.endLivenessProbe().addAllToEnv(envVars).endContainer().endSpec().endTemplate().endSpec().build();
|
||||
return appsApi.createNamespacedDeployment(namespace, wiremockDeployment, null, null, null);
|
||||
return appsApi.createNamespacedDeployment(namespace, wiremockDeployment, null, null, null, null);
|
||||
|
||||
}
|
||||
|
||||
@@ -231,8 +231,8 @@ public class K8SUtils {
|
||||
public void waitForIngress(String ingressName, String namespace) {
|
||||
await().timeout(Duration.ofSeconds(90)).pollInterval(Duration.ofSeconds(3)).until(() -> {
|
||||
try {
|
||||
V1LoadBalancerStatus status = networkingApi
|
||||
.readNamespacedIngress(ingressName, namespace, null, null, null).getStatus().getLoadBalancer();
|
||||
V1LoadBalancerStatus status = networkingApi.readNamespacedIngress(ingressName, namespace, null)
|
||||
.getStatus().getLoadBalancer();
|
||||
|
||||
if (status == null) {
|
||||
log.info("ingress : " + ingressName + " not ready yet (loadbalancer not yet present)");
|
||||
@@ -266,7 +266,7 @@ public class K8SUtils {
|
||||
public void waitForDeploymentToBeDeleted(String deploymentName, String namespace) {
|
||||
await().timeout(Duration.ofSeconds(90)).until(() -> {
|
||||
try {
|
||||
appsApi.readNamespacedDeployment(deploymentName, namespace, null, null, null);
|
||||
appsApi.readNamespacedDeployment(deploymentName, namespace, null);
|
||||
return false;
|
||||
}
|
||||
catch (ApiException e) {
|
||||
@@ -295,32 +295,32 @@ public class K8SUtils {
|
||||
|
||||
V1ServiceAccount serviceAccount = getConfigK8sClientItServiceAccount();
|
||||
CheckedSupplier<V1ServiceAccount> accountSupplier = () -> api
|
||||
.readNamespacedServiceAccount(serviceAccount.getMetadata().getName(), namespace, null, null, null);
|
||||
.readNamespacedServiceAccount(serviceAccount.getMetadata().getName(), namespace, null);
|
||||
CheckedSupplier<V1ServiceAccount> accountDefaulter = () -> api.createNamespacedServiceAccount(namespace,
|
||||
serviceAccount, null, null, null);
|
||||
serviceAccount, null, null, null, null);
|
||||
notExistsHandler(accountSupplier, accountDefaulter);
|
||||
|
||||
V1RoleBinding roleBinding = getConfigK8sClientItRoleBinding();
|
||||
notExistsHandler(() -> rbacApi.readNamespacedRoleBinding(roleBinding.getMetadata().getName(), namespace, null),
|
||||
() -> rbacApi.createNamespacedRoleBinding(namespace, roleBinding, null, null, null));
|
||||
() -> rbacApi.createNamespacedRoleBinding(namespace, roleBinding, null, null, null, null));
|
||||
|
||||
V1Role role = getConfigK8sClientItRole();
|
||||
notExistsHandler(() -> rbacApi.readNamespacedRole(role.getMetadata().getName(), namespace, null),
|
||||
() -> rbacApi.createNamespacedRole(namespace, role, null, null, null));
|
||||
() -> rbacApi.createNamespacedRole(namespace, role, null, null, null, null));
|
||||
}
|
||||
|
||||
public void setUpClusterWide(String serviceAccountNamespace, Set<String> namespaces) throws Exception {
|
||||
|
||||
V1ServiceAccount serviceAccount = getConfigK8sClientItClusterServiceAccount();
|
||||
CheckedSupplier<V1ServiceAccount> accountSupplier = () -> api.readNamespacedServiceAccount(
|
||||
serviceAccount.getMetadata().getName(), serviceAccountNamespace, null, null, null);
|
||||
CheckedSupplier<V1ServiceAccount> accountSupplier = () -> api
|
||||
.readNamespacedServiceAccount(serviceAccount.getMetadata().getName(), serviceAccountNamespace, null);
|
||||
CheckedSupplier<V1ServiceAccount> accountDefaulter = () -> api
|
||||
.createNamespacedServiceAccount(serviceAccountNamespace, serviceAccount, null, null, null);
|
||||
.createNamespacedServiceAccount(serviceAccountNamespace, serviceAccount, null, null, null, null);
|
||||
notExistsHandler(accountSupplier, accountDefaulter);
|
||||
|
||||
V1ClusterRole clusterRole = getConfigK8sClientItClusterRole();
|
||||
notExistsHandler(() -> rbacApi.readClusterRole(clusterRole.getMetadata().getName(), null),
|
||||
() -> rbacApi.createClusterRole(clusterRole, null, null, null));
|
||||
() -> rbacApi.createClusterRole(clusterRole, null, null, null, null));
|
||||
|
||||
V1RoleBinding roleBinding = getConfigK8sClientItClusterRoleBinding();
|
||||
namespaces.forEach(namespace -> {
|
||||
@@ -328,7 +328,7 @@ public class K8SUtils {
|
||||
try {
|
||||
notExistsHandler(
|
||||
() -> rbacApi.readNamespacedRoleBinding(roleBinding.getMetadata().getName(), namespace, null),
|
||||
() -> rbacApi.createNamespacedRoleBinding(namespace, roleBinding, null, null, null));
|
||||
() -> rbacApi.createNamespacedRoleBinding(namespace, roleBinding, null, null, null, null));
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
@@ -421,8 +421,8 @@ public class K8SUtils {
|
||||
String[] image = getImageFromDeployment(deployment).split(":", 2);
|
||||
Commons.pullImage(image[0], image[1], container);
|
||||
Commons.loadImage(image[0], image[1], "wiremock", container);
|
||||
appsApi.createNamespacedDeployment(namespace, getWiremockDeployment(), null, null, null);
|
||||
api.createNamespacedService(namespace, getWiremockAppService(), null, null, null);
|
||||
appsApi.createNamespacedDeployment(namespace, getWiremockDeployment(), null, null, null, null);
|
||||
api.createNamespacedService(namespace, getWiremockAppService(), null, null, null, null);
|
||||
|
||||
V1Ingress ingress;
|
||||
if (rootPath) {
|
||||
@@ -432,7 +432,7 @@ public class K8SUtils {
|
||||
ingress = getWiremockIngress();
|
||||
}
|
||||
|
||||
networkingApi.createNamespacedIngress(namespace, ingress, null, null, null);
|
||||
networkingApi.createNamespacedIngress(namespace, ingress, null, null, null, null);
|
||||
waitForIngress(ingress.getMetadata().getName(), namespace);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user