diff --git a/spring-cloud-kubernetes-client-config/src/main/java/org/springframework/cloud/kubernetes/client/config/KubernetesClientConfigUtils.java b/spring-cloud-kubernetes-client-config/src/main/java/org/springframework/cloud/kubernetes/client/config/KubernetesClientConfigUtils.java index ef4e3eda51..21bc92b9ee 100644 --- a/spring-cloud-kubernetes-client-config/src/main/java/org/springframework/cloud/kubernetes/client/config/KubernetesClientConfigUtils.java +++ b/spring-cloud-kubernetes-client-config/src/main/java/org/springframework/cloud/kubernetes/client/config/KubernetesClientConfigUtils.java @@ -117,16 +117,6 @@ static MultipleSourcesContainer secretsDataByName(CoreV1Api coreV1Api, String na includeDefaultProfileData); } - static MultipleSourcesContainer secretsDataByName(CoreV1Api coreV1Api, String namespace, - LinkedHashSet sourceNames, Environment environment) { - return secretsDataByName(coreV1Api, namespace, sourceNames, environment, true); - } - - static MultipleSourcesContainer configMapsDataByName(CoreV1Api coreV1Api, String namespace, - LinkedHashSet sourceNames, Environment environment) { - return configMapsDataByName(coreV1Api, namespace, sourceNames, environment, true); - } - /** *
 	 *     1. read all config maps in the provided namespace
diff --git a/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/ConfigUtils.java b/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/ConfigUtils.java
index e517b293d4..bf0b4fcbf0 100644
--- a/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/ConfigUtils.java
+++ b/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/ConfigUtils.java
@@ -194,11 +194,11 @@ public static MultipleSourcesContainer processNamedData(List {
-			StrippedSourceContainer stripped = hashByName.get(source);
+		sourceNames.forEach(sourceName -> {
+			StrippedSourceContainer stripped = hashByName.get(sourceName);
 			if (stripped != null) {
-				LOG.debug("Found source with name : '" + source + " in namespace: '" + namespace + "'");
-				foundSourceNames.add(source);
+				LOG.debug("Found source with name : '" + sourceName + " in namespace: '" + namespace + "'");
+				foundSourceNames.add(sourceName);
 				// see if data is a single yaml/properties file and if it needs decoding
 				Map rawData = stripped.data();
 				if (decode) {
@@ -214,7 +214,8 @@ public static MultipleSourcesContainer processNamedData(List source.contains("-" + p) || "default".equals(p));
+								.anyMatch(activeProfile -> sourceName.endsWith("-" + activeProfile)
+									|| "default".equals(activeProfile));
 				if (includeDefaultProfileData || containsActiveProfile
 						|| containsDataWithProfile(rawData, environment.getActiveProfiles())) {
 					data.putAll(SourceDataEntriesProcessor.processAllEntries(rawData == null ? Map.of() : rawData,
@@ -232,7 +233,8 @@ public static MultipleSourcesContainer processNamedData(List rawData, String[] activeProfiles) {
 		return rawData.keySet().stream().anyMatch(
-				key -> Arrays.stream(activeProfiles).anyMatch(p -> key.contains("-" + p) || "default".equals(p)));
+				key -> Arrays.stream(activeProfiles).anyMatch(activeProfile -> key.contains("-" + activeProfile)
+					|| "default".equals(activeProfile)));
 	}
 
 	/**