Skip to content

Commit 90749fa

Browse files
committed
Merge branch 'main' into simplify-config-data-code-a-bit
2 parents 3dc921a + 8793be8 commit 90749fa

File tree

234 files changed

+4218
-5167
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

234 files changed

+4218
-5167
lines changed

docs/modules/ROOT/pages/spring-cloud-kubernetes-configserver.adoc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ list of namespace values.
2929
NOTE: If you set `spring.cloud.kubernetes.configserver.config-map-namespaces` and/or `spring.cloud.kubernetes.configserver.secrets-namespaces`
3030
you will need to include the namespace in which the Config Server is deployed in order to continue to fetch Config Map and Secret data from that namespace.
3131

32+
### Using Advanced Features Of Spring Vault
33+
In order to use some of the https://docs.spring.io/spring-cloud-config/reference/server/environment-repository/vault-backend.html[more advanced Spring Vault features] of the **Spring Cloud Config Server**, https://mvnrepository.com/artifact/org.springframework.vault/spring-vault-core[`spring-vault-core`] must be on the classpath. By default, Spring Cloud Kubernetes can generate a Docker image for deploying Config Server to Kubernetes, but it does not include `spring-vault-core` in the classpath. If you need `spring-vault-core` to enable certain functionality in the Config Server you can build your own version of Docker image by enabling the `vault` Maven profile when running Maven build.
34+
35+
Example:
36+
```bash
37+
$ ../../mvnw clean install -Pvault
38+
```
39+
3240
### Kubernetes Access Controls
3341
The Kubernetes Config Server uses the Kubernetes API server to fetch Config Map and Secret data. In order for it to do that
3442
it needs ability to `get` and `list` Config Map and Secrets (depending on what you enable/disable).

docs/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"@antora/atlas-extension": "1.0.0-alpha.2",
55
"@antora/collector-extension": "1.0.1",
66
"@asciidoctor/tabs": "1.0.0-beta.6",
7-
"@springio/antora-extensions": "1.14.2",
8-
"@springio/asciidoctor-extensions": "1.0.0-alpha.16"
7+
"@springio/antora-extensions": "1.14.4",
8+
"@springio/asciidoctor-extensions": "1.0.0-alpha.17"
99
}
1010
}

spring-cloud-kubernetes-client-autoconfig/src/main/java/org/springframework/cloud/kubernetes/client/KubernetesClientAutoConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
/**
3636
* @author Ryan Baxter
3737
*/
38-
@Configuration
38+
@Configuration(proxyBeanMethods = false)
3939
@ConditionalOnCloudPlatform(CloudPlatform.KUBERNETES)
4040
@AutoConfigureAfter(KubernetesCommonsAutoConfiguration.class)
4141
public class KubernetesClientAutoConfiguration {

spring-cloud-kubernetes-client-autoconfig/src/test/java/org/springframework/cloud/kubernetes/client/ActuatorDisabledHealthTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package org.springframework.cloud.kubernetes.client;
1818

19-
import org.junit.jupiter.api.Assertions;
19+
import org.assertj.core.api.Assertions;
2020
import org.junit.jupiter.api.Test;
2121

2222
import org.springframework.beans.factory.annotation.Autowired;
@@ -57,8 +57,7 @@ void healthEndpointShouldNotContainKubernetes() {
5757
.jsonPath("components.kubernetes")
5858
.doesNotExist();
5959

60-
Assertions.assertNull(registry.getContributor("kubernetes"),
61-
"reactive kubernetes contributor must NOT be present when 'management.health.kubernetes.enabled=false'");
60+
Assertions.assertThat(registry.getContributor("kubernetes")).isNull();
6261
}
6362

6463
}

spring-cloud-kubernetes-client-autoconfig/src/test/java/org/springframework/cloud/kubernetes/client/ActuatorEnabledFailFastExceptionTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
import io.kubernetes.client.openapi.ApiException;
2424
import io.kubernetes.client.openapi.apis.CoreV1Api;
2525
import io.kubernetes.client.util.Config;
26+
import org.assertj.core.api.Assertions;
2627
import org.junit.jupiter.api.AfterEach;
27-
import org.junit.jupiter.api.Assertions;
2828
import org.junit.jupiter.api.Test;
2929
import org.mockito.MockedStatic;
3030
import org.mockito.Mockito;
@@ -68,7 +68,7 @@ void afterEach() {
6868
@Test
6969
void test() throws ApiException {
7070
Health health = healthIndicator.getHealth(true);
71-
Assertions.assertEquals(health.getStatus(), Status.DOWN);
71+
Assertions.assertThat(Status.DOWN).isSameAs(health.getStatus());
7272
Mockito.verify(coreV1Api).readNamespacedPod("host", "my-namespace", null);
7373
}
7474

spring-cloud-kubernetes-client-autoconfig/src/test/java/org/springframework/cloud/kubernetes/client/ActuatorEnabledHealthTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package org.springframework.cloud.kubernetes.client;
1818

19-
import org.junit.jupiter.api.Assertions;
19+
import org.assertj.core.api.Assertions;
2020
import org.junit.jupiter.api.Test;
2121

2222
import org.springframework.beans.factory.annotation.Autowired;
@@ -54,8 +54,8 @@ void healthEndpointShouldContainKubernetes() {
5454
.jsonPath("components.kubernetes")
5555
.exists();
5656

57-
Assertions.assertNotNull(registry.getContributor("kubernetes"),
58-
"reactive kubernetes contributor must be present when 'management.health.kubernetes.enabled=true'");
57+
Assertions.assertThat(registry.getContributor("kubernetes")).isNotNull();
58+
5959
}
6060

6161
}

spring-cloud-kubernetes-client-autoconfig/src/test/java/org/springframework/cloud/kubernetes/client/ActuatorEnabledNoFailFastExceptionTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
import io.kubernetes.client.openapi.ApiException;
2424
import io.kubernetes.client.openapi.apis.CoreV1Api;
2525
import io.kubernetes.client.util.Config;
26+
import org.assertj.core.api.Assertions;
2627
import org.junit.jupiter.api.AfterEach;
27-
import org.junit.jupiter.api.Assertions;
2828
import org.junit.jupiter.api.Test;
2929
import org.mockito.MockedStatic;
3030
import org.mockito.Mockito;
@@ -71,7 +71,7 @@ void afterEach() {
7171
@Test
7272
void test() throws ApiException {
7373
Health health = healthIndicator.getHealth(true);
74-
Assertions.assertEquals(health.getStatus(), Status.UP);
74+
Assertions.assertThat(Status.UP).isSameAs(health.getStatus());
7575
Mockito.verify(coreV1Api).readNamespacedPod("host", "my-namespace", null);
7676
}
7777

spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/KubernetesClientConfigDataLocationResolverTests.java

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
import io.kubernetes.client.openapi.ApiClient;
2020
import io.kubernetes.client.openapi.apis.CoreV1Api;
21-
import org.junit.jupiter.api.Assertions;
21+
import org.assertj.core.api.Assertions;
2222
import org.junit.jupiter.api.Test;
2323
import org.junit.jupiter.api.extension.ExtendWith;
2424
import org.mockito.Mockito;
@@ -72,15 +72,15 @@ void testBothMissing() {
7272
ConfigDataLocation configDataLocation = ConfigDataLocation.of("kubernetes:abc");
7373
RESOLVER.resolveProfileSpecific(RESOLVER_CONTEXT, configDataLocation, profiles);
7474

75-
Assertions.assertTrue(context.isRegistered(KubernetesClientProperties.class));
76-
Assertions.assertTrue(context.isRegistered(CoreV1Api.class));
77-
Assertions.assertTrue(context.isRegistered(ApiClient.class));
75+
Assertions.assertThat(context.isRegistered(KubernetesClientProperties.class)).isTrue();
76+
Assertions.assertThat(context.isRegistered(CoreV1Api.class)).isTrue();
77+
Assertions.assertThat(context.isRegistered(ApiClient.class)).isTrue();
7878

79-
Assertions.assertFalse(context.isRegistered(ConfigMapConfigProperties.class));
80-
Assertions.assertFalse(context.isRegistered(SecretsConfigProperties.class));
79+
Assertions.assertThat(context.isRegistered(ConfigMapConfigProperties.class)).isFalse();
80+
Assertions.assertThat(context.isRegistered(SecretsConfigProperties.class)).isFalse();
8181

82-
Assertions.assertFalse(context.isRegistered(ConfigMapPropertySourceLocator.class));
83-
Assertions.assertFalse(context.isRegistered(SecretsPropertySourceLocator.class));
82+
Assertions.assertThat(context.isRegistered(ConfigMapPropertySourceLocator.class)).isFalse();
83+
Assertions.assertThat(context.isRegistered(SecretsPropertySourceLocator.class)).isFalse();
8484
}
8585

8686
/*
@@ -108,24 +108,24 @@ void testBothPresent() {
108108
ConfigDataLocation configDataLocation = ConfigDataLocation.of("kubernetes:abc");
109109
RESOLVER.resolveProfileSpecific(RESOLVER_CONTEXT, configDataLocation, profiles);
110110

111-
Assertions.assertTrue(context.isRegistered(KubernetesClientProperties.class));
112-
Assertions.assertTrue(context.isRegistered(CoreV1Api.class));
113-
Assertions.assertTrue(context.isRegistered(ApiClient.class));
111+
Assertions.assertThat(context.isRegistered(KubernetesClientProperties.class)).isTrue();
112+
Assertions.assertThat(context.isRegistered(CoreV1Api.class)).isTrue();
113+
Assertions.assertThat(context.isRegistered(ApiClient.class)).isTrue();
114114

115-
Assertions.assertTrue(context.isRegistered(ConfigMapConfigProperties.class));
116-
Assertions.assertTrue(context.isRegistered(SecretsConfigProperties.class));
115+
Assertions.assertThat(context.isRegistered(ConfigMapConfigProperties.class)).isTrue();
116+
Assertions.assertThat(context.isRegistered(SecretsConfigProperties.class)).isTrue();
117117

118-
Assertions.assertTrue(context.isRegistered(ConfigMapPropertySourceLocator.class));
119-
Assertions.assertTrue(context.isRegistered(SecretsPropertySourceLocator.class));
118+
Assertions.assertThat(context.isRegistered(ConfigMapPropertySourceLocator.class)).isTrue();
119+
Assertions.assertThat(context.isRegistered(SecretsPropertySourceLocator.class)).isTrue();
120120

121121
ConfigMapPropertySourceLocator configMapPropertySourceLocator = context
122122
.get(ConfigMapPropertySourceLocator.class);
123-
Assertions.assertSame(KubernetesClientConfigMapPropertySourceLocator.class,
124-
configMapPropertySourceLocator.getClass());
123+
Assertions.assertThat(configMapPropertySourceLocator.getClass())
124+
.isEqualTo(KubernetesClientConfigMapPropertySourceLocator.class);
125125

126126
SecretsPropertySourceLocator secretsPropertySourceLocator = context.get(SecretsPropertySourceLocator.class);
127-
Assertions.assertSame(KubernetesClientSecretsPropertySourceLocator.class,
128-
secretsPropertySourceLocator.getClass());
127+
Assertions.assertThat(secretsPropertySourceLocator.getClass())
128+
.isEqualTo(KubernetesClientSecretsPropertySourceLocator.class);
129129

130130
}
131131

@@ -155,25 +155,25 @@ void testBothPresentExplicitly(CapturedOutput capturedOutput) {
155155
ConfigDataLocation configDataLocation = ConfigDataLocation.of("kubernetes:abc");
156156
RESOLVER.resolveProfileSpecific(RESOLVER_CONTEXT, configDataLocation, profiles);
157157

158-
Assertions.assertTrue(context.isRegistered(KubernetesClientProperties.class));
159-
Assertions.assertTrue(context.isRegistered(CoreV1Api.class));
160-
Assertions.assertTrue(context.isRegistered(ApiClient.class));
158+
Assertions.assertThat(context.isRegistered(KubernetesClientProperties.class)).isTrue();
159+
Assertions.assertThat(context.isRegistered(CoreV1Api.class)).isTrue();
160+
Assertions.assertThat(context.isRegistered(ApiClient.class)).isTrue();
161161

162-
Assertions.assertTrue(context.isRegistered(ConfigMapConfigProperties.class));
163-
Assertions.assertTrue(context.isRegistered(SecretsConfigProperties.class));
162+
Assertions.assertThat(context.isRegistered(ConfigMapConfigProperties.class)).isTrue();
163+
Assertions.assertThat(context.isRegistered(SecretsConfigProperties.class)).isTrue();
164164

165165
ConfigMapPropertySourceLocator configMapPropertySourceLocator = context
166166
.get(ConfigMapPropertySourceLocator.class);
167-
Assertions.assertSame(KubernetesClientConfigMapPropertySourceLocator.class,
168-
configMapPropertySourceLocator.getClass());
167+
Assertions.assertThat(configMapPropertySourceLocator.getClass())
168+
.isEqualTo(KubernetesClientConfigMapPropertySourceLocator.class);
169169

170170
SecretsPropertySourceLocator secretsPropertySourceLocator = context.get(SecretsPropertySourceLocator.class);
171-
Assertions.assertSame(KubernetesClientSecretsPropertySourceLocator.class,
172-
secretsPropertySourceLocator.getClass());
171+
Assertions.assertThat(secretsPropertySourceLocator.getClass())
172+
.isEqualTo(KubernetesClientSecretsPropertySourceLocator.class);
173173

174-
Assertions.assertTrue(capturedOutput.getOut()
174+
Assertions.assertThat(capturedOutput.getOut())
175175
.contains("Could not create the Kubernetes ApiClient in a cluster environment, because connection port "
176-
+ "was not provided."));
176+
+ "was not provided.");
177177
}
178178

179179
/*
@@ -205,24 +205,24 @@ void testBothPresentAndRetryEnabled() {
205205
ConfigDataLocation configDataLocation = ConfigDataLocation.of("kubernetes:abc");
206206
RESOLVER.resolveProfileSpecific(RESOLVER_CONTEXT, configDataLocation, profiles);
207207

208-
Assertions.assertTrue(context.isRegistered(KubernetesClientProperties.class));
209-
Assertions.assertTrue(context.isRegistered(CoreV1Api.class));
210-
Assertions.assertTrue(context.isRegistered(ApiClient.class));
208+
Assertions.assertThat(context.isRegistered(KubernetesClientProperties.class)).isTrue();
209+
Assertions.assertThat(context.isRegistered(CoreV1Api.class)).isTrue();
210+
Assertions.assertThat(context.isRegistered(ApiClient.class)).isTrue();
211211

212-
Assertions.assertTrue(context.isRegistered(ConfigMapConfigProperties.class));
213-
Assertions.assertTrue(context.isRegistered(SecretsConfigProperties.class));
212+
Assertions.assertThat(context.isRegistered(ConfigMapConfigProperties.class)).isTrue();
213+
Assertions.assertThat(context.isRegistered(SecretsConfigProperties.class)).isTrue();
214214

215-
Assertions.assertTrue(context.isRegistered(ConfigMapPropertySourceLocator.class));
216-
Assertions.assertTrue(context.isRegistered(SecretsPropertySourceLocator.class));
215+
Assertions.assertThat(context.isRegistered(ConfigMapPropertySourceLocator.class)).isTrue();
216+
Assertions.assertThat(context.isRegistered(SecretsPropertySourceLocator.class)).isTrue();
217217

218218
ConfigMapPropertySourceLocator configMapPropertySourceLocator = context
219219
.get(ConfigMapPropertySourceLocator.class);
220-
Assertions.assertSame(ConfigDataRetryableConfigMapPropertySourceLocator.class,
221-
configMapPropertySourceLocator.getClass());
220+
Assertions.assertThat(configMapPropertySourceLocator.getClass())
221+
.isEqualTo(ConfigDataRetryableConfigMapPropertySourceLocator.class);
222222

223223
SecretsPropertySourceLocator secretsPropertySourceLocator = context.get(SecretsPropertySourceLocator.class);
224-
Assertions.assertSame(ConfigDataRetryableSecretsPropertySourceLocator.class,
225-
secretsPropertySourceLocator.getClass());
224+
Assertions.assertThat(secretsPropertySourceLocator.getClass())
225+
.isEqualTo(ConfigDataRetryableSecretsPropertySourceLocator.class);
226226

227227
}
228228

0 commit comments

Comments
 (0)