Skip to content

Commit d993284

Browse files
committed
merge main
Signed-off-by: wind57 <[email protected]>
2 parents 868959d + 8793be8 commit d993284

File tree

234 files changed

+4292
-5138
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

+4292
-5138
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
@@ -20,7 +20,7 @@
2020

2121
import io.kubernetes.client.openapi.ApiClient;
2222
import io.kubernetes.client.openapi.apis.CoreV1Api;
23-
import org.junit.jupiter.api.Assertions;
23+
import org.assertj.core.api.Assertions;
2424
import org.junit.jupiter.api.Test;
2525
import org.junit.jupiter.api.extension.ExtendWith;
2626
import org.mockito.Mockito;
@@ -78,15 +78,15 @@ void testBothMissing() {
7878
ConfigDataLocation configDataLocation = ConfigDataLocation.of("kubernetes:abc");
7979
RESOLVER.resolveProfileSpecific(RESOLVER_CONTEXT, configDataLocation, profiles);
8080

81-
Assertions.assertTrue(context.isRegistered(KubernetesClientProperties.class));
82-
Assertions.assertTrue(context.isRegistered(CoreV1Api.class));
83-
Assertions.assertTrue(context.isRegistered(ApiClient.class));
81+
Assertions.assertThat(context.isRegistered(KubernetesClientProperties.class)).isTrue();
82+
Assertions.assertThat(context.isRegistered(CoreV1Api.class)).isTrue();
83+
Assertions.assertThat(context.isRegistered(ApiClient.class)).isTrue();
8484

85-
Assertions.assertFalse(context.isRegistered(ConfigMapConfigProperties.class));
86-
Assertions.assertFalse(context.isRegistered(SecretsConfigProperties.class));
85+
Assertions.assertThat(context.isRegistered(ConfigMapConfigProperties.class)).isFalse();
86+
Assertions.assertThat(context.isRegistered(SecretsConfigProperties.class)).isFalse();
8787

88-
Assertions.assertFalse(context.isRegistered(ConfigMapPropertySourceLocator.class));
89-
Assertions.assertFalse(context.isRegistered(SecretsPropertySourceLocator.class));
88+
Assertions.assertThat(context.isRegistered(ConfigMapPropertySourceLocator.class)).isFalse();
89+
Assertions.assertThat(context.isRegistered(SecretsPropertySourceLocator.class)).isFalse();
9090
}
9191

9292
/*
@@ -114,24 +114,24 @@ void testBothPresent() {
114114
ConfigDataLocation configDataLocation = ConfigDataLocation.of("kubernetes:abc");
115115
RESOLVER.resolveProfileSpecific(RESOLVER_CONTEXT, configDataLocation, profiles);
116116

117-
Assertions.assertTrue(context.isRegistered(KubernetesClientProperties.class));
118-
Assertions.assertTrue(context.isRegistered(CoreV1Api.class));
119-
Assertions.assertTrue(context.isRegistered(ApiClient.class));
117+
Assertions.assertThat(context.isRegistered(KubernetesClientProperties.class)).isTrue();
118+
Assertions.assertThat(context.isRegistered(CoreV1Api.class)).isTrue();
119+
Assertions.assertThat(context.isRegistered(ApiClient.class)).isTrue();
120120

121-
Assertions.assertTrue(context.isRegistered(ConfigMapConfigProperties.class));
122-
Assertions.assertTrue(context.isRegistered(SecretsConfigProperties.class));
121+
Assertions.assertThat(context.isRegistered(ConfigMapConfigProperties.class)).isTrue();
122+
Assertions.assertThat(context.isRegistered(SecretsConfigProperties.class)).isTrue();
123123

124-
Assertions.assertTrue(context.isRegistered(ConfigMapPropertySourceLocator.class));
125-
Assertions.assertTrue(context.isRegistered(SecretsPropertySourceLocator.class));
124+
Assertions.assertThat(context.isRegistered(ConfigMapPropertySourceLocator.class)).isTrue();
125+
Assertions.assertThat(context.isRegistered(SecretsPropertySourceLocator.class)).isTrue();
126126

127127
ConfigMapPropertySourceLocator configMapPropertySourceLocator = context
128128
.get(ConfigMapPropertySourceLocator.class);
129-
Assertions.assertSame(KubernetesClientConfigMapPropertySourceLocator.class,
130-
configMapPropertySourceLocator.getClass());
129+
Assertions.assertThat(configMapPropertySourceLocator.getClass())
130+
.isEqualTo(KubernetesClientConfigMapPropertySourceLocator.class);
131131

132132
SecretsPropertySourceLocator secretsPropertySourceLocator = context.get(SecretsPropertySourceLocator.class);
133-
Assertions.assertSame(KubernetesClientSecretsPropertySourceLocator.class,
134-
secretsPropertySourceLocator.getClass());
133+
Assertions.assertThat(secretsPropertySourceLocator.getClass())
134+
.isEqualTo(KubernetesClientSecretsPropertySourceLocator.class);
135135

136136
}
137137

@@ -161,25 +161,25 @@ void testBothPresentExplicitly(CapturedOutput capturedOutput) {
161161
ConfigDataLocation configDataLocation = ConfigDataLocation.of("kubernetes:abc");
162162
RESOLVER.resolveProfileSpecific(RESOLVER_CONTEXT, configDataLocation, profiles);
163163

164-
Assertions.assertTrue(context.isRegistered(KubernetesClientProperties.class));
165-
Assertions.assertTrue(context.isRegistered(CoreV1Api.class));
166-
Assertions.assertTrue(context.isRegistered(ApiClient.class));
164+
Assertions.assertThat(context.isRegistered(KubernetesClientProperties.class)).isTrue();
165+
Assertions.assertThat(context.isRegistered(CoreV1Api.class)).isTrue();
166+
Assertions.assertThat(context.isRegistered(ApiClient.class)).isTrue();
167167

168-
Assertions.assertTrue(context.isRegistered(ConfigMapConfigProperties.class));
169-
Assertions.assertTrue(context.isRegistered(SecretsConfigProperties.class));
168+
Assertions.assertThat(context.isRegistered(ConfigMapConfigProperties.class)).isTrue();
169+
Assertions.assertThat(context.isRegistered(SecretsConfigProperties.class)).isTrue();
170170

171171
ConfigMapPropertySourceLocator configMapPropertySourceLocator = context
172172
.get(ConfigMapPropertySourceLocator.class);
173-
Assertions.assertSame(KubernetesClientConfigMapPropertySourceLocator.class,
174-
configMapPropertySourceLocator.getClass());
173+
Assertions.assertThat(configMapPropertySourceLocator.getClass())
174+
.isEqualTo(KubernetesClientConfigMapPropertySourceLocator.class);
175175

176176
SecretsPropertySourceLocator secretsPropertySourceLocator = context.get(SecretsPropertySourceLocator.class);
177-
Assertions.assertSame(KubernetesClientSecretsPropertySourceLocator.class,
178-
secretsPropertySourceLocator.getClass());
177+
Assertions.assertThat(secretsPropertySourceLocator.getClass())
178+
.isEqualTo(KubernetesClientSecretsPropertySourceLocator.class);
179179

180-
Assertions.assertTrue(capturedOutput.getOut()
180+
Assertions.assertThat(capturedOutput.getOut())
181181
.contains("Could not create the Kubernetes ApiClient in a cluster environment, because connection port "
182-
+ "was not provided."));
182+
+ "was not provided.");
183183
}
184184

185185
/*
@@ -211,24 +211,24 @@ void testBothPresentAndRetryEnabled() {
211211
ConfigDataLocation configDataLocation = ConfigDataLocation.of("kubernetes:abc");
212212
RESOLVER.resolveProfileSpecific(RESOLVER_CONTEXT, configDataLocation, profiles);
213213

214-
Assertions.assertTrue(context.isRegistered(KubernetesClientProperties.class));
215-
Assertions.assertTrue(context.isRegistered(CoreV1Api.class));
216-
Assertions.assertTrue(context.isRegistered(ApiClient.class));
214+
Assertions.assertThat(context.isRegistered(KubernetesClientProperties.class)).isTrue();
215+
Assertions.assertThat(context.isRegistered(CoreV1Api.class)).isTrue();
216+
Assertions.assertThat(context.isRegistered(ApiClient.class)).isTrue();
217217

218-
Assertions.assertTrue(context.isRegistered(ConfigMapConfigProperties.class));
219-
Assertions.assertTrue(context.isRegistered(SecretsConfigProperties.class));
218+
Assertions.assertThat(context.isRegistered(ConfigMapConfigProperties.class)).isTrue();
219+
Assertions.assertThat(context.isRegistered(SecretsConfigProperties.class)).isTrue();
220220

221-
Assertions.assertTrue(context.isRegistered(ConfigMapPropertySourceLocator.class));
222-
Assertions.assertTrue(context.isRegistered(SecretsPropertySourceLocator.class));
221+
Assertions.assertThat(context.isRegistered(ConfigMapPropertySourceLocator.class)).isTrue();
222+
Assertions.assertThat(context.isRegistered(SecretsPropertySourceLocator.class)).isTrue();
223223

224224
ConfigMapPropertySourceLocator configMapPropertySourceLocator = context
225225
.get(ConfigMapPropertySourceLocator.class);
226-
Assertions.assertSame(ConfigDataRetryableConfigMapPropertySourceLocator.class,
227-
configMapPropertySourceLocator.getClass());
226+
Assertions.assertThat(configMapPropertySourceLocator.getClass())
227+
.isEqualTo(ConfigDataRetryableConfigMapPropertySourceLocator.class);
228228

229229
SecretsPropertySourceLocator secretsPropertySourceLocator = context.get(SecretsPropertySourceLocator.class);
230-
Assertions.assertSame(ConfigDataRetryableSecretsPropertySourceLocator.class,
231-
secretsPropertySourceLocator.getClass());
230+
Assertions.assertThat(secretsPropertySourceLocator.getClass())
231+
.isEqualTo(ConfigDataRetryableSecretsPropertySourceLocator.class);
232232

233233
}
234234

0 commit comments

Comments
 (0)