Repository: quarkusio/quarkus
Issue: Unable to read a literal value from a secret containing keys ending in "yaml,yml or properties" 

**Describe the bug**
(Describe the problem clearly and concisely.)
When reading a secret any secret key with that ends with ".yml" or ".yaml" or ".properties" is assumed to contain a ConfigSource. It's not possible to read a literal value from a secret with containing keys ending in "yaml,yml or properties" 

**Expected behavior**
Should be able to read literal values from secrets containing keys ending in "yaml,yml or properties" 

**Actual behavior**
2020-08-19 09:42:27,386 DEBUG [io.qua.kub.cli.run.KubernetesConfigSourceProvider] (main) Attempting to read Secret tournamentcache-generated-secret
2020-08-19 09:42:48,593 DEBUG [io.qua.kub.cli.run.AbstractKubernetesConfigSourceUtil] (main) Attempting to convert data in Secret 'tournamentcache-generated-secret' to a list of ConfigSource objects
2020-08-19 09:45:23,074 DEBUG [io.qua.kub.cli.run.AbstractKubernetesConfigSourceUtil] (main) Secret 'tournamentcache-generated-secret' converted into 0ConfigSource objects
2020-08-19 09:46:09,200 DEBUG [io.qua.kub.cli.run.KubernetesConfigSourceProvider] (main) Done reading Secret tournamentcache-generated-secret


**To Reproduce**
Steps to reproduce the behavior:
1. 
2. 
3. 

**Configuration**
```properties
# Add your application.properties here, if applicable.

quarkus.kubernetes-config.enabled=true
quarkus.kubernetes-config.secrets.enabled=true
quarkus.kubernetes-config.fail-on-missing-config=true
quarkus.kubernetes-config.secrets=tournamentcache-generated-secret

```

**Screenshots**
(If applicable, add screenshots to help explain your problem.)

**Environment (please complete the following information):**
 - Output of `uname -a` or `ver`: 
 - Output of `java -version`: 
 - GraalVM version (if different from Java): 
 - Quarkus version or git rev: 
 - Build tool (ie. output of `mvnw --version` or `gradlew --version`): 

**Additional context**
```yaml
oc get secret -o yaml tournamentcache-generated-secret
apiVersion: v1
data:
  identities.yaml: Y3JlZGVudGlhbHM6Ci0gdXNlcm5hbWU6IGRldmVsb3BlcgogIHBhc3N3b3JkOiBUZDNaamZaYUJSOEQxQWZrCi0gdXNlcm5hbWU6IG9wZXJhdG9yCiAgcGFzc3dvcmQ6IGMyRm1KdTY3UlQ3R2JVQWsK
kind: Secret
metadata:
  creationTimestamp: "2020-08-09T08:29:49Z"
  labels:
    app: infinispan-secret-identities
    clusterName: tournamentcache
    infinispan_cr: tournamentcache
```


Changed files:
extensions/kubernetes-config/runtime/src/test/java/io/quarkus/kubernetes/client/runtime/ConfigMapConfigSourceUtilTest.java
extensions/kubernetes-config/runtime/src/main/java/io/quarkus/kubernetes/client/runtime/AbstractKubernetesConfigSourceUtil.java
extensions/kubernetes-config/runtime/src/test/java/io/quarkus/kubernetes/client/runtime/SecretConfigSourceUtilTest.java

diff --git a/extensions/kubernetes-config/runtime/src/main/java/io/quarkus/kubernetes/client/runtime/AbstractKubernetesConfigSourceUtil.java b/extensions/kubernetes-config/runtime/src/main/java/io/quarkus/kubernetes/client/runtime/AbstractKubernetesConfigSourceUtil.java
index 6d58dc71b79..2672f56a018 100644
--- a/extensions/kubernetes-config/runtime/src/main/java/io/quarkus/kubernetes/client/runtime/AbstractKubernetesConfigSourceUtil.java
+++ b/extensions/kubernetes-config/runtime/src/main/java/io/quarkus/kubernetes/client/runtime/AbstractKubernetesConfigSourceUtil.java
@@ -50,7 +50,7 @@ List<ConfigSource> toConfigSources(String kubernetesConfigSourceName, Map<String
                 log.debug(
                         "Adding a ConfigSource for the literal data of " + getType() + " '" + kubernetesConfigSourceName + "'");
             }
-            result.add(createLiteralDataConfigSource(kubernetesConfigSourceName + "-literalData",
+            result.add(createLiteralDataConfigSource(kubernetesConfigSourceName,
                     categorizedConfigSourceData.literalData,
                     ORDINAL));
         }
@@ -69,9 +69,6 @@ List<ConfigSource> toConfigSources(String kubernetesConfigSourceName, Map<String
                             + " '" + kubernetesConfigSourceName + "'");
                 }
                 result.add(createYamlConfigSource(kubernetesConfigSourceName, fileName, rawFileData, ORDINAL));
-            } else {
-                // TODO all keys named `*.{properties,yml,yaml}` are categorized as file sources,
-                //  but here, we only look for `application.{properties,yml,yaml}`
             }
         }
 
@@ -91,7 +88,8 @@ private static CategorizedConfigSourceData categorize(Map<String, String> data)
         List<Map.Entry<String, String>> fileData = new ArrayList<>();
         for (Map.Entry<String, String> entry : data.entrySet()) {
             String key = entry.getKey();
-            if (key.endsWith(".yml") || key.endsWith(".yaml") || key.endsWith(".properties")) {
+            if ((key.startsWith("application")) &&
+                    ((key.endsWith(".yml") || key.endsWith(".yaml") || key.endsWith(".properties")))) {
                 fileData.add(entry);
             } else {
                 literalData.put(key, entry.getValue());
diff --git a/extensions/kubernetes-config/runtime/src/test/java/io/quarkus/kubernetes/client/runtime/ConfigMapConfigSourceUtilTest.java b/extensions/kubernetes-config/runtime/src/test/java/io/quarkus/kubernetes/client/runtime/ConfigMapConfigSourceUtilTest.java
index e34730b5ea3..6d458abc8d7 100644
--- a/extensions/kubernetes-config/runtime/src/test/java/io/quarkus/kubernetes/client/runtime/ConfigMapConfigSourceUtilTest.java
+++ b/extensions/kubernetes-config/runtime/src/test/java/io/quarkus/kubernetes/client/runtime/ConfigMapConfigSourceUtilTest.java
@@ -59,7 +59,7 @@ void testOnlySingleNonMatchingPropertiesData() {
 
         List<ConfigSource> configSources = sut.toConfigSources(configMap.getMetadata().getName(), configMap.getData());
 
-        assertThat(configSources).isEmpty();
+        assertThat(configSources).isNotEmpty();
     }
 
     @Test
@@ -83,7 +83,7 @@ void testOnlySingleNonMatchingYamlData() {
 
         List<ConfigSource> configSources = sut.toConfigSources(configMap.getMetadata().getName(), configMap.getData());
 
-        assertThat(configSources).isEmpty();
+        assertThat(configSources).isNotEmpty();
     }
 
     @Test
@@ -101,10 +101,18 @@ void testWithAllKindsOfData() {
         List<ConfigSource> configSources = sut.toConfigSources(configMap.getMetadata().getName(), configMap.getData());
 
         assertThat(configSources).hasSize(4);
-        assertThat(configSources).filteredOn(c -> c.getName().toLowerCase().contains("literal"))
-                .singleElement().satisfies(c -> {
-                    assertThat(c.getProperties()).containsOnly(entry("some.key", "someValue"));
+
+        assertThat(configSources.get(0).getClass().getName().contains("ConfigMapLiteralDataPropertiesConfigSource")).isTrue();
+
+        assertThat(configSources).filteredOn(c -> !c.getName().toLowerCase().contains("application"))
+                .hasOnlyOneElementSatisfying(c -> {
+                    assertThat(c.getProperties()).containsOnly(
+                            entry("some.key", "someValue"),
+                            entry("app.properties", "ignored1=ignoredValue1"),
+                            entry("app.yaml", "ignored2: ignoredValue2"),
+                            entry("app.yml", "ignored3: ignoredValue3"));
                 });
+
         assertThat(configSources).filteredOn(c -> c.getName().toLowerCase().contains("application.properties"))
                 .singleElement().satisfies(c -> {
                     assertThat(c.getProperties()).containsOnly(entry("key1", "value1"), entry("app.key", "val"));
diff --git a/extensions/kubernetes-config/runtime/src/test/java/io/quarkus/kubernetes/client/runtime/SecretConfigSourceUtilTest.java b/extensions/kubernetes-config/runtime/src/test/java/io/quarkus/kubernetes/client/runtime/SecretConfigSourceUtilTest.java
index 1a18e573e73..13f9fbf9f86 100644
--- a/extensions/kubernetes-config/runtime/src/test/java/io/quarkus/kubernetes/client/runtime/SecretConfigSourceUtilTest.java
+++ b/extensions/kubernetes-config/runtime/src/test/java/io/quarkus/kubernetes/client/runtime/SecretConfigSourceUtilTest.java
@@ -60,7 +60,7 @@ void testOnlySingleNonMatchingPropertiesData() {
 
         List<ConfigSource> configSources = sut.toConfigSources(secret.getMetadata().getName(), secret.getData());
 
-        assertThat(configSources).isEmpty();
+        assertThat(configSources).isNotEmpty();
     }
 
     @Test
@@ -84,7 +84,7 @@ void testOnlySingleNonMatchingYamlData() {
 
         List<ConfigSource> configSources = sut.toConfigSources(secret.getMetadata().getName(), secret.getData());
 
-        assertThat(configSources).isEmpty();
+        assertThat(configSources).isNotEmpty();
     }
 
     @Test
@@ -102,14 +102,22 @@ void testWithAllKindsOfData() {
         List<ConfigSource> configSources = sut.toConfigSources(secret.getMetadata().getName(), secret.getData());
 
         assertThat(configSources).hasSize(4);
-        assertThat(configSources).filteredOn(c -> c.getName().toLowerCase().contains("literal"))
-                .singleElement().satisfies(c -> {
-                    assertThat(c.getProperties()).containsOnly(entry("some.key", "someValue"));
+        assertThat(configSources.get(0).getClass().getName().contains("SecretLiteralDataPropertiesConfigSource")).isTrue();
+
+        assertThat(configSources).filteredOn(c -> !c.getName().toLowerCase().contains("application"))
+                .hasOnlyOneElementSatisfying(c -> {
+                    assertThat(c.getProperties()).containsOnly(
+                            entry("some.key", "someValue"),
+                            entry("app.properties", "ignored1=ignoredValue1"),
+                            entry("app.yaml", "ignored2: ignoredValue2"),
+                            entry("app.yml", "ignored3: ignoredValue3"));
                 });
+
         assertThat(configSources).filteredOn(c -> c.getName().toLowerCase().contains("application.properties"))
                 .singleElement().satisfies(c -> {
                     assertThat(c.getProperties()).containsOnly(entry("key1", "value1"), entry("app.key", "val"));
                 });
+
         assertThat(configSources).filteredOn(c -> c.getName().toLowerCase().contains("application.yaml"))
                 .singleElement().satisfies(c -> {
                     assertThat(c.getProperties()).containsOnly(entry("key2", "value2"),