From 977a8ccfac4eec293eb394e4954b2a701ba2b3e2 Mon Sep 17 00:00:00 2001 From: erabii Date: Mon, 8 May 2023 15:32:30 +0300 Subject: [PATCH] Deprecate config paths (#1336) --- docs/src/main/asciidoc/property-source-config.adoc | 2 ++ .../commons/config/ConfigMapPropertySourceLocator.java | 1 + .../kubernetes/commons/config/SecretsPropertySourceLocator.java | 2 ++ 3 files changed, 5 insertions(+) diff --git a/docs/src/main/asciidoc/property-source-config.adoc b/docs/src/main/asciidoc/property-source-config.adoc index 31daabbe1a..41ba331f4c 100644 --- a/docs/src/main/asciidoc/property-source-config.adoc +++ b/docs/src/main/asciidoc/property-source-config.adoc @@ -581,6 +581,8 @@ Kubernetes service accounts, roles and role bindings. Another option for using `ConfigMap` instances is to mount them into the Pod by running the Spring Cloud Kubernetes application and having Spring Cloud Kubernetes read them from the file system. + +NOTE: This feature is deprecated and will be removed in a future release (Use `spring.config.import` instead). This behavior is controlled by the `spring.cloud.kubernetes.config.paths` property. You can use it in addition to or instead of the mechanism described earlier. `spring.cloud.kubernetes.config.paths` expects a List of full paths to each property file, because directories are not being recursively parsed. For example: diff --git a/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/ConfigMapPropertySourceLocator.java b/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/ConfigMapPropertySourceLocator.java index 1bfcf39e06..3c23784fb0 100644 --- a/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/ConfigMapPropertySourceLocator.java +++ b/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/ConfigMapPropertySourceLocator.java @@ -99,6 +99,7 @@ public Collection> locateCollection(Environment environment) { private void addPropertySourcesFromPaths(Environment environment, CompositePropertySource composite) { Set uniquePaths = new LinkedHashSet<>(properties.paths()); + LOG.warn("path support is deprecated and will be removed in a future release. Please use spring.config.import"); LOG.debug("paths property sources : " + uniquePaths); uniquePaths.stream().map(Paths::get).filter(p -> { boolean exists = Files.exists(p); diff --git a/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/SecretsPropertySourceLocator.java b/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/SecretsPropertySourceLocator.java index 4f2664c668..235cacb957 100644 --- a/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/SecretsPropertySourceLocator.java +++ b/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/SecretsPropertySourceLocator.java @@ -112,6 +112,8 @@ protected abstract SecretsPropertySource getPropertySource(ConfigurableEnvironme protected void putPathConfig(CompositePropertySource composite) { + LOG.warn("path support is deprecated and will be removed in a future release. Please use spring.config.import"); + this.properties.paths().stream().map(Paths::get).filter(Files::exists).flatMap(x -> { try { return Files.walk(x);