Skip to content

Commit 7a269c3

Browse files
committed
Merge branch '3.1.x' into 3.2.x
2 parents b9e8eae + 884f55a commit 7a269c3

File tree

40 files changed

+685
-1700
lines changed

40 files changed

+685
-1700
lines changed

spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/SecretsPropertySourceLocator.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@
2222
import java.nio.file.Paths;
2323
import java.util.ArrayList;
2424
import java.util.Collection;
25-
import java.util.Collections;
2625
import java.util.EnumSet;
2726
import java.util.HashSet;
27+
import java.util.LinkedHashSet;
2828
import java.util.List;
2929
import java.util.Locale;
30+
import java.util.Map;
3031
import java.util.Objects;
3132
import java.util.Set;
3233
import java.util.function.BiConsumer;
@@ -123,12 +124,16 @@ protected abstract SecretsPropertySource getPropertySource(ConfigurableEnvironme
123124

124125
protected void putPathConfig(CompositePropertySource composite) {
125126

126-
if (!properties.paths().isEmpty()) {
127+
Set<String> uniquePaths = new LinkedHashSet<>(properties.paths());
128+
129+
if (!uniquePaths.isEmpty()) {
127130
LOG.warn(
128131
"path support is deprecated and will be removed in a future release. Please use spring.config.import");
129132
}
130133

131-
this.properties.paths().stream().map(Paths::get).filter(Files::exists).flatMap(x -> {
134+
LOG.debug("paths property sources : " + uniquePaths);
135+
136+
uniquePaths.stream().map(Paths::get).filter(Files::exists).flatMap(x -> {
132137
try {
133138
return Files.walk(x);
134139
}
@@ -189,7 +194,7 @@ private SecretsPropertySource property(Path filePath) {
189194
try {
190195
String content = new String(Files.readAllBytes(filePath)).trim();
191196
String sourceName = fileName.toLowerCase(Locale.ROOT);
192-
SourceData sourceData = new SourceData(sourceName, Collections.singletonMap(fileName, content));
197+
SourceData sourceData = new SourceData(sourceName, Map.of(fileName, content));
193198
return new SecretsPropertySource(sourceData);
194199
}
195200
catch (IOException e) {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2013-2023 the original author or authors.
2+
* Copyright 2013-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -44,7 +44,7 @@
4444
/**
4545
* @author wind57
4646
*/
47-
class Fabric8ConfigMapMountMountPollingBootstrapIT {
47+
class Fabric8ConfigMapMountPollingBootstrapIT {
4848

4949
private static final String IMAGE_NAME = "spring-cloud-kubernetes-fabric8-client-reload";
5050

spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-reload/src/main/java/org/springframework/cloud/kubernetes/k8s/client/reload/App.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
*/
2626
@SpringBootApplication
2727
@EnableConfigurationProperties({ LeftProperties.class, RightProperties.class, RightWithLabelsProperties.class,
28-
ConfigMapProperties.class, SecretsProperties.class })
28+
ConfigMapProperties.class, SecretProperties.class })
2929
public class App {
3030

3131
public static void main(String[] args) {

spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-reload/src/main/java/org/springframework/cloud/kubernetes/k8s/client/reload/ConfigMapProperties.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
/**
2222
* @author wind57
2323
*/
24-
@ConfigurationProperties("from.properties")
24+
@ConfigurationProperties("from.properties.configmap")
2525
public class ConfigMapProperties {
2626

2727
private String key;

spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-reload/src/main/java/org/springframework/cloud/kubernetes/k8s/client/reload/Controller.java

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -25,40 +25,23 @@
2525
@RestController
2626
public class Controller {
2727

28-
private final LeftProperties leftProperties;
29-
30-
private final RightProperties rightProperties;
31-
32-
private final RightWithLabelsProperties rightWithLabelsProperties;
33-
3428
private final ConfigMapProperties configMapProperties;
3529

36-
public Controller(LeftProperties leftProperties, RightProperties rightProperties,
37-
RightWithLabelsProperties rightWithLabelsProperties, ConfigMapProperties configMapProperties) {
38-
this.leftProperties = leftProperties;
39-
this.rightProperties = rightProperties;
40-
this.rightWithLabelsProperties = rightWithLabelsProperties;
41-
this.configMapProperties = configMapProperties;
42-
}
43-
44-
@GetMapping("/left")
45-
public String left() {
46-
return leftProperties.getValue();
47-
}
48-
49-
@GetMapping("/right")
50-
public String right() {
51-
return rightProperties.getValue();
52-
}
30+
private final SecretProperties secretsProperties;
5331

54-
@GetMapping("/with-label")
55-
public String witLabel() {
56-
return rightWithLabelsProperties.getValue();
32+
public Controller(ConfigMapProperties configMapProperties, SecretProperties secretsProperties) {
33+
this.configMapProperties = configMapProperties;
34+
this.secretsProperties = secretsProperties;
5735
}
5836

59-
@GetMapping("/mount")
37+
@GetMapping("/configmap")
6038
public String key() {
6139
return configMapProperties.getKey();
6240
}
6341

42+
@GetMapping("/secret")
43+
public String secret() {
44+
return secretsProperties.getKey();
45+
}
46+
6447
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
/**
2222
* @author wind57
2323
*/
24-
@ConfigurationProperties("from.properties")
25-
public class SecretsProperties {
24+
@ConfigurationProperties("from.properties.secret")
25+
public class SecretProperties {
2626

2727
private String key;
2828

spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-reload/src/main/java/org/springframework/cloud/kubernetes/k8s/client/reload/SecretsController.java

Lines changed: 0 additions & 39 deletions
This file was deleted.

spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-reload/src/main/resources/application-mount.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
spring:
22
application:
3-
name: poll-reload-mount
3+
name: poll-reload
44
cloud:
55
kubernetes:
66
reload:
@@ -12,6 +12,7 @@ spring:
1212
config:
1313
paths:
1414
- /tmp/application.properties
15+
1516
config:
1617
import: "kubernetes:"
1718

spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-reload/src/main/resources/application-one.yaml

Lines changed: 0 additions & 16 deletions
This file was deleted.

spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-k8s-client-reload/src/main/resources/application-three.yaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
1-
logging:
2-
level:
3-
root: DEBUG
4-
51
spring:
62
application:
73
name: event-reload
84
cloud:
95
kubernetes:
106
reload:
117
enabled: true
12-
strategy: shutdown
8+
strategy: refresh
139
mode: event
1410
namespaces:
1511
- right

0 commit comments

Comments
 (0)