Skip to content

Commit 9202107

Browse files
for try
Signed-off-by: Arjav <[email protected]>
1 parent ea7bca3 commit 9202107

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configserver/src/main/java/org/springframework/cloud/kubernetes/configserver/KubernetesConfigServerAutoConfiguration.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323

2424
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
2525
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
26+
import org.springframework.boot.autoconfigure.condition.ConditionalOnCloudPlatform;
2627
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
28+
import org.springframework.boot.cloud.CloudPlatform;
2729
import org.springframework.boot.context.properties.EnableConfigurationProperties;
2830
import org.springframework.cloud.config.server.config.ConfigServerAutoConfiguration;
2931
import org.springframework.cloud.config.server.environment.EnvironmentRepository;
@@ -51,7 +53,7 @@
5153
@Configuration
5254
@AutoConfigureAfter({ KubernetesClientAutoConfiguration.class })
5355
@AutoConfigureBefore({ ConfigServerAutoConfiguration.class })
54-
//@ConditionalOnCloudPlatform(CloudPlatform.KUBERNETES)
56+
@ConditionalOnCloudPlatform(CloudPlatform.KUBERNETES)
5557
@EnableConfigurationProperties(KubernetesConfigServerProperties.class)
5658
public class KubernetesConfigServerAutoConfiguration {
5759

spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configserver/src/main/java/org/springframework/cloud/kubernetes/configserver/KubernetesEnvironmentRepositoryFactory.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import org.springframework.stereotype.Component;
66

77
import java.util.List;
8+
import java.util.stream.Collectors;
9+
import java.util.stream.Stream;
810

911
@Component
1012
public class KubernetesEnvironmentRepositoryFactory
@@ -21,6 +23,9 @@ public KubernetesEnvironmentRepositoryFactory(CoreV1Api coreV1Api,
2123

2224
@Override
2325
public KubernetesEnvironmentRepository build(KubernetesConfigServerProperties environmentProperties) {
24-
return new KubernetesEnvironmentRepository(coreV1Api, kubernetesPropertySourceSuppliers, "default");
26+
String combinedNamespaces = Stream.of(environmentProperties.getSecretsNamespaces(), environmentProperties.getConfigMapNamespaces())
27+
.filter(ns -> ns != null && !ns.isEmpty())
28+
.collect(Collectors.joining(","));
29+
return new KubernetesEnvironmentRepository(coreV1Api, kubernetesPropertySourceSuppliers, combinedNamespaces);
2530
}
2631
}

0 commit comments

Comments
 (0)