Skip to content

Commit

Permalink
Upgrade to Fabric8 6.7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanjbaxter committed Jun 21, 2023
1 parent a0dcdbf commit 56fc089
Show file tree
Hide file tree
Showing 28 changed files with 106 additions and 103 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public record KubernetesClientProperties(Boolean trustCerts, String masterUrl, S
String caCertFile, String caCertData, String clientCertFile, String clientCertData, String clientKeyFile,
String clientKeyData, String clientKeyAlgo, String clientKeyPassphrase, String username, String password,
Duration watchReconnectInterval, Duration watchReconnectLimit, Duration connectionTimeout,
Duration requestTimeout, Duration rollingTimeout, Duration loggingInterval, String httpProxy, String httpsProxy,
Duration requestTimeout, @Deprecated(forRemoval = true) Duration rollingTimeout, Duration loggingInterval, String httpProxy, String httpsProxy,
String proxyUsername, String proxyPassword, String oauthToken, String[] noProxy,
@DefaultValue(SERVICE_ACCOUNT_NAMESPACE_PATH) String serviceAccountNamespacePath,
@DefaultValue(DEFAULT_USER_AGENT) String userAgent) {
Expand Down
2 changes: 1 addition & 1 deletion spring-cloud-kubernetes-dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<description>Spring Cloud Kubernetes Dependencies</description>
<properties>
<hoverfly.version>0.13.0</hoverfly.version>
<kubernetes-fabric8-client.version>6.2.0</kubernetes-fabric8-client.version>
<kubernetes-fabric8-client.version>6.7.2</kubernetes-fabric8-client.version>
<kubernetes-native-client.version>17.0.2</kubernetes-native-client.version>
<wiremock.version>2.26.3</wiremock.version>
<commons.collections4.version>4.4</commons.collections4.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,14 @@ public Config kubernetesClientConfig(KubernetesClientProperties kubernetesClient
orDurationInt(kubernetesClientProperties.connectionTimeout(), base.getConnectionTimeout()))
.withRequestTimeout(
orDurationInt(kubernetesClientProperties.requestTimeout(), base.getRequestTimeout()))
.withRollingTimeout(
orDurationLong(kubernetesClientProperties.rollingTimeout(), base.getRollingTimeout()))
.withTrustCerts(or(kubernetesClientProperties.trustCerts(), base.isTrustCerts()))
.withHttpProxy(or(kubernetesClientProperties.httpProxy(), base.getHttpProxy()))
.withHttpsProxy(or(kubernetesClientProperties.httpsProxy(), base.getHttpsProxy()))
.withProxyUsername(or(kubernetesClientProperties.proxyUsername(), base.getProxyUsername()))
.withProxyPassword(or(kubernetesClientProperties.proxyPassword(), base.getProxyPassword()))
.withNoProxy(or(kubernetesClientProperties.noProxy(), base.getNoProxy()));
.withNoProxy(or(kubernetesClientProperties.noProxy(), base.getNoProxy()))
// Disable the built-in retry functionality since Spring Cloud Kubernetes provides it
.withRequestRetryBackoffLimit(0);

String userAgent = or(base.getUserAgent(), KubernetesClientProperties.DEFAULT_USER_AGENT);
if (!kubernetesClientProperties.userAgent().equals(KubernetesClientProperties.DEFAULT_USER_AGENT)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Fabric8UserAgentDefaultConfigurationTests {
@Test
void testUserAgent() {
String userAgent = client.getConfiguration().getUserAgent();
assertThat(userAgent).isEqualTo("fabric8-kubernetes-client/6.2.0");
assertThat(userAgent).isEqualTo("fabric8-kubernetes-client/6.7.2");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void locateShouldThrowExceptionOnFailureWhenFailFastIsEnabled() {
configMapConfigProperties, new KubernetesNamespaceProvider(new MockEnvironment()));

assertThatThrownBy(() -> locator.locate(new MockEnvironment())).isInstanceOf(IllegalStateException.class)
.hasMessageContaining("api/v1/namespaces/default/configmaps. Message: Internal Server Error.");
.hasMessageContaining("api/v1/namespaces/default/configmaps. Message: Not Found.");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void constructorShouldThrowExceptionOnFailureWhenFailFastIsEnabled() {
NormalizedSource source = new NamedConfigMapNormalizedSource(name, namespace, true, DEFAULT, true);
Fabric8ConfigContext context = new Fabric8ConfigContext(mockClient, source, "default", new MockEnvironment());
assertThatThrownBy(() -> new Fabric8ConfigMapPropertySource(context)).isInstanceOf(IllegalStateException.class)
.hasMessageContaining("v1/namespaces/default/configmaps. Message: Internal Server Error.");
.hasMessageContaining("v1/namespaces/default/configmaps. Message: Not Found.");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void locateShouldThrowExceptionOnFailureWhenFailFastIsEnabled() {
configMapConfigProperties, new KubernetesNamespaceProvider(new MockEnvironment()));

assertThatThrownBy(() -> locator.locate(new MockEnvironment())).isInstanceOf(IllegalStateException.class)
.hasMessageContaining("v1/namespaces/default/secrets. Message: Internal Server Error.");
.hasMessageContaining("v1/namespaces/default/secrets. Message: Not Found.");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void labeledStrategyShouldThrowExceptionOnFailureWhenFailFastIsEnabled() {

mockServer.expect().withPath(path).andReturn(500, "Internal Server Error").once();
assertThatThrownBy(() -> new Fabric8SecretsPropertySource(context)).isInstanceOf(IllegalStateException.class)
.hasMessageContaining("api/v1/namespaces/default/secrets. Message: Internal Server Error.");
.hasMessageContaining("api/v1/namespaces/default/secrets. Message: Not Found.");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,10 @@ private static void app(boolean useEndpointSlices, Phase phase) {
InputStream ingressStream = util.inputStream("app/watcher-ingress.yaml");

Deployment deployment = useEndpointSlices
? client.apps().deployments().load(endpointSlicesDeploymentStream).get()
: client.apps().deployments().load(endpointsDeploymentStream).get();
Service service = client.services().load(serviceStream).get();
Ingress ingress = client.network().v1().ingresses().load(ingressStream).get();
? client.apps().deployments().load(endpointSlicesDeploymentStream).item()
: client.apps().deployments().load(endpointsDeploymentStream).item();
Service service = client.services().load(serviceStream).item();
Ingress ingress = client.network().v1().ingresses().load(ingressStream).item();

if (phase.equals(Phase.CREATE)) {
util.createAndWait(Fabric8CatalogWatchIT.NAMESPACE, null, deployment, service, ingress, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@ private static void app(boolean useEndpointSlices, Phase phase) {
InputStream ingressStream = util.inputStream("app/watcher-ingress.yaml");

Deployment deployment = useEndpointSlices
? client.apps().deployments().load(endpointSlicesDeploymentStream).get()
: client.apps().deployments().load(endpointsDeploymentStream).get();
? client.apps().deployments().load(endpointSlicesDeploymentStream).item()
: client.apps().deployments().load(endpointsDeploymentStream).item();

List<EnvVar> envVars = new ArrayList<>(
deployment.getSpec().getTemplate().getSpec().getContainers().get(0).getEnv());
Expand All @@ -232,8 +232,8 @@ private static void app(boolean useEndpointSlices, Phase phase) {

deployment.getSpec().getTemplate().getSpec().getContainers().get(0).setEnv(envVars);

Service service = client.services().load(serviceStream).get();
Ingress ingress = client.network().v1().ingresses().load(ingressStream).get();
Service service = client.services().load(serviceStream).item();
Ingress ingress = client.network().v1().ingresses().load(ingressStream).item();

if (phase.equals(Phase.CREATE)) {
util.createAndWait(Fabric8CatalogWatchWithNamespacesIT.NAMESPACE_DEFAULT, null, deployment, service,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ private static void manifests(String activeProfile, Phase phase, boolean secrets
InputStream rightConfigMapStream = util.inputStream("right-configmap.yaml");
InputStream rightWithLabelConfigMapStream = util.inputStream("right-configmap-with-label.yaml");

Deployment deployment = client.apps().deployments().load(deploymentStream).get();
Deployment deployment = client.apps().deployments().load(deploymentStream).item();

List<EnvVar> envVars = new ArrayList<>(
deployment.getSpec().getTemplate().getSpec().getContainers().get(0).getEnv());
Expand All @@ -311,11 +311,11 @@ private static void manifests(String activeProfile, Phase phase, boolean secrets

deployment.getSpec().getTemplate().getSpec().getContainers().get(0).setEnv(envVars);

Service service = client.services().load(serviceStream).get();
Ingress ingress = client.network().v1().ingresses().load(ingressStream).get();
ConfigMap leftConfigMap = client.configMaps().load(leftConfigMapStream).get();
ConfigMap rightConfigMap = client.configMaps().load(rightConfigMapStream).get();
ConfigMap rightWithLabelConfigMap = client.configMaps().load(rightWithLabelConfigMapStream).get();
Service service = client.services().load(serviceStream).item();
Ingress ingress = client.network().v1().ingresses().load(ingressStream).item();
ConfigMap leftConfigMap = client.configMaps().load(leftConfigMapStream).item();
ConfigMap rightConfigMap = client.configMaps().load(rightConfigMapStream).item();
ConfigMap rightWithLabelConfigMap = client.configMaps().load(rightWithLabelConfigMapStream).item();

if (phase.equals(Phase.CREATE)) {
util.createAndWait("left", leftConfigMap, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ private static void manifests(Phase phase) {
InputStream ingressStream = util.inputStream("ingress.yaml");
InputStream configmapAsStream = util.inputStream("left-configmap.yaml");

Deployment deployment = client.apps().deployments().load(deploymentStream).get();
Deployment deployment = client.apps().deployments().load(deploymentStream).item();

List<EnvVar> envVars = new ArrayList<>(
deployment.getSpec().getTemplate().getSpec().getContainers().get(0).getEnv());
Expand All @@ -171,9 +171,9 @@ private static void manifests(Phase phase) {
envVars.add(secretsDisabledEnvVar);
deployment.getSpec().getTemplate().getSpec().getContainers().get(0).setEnv(envVars);

Service service = client.services().load(serviceStream).get();
Ingress ingress = client.network().v1().ingresses().load(ingressStream).get();
ConfigMap configMap = client.configMaps().load(configmapAsStream).get();
Service service = client.services().load(serviceStream).item();
Ingress ingress = client.network().v1().ingresses().load(ingressStream).item();
ConfigMap configMap = client.configMaps().load(configmapAsStream).item();

if (phase.equals(Phase.CREATE)) {
util.createAndWait(LEFT_NAMESPACE, configMap, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ void test() {
// replace data in configmap and wait for k8s to pick it up
// our polling will detect that and restart the app
InputStream configMapStream = util.inputStream("mount/configmap-mount.yaml");
ConfigMap configMap = client.configMaps().load(configMapStream).get();
ConfigMap configMap = client.configMaps().load(configMapStream).item();
configMap.setData(Map.of("application.properties", "from.properties.key=as-mount-changed"));
client.configMaps().inNamespace("default").resource(configMap).createOrReplace();

Expand All @@ -126,10 +126,10 @@ private static void manifests(Phase phase) {
InputStream ingressStream = util.inputStream("ingress.yaml");
InputStream configMapStream = util.inputStream("mount/configmap-mount.yaml");

Deployment deployment = client.apps().deployments().load(deploymentStream).get();
Service service = client.services().load(serviceStream).get();
Ingress ingress = client.network().v1().ingresses().load(ingressStream).get();
ConfigMap configMap = client.configMaps().load(configMapStream).get();
Deployment deployment = client.apps().deployments().load(deploymentStream).item();
Service service = client.services().load(serviceStream).item();
Ingress ingress = client.network().v1().ingresses().load(ingressStream).item();
ConfigMap configMap = client.configMaps().load(configMapStream).item();

List<EnvVar> existing = new ArrayList<>(
deployment.getSpec().getTemplate().getSpec().getContainers().get(0).getEnv());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ private static void manifests(Phase phase) {
InputStream ingressStream = util.inputStream("ingress.yaml");
InputStream configMapStream = util.inputStream("configmap.yaml");

Deployment deployment = client.apps().deployments().load(deploymentStream).get();
Service service = client.services().load(serviceStream).get();
Ingress ingress = client.network().v1().ingresses().load(ingressStream).get();
ConfigMap configMap = client.configMaps().load(configMapStream).get();
Deployment deployment = client.apps().deployments().load(deploymentStream).item();
Service service = client.services().load(serviceStream).item();
Ingress ingress = client.network().v1().ingresses().load(ingressStream).item();
ConfigMap configMap = client.configMaps().load(configMapStream).item();

List<EnvVar> existing = new ArrayList<>(
deployment.getSpec().getTemplate().getSpec().getContainers().get(0).getEnv());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ void test() {
// replace data in configmap and wait for k8s to pick it up
// our polling will detect that and restart the app
InputStream configMapStream = util.inputStream("mount/configmap-mount.yaml");
ConfigMap configMap = client.configMaps().load(configMapStream).get();
ConfigMap configMap = client.configMaps().load(configMapStream).item();
configMap.setData(Map.of("application.properties", "from.properties.key=as-mount-changed"));
client.configMaps().inNamespace("default").resource(configMap).createOrReplace();

Expand All @@ -130,10 +130,10 @@ private static void manifests(Phase phase) {
InputStream ingressStream = util.inputStream("ingress.yaml");
InputStream configMapStream = util.inputStream("mount/configmap-mount.yaml");

Deployment deployment = client.apps().deployments().load(deploymentStream).get();
Service service = client.services().load(serviceStream).get();
Ingress ingress = client.network().v1().ingresses().load(ingressStream).get();
ConfigMap configMap = client.configMaps().load(configMapStream).get();
Deployment deployment = client.apps().deployments().load(deploymentStream).item();
Service service = client.services().load(serviceStream).item();
Ingress ingress = client.network().v1().ingresses().load(ingressStream).item();
ConfigMap configMap = client.configMaps().load(configMapStream).item();

List<EnvVar> existing = new ArrayList<>(
deployment.getSpec().getTemplate().getSpec().getContainers().get(0).getEnv());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ private static void manifests(Phase phase) {
InputStream ingressStream = util.inputStream("fabric8-ingress.yaml");
InputStream configMapStream = util.inputStream("fabric8-configmap.yaml");

Deployment deployment = client.apps().deployments().load(deploymentStream).get();
Service service = client.services().load(serviceStream).get();
Ingress ingress = client.network().v1().ingresses().load(ingressStream).get();
ConfigMap configMap = client.configMaps().load(configMapStream).get();
Deployment deployment = client.apps().deployments().load(deploymentStream).item();
Service service = client.services().load(serviceStream).item();
Ingress ingress = client.network().v1().ingresses().load(ingressStream).item();
ConfigMap configMap = client.configMaps().load(configMapStream).item();

if (phase.equals(Phase.CREATE)) {
util.createAndWait(NAMESPACE, configMap, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ private static void manifests(Phase phase) {
InputStream serviceStream = util.inputStream("fabric8-discovery-service.yaml");
InputStream ingressStream = util.inputStream("fabric8-discovery-ingress.yaml");

Deployment deployment = client.apps().deployments().load(deploymentStream).get();
Deployment deployment = client.apps().deployments().load(deploymentStream).item();

List<EnvVar> existing = new ArrayList<>(
deployment.getSpec().getTemplate().getSpec().getContainers().get(0).getEnv());
Expand All @@ -117,8 +117,8 @@ private static void manifests(Phase phase) {
.withValue("DEBUG").build());
deployment.getSpec().getTemplate().getSpec().getContainers().get(0).setEnv(existing);

Service service = client.services().load(serviceStream).get();
Ingress ingress = client.network().v1().ingresses().load(ingressStream).get();
Service service = client.services().load(serviceStream).item();
Ingress ingress = client.network().v1().ingresses().load(ingressStream).item();

if (phase.equals(Phase.CREATE)) {
util.createAndWait(NAMESPACE, null, deployment, service, ingress, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ private static void manifests(boolean disableReactive, boolean disableBlocking,
InputStream serviceStream = util.inputStream("fabric8-discovery-service.yaml");
InputStream ingressStream = util.inputStream("fabric8-discovery-ingress.yaml");

Deployment deployment = client.apps().deployments().load(deploymentStream).get();
Deployment deployment = client.apps().deployments().load(deploymentStream).item();
List<EnvVar> envVars = new ArrayList<>(
deployment.getSpec().getTemplate().getSpec().getContainers().get(0).getEnv());

Expand Down Expand Up @@ -264,8 +264,8 @@ private static void manifests(boolean disableReactive, boolean disableBlocking,
envVars.add(debugLevelForReactive);
}

Service service = client.services().load(serviceStream).get();
Ingress ingress = client.network().v1().ingresses().load(ingressStream).get();
Service service = client.services().load(serviceStream).item();
Ingress ingress = client.network().v1().ingresses().load(ingressStream).item();

if (disableBlocking) {
EnvVar disableBlockingEnvVar = new EnvVarBuilder().withName("SPRING_CLOUD_DISCOVERY_BLOCKING_ENABLED")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ private static void manifests(Phase phase, String serviceFilter) {
InputStream serviceStream = util.inputStream("fabric8-discovery-service.yaml");
InputStream ingressStream = util.inputStream("fabric8-discovery-ingress.yaml");

Deployment deployment = client.apps().deployments().load(deploymentStream).get();
Deployment deployment = client.apps().deployments().load(deploymentStream).item();
List<EnvVar> envVars = new ArrayList<>(
deployment.getSpec().getTemplate().getSpec().getContainers().get(0).getEnv());
EnvVar namespaceAUat = new EnvVarBuilder().withName("SPRING_CLOUD_KUBERNETES_DISCOVERY_NAMESPACES_0")
Expand All @@ -221,17 +221,17 @@ private static void manifests(Phase phase, String serviceFilter) {
envVars.add(debug);
deployment.getSpec().getTemplate().getSpec().getContainers().get(0).setEnv(envVars);

Service service = client.services().load(serviceStream).get();
Ingress ingress = client.network().v1().ingresses().load(ingressStream).get();
Service service = client.services().load(serviceStream).item();
Ingress ingress = client.network().v1().ingresses().load(ingressStream).item();

if (phase.equals(Phase.CREATE)) {
client.rbac().clusterRoleBindings().resource(client.rbac().clusterRoleBindings().load(getAdminRole()).get())
.create();
client.rbac().clusterRoleBindings()
.resource(client.rbac().clusterRoleBindings().load(getAdminRole()).item()).create();
util.createAndWait(NAMESPACE, null, deployment, service, ingress, true);
}
else {
client.rbac().clusterRoleBindings().resource(client.rbac().clusterRoleBindings().load(getAdminRole()).get())
.delete();
client.rbac().clusterRoleBindings()
.resource(client.rbac().clusterRoleBindings().load(getAdminRole()).item()).delete();
util.deleteAndWait(NAMESPACE, deployment, service, ingress);
}

Expand Down
Loading

0 comments on commit 56fc089

Please sign in to comment.