You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To enable loading of the `DiscoveryClient`, add `@EnableDiscoveryClient` to the according configuration or application class, as the following example shows:
Copy file name to clipboardExpand all lines: docs/modules/ROOT/pages/property-source-config/configmap-propertysource.adoc
+15-15Lines changed: 15 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -57,7 +57,7 @@ An example should make a lot more sense. Let's suppose that `spring.application.
57
57
we have a single active profile called `k8s`. For a configuration as below:
58
58
59
59
60
-
[source]
60
+
[source,yaml]
61
61
----
62
62
kind: ConfigMap
63
63
apiVersion: v1
@@ -92,7 +92,7 @@ The order of loading properties is a as follows:
92
92
This means that profile based sources take precedence over non-profile based sources (just like in a vanilla Spring app); and plain properties take precedence over both profile and non-profile based sources. Here is an example:
93
93
94
94
====
95
-
[source]
95
+
[source,yaml]
96
96
----
97
97
kind: ConfigMap
98
98
apiVersion: v1
@@ -101,7 +101,7 @@ metadata:
101
101
data:
102
102
my-app-k8s.yaml: |-
103
103
key1=valueA
104
-
key2=valueB
104
+
key2=valueB
105
105
my-app.yaml: |-
106
106
key1=valueC
107
107
key2=valueA
@@ -318,13 +318,13 @@ spec:
318
318
metadata:
319
319
labels:
320
320
app: deployment-name
321
-
spec:
322
-
containers:
323
-
- name: container-name
324
-
image: your-image
325
-
env:
326
-
- name: SPRING_PROFILES_ACTIVE
327
-
value: "development"
321
+
spec:
322
+
containers:
323
+
- name: container-name
324
+
image: your-image
325
+
env:
326
+
- name: SPRING_PROFILES_ACTIVE
327
+
value: "development"
328
328
----
329
329
330
330
You could run into a situation where there are multiple configs maps that have the same property names. For example:
@@ -447,7 +447,7 @@ will result in three properties being generated:
447
447
The same way you configure a prefix for configmaps, you can do it for secrets also; both for secrets that are based on name
448
448
and the ones based on labels. For example:
449
449
450
-
[source.yaml]
450
+
[source,yaml]
451
451
----
452
452
spring:
453
453
application:
@@ -479,7 +479,7 @@ will be the name of the secret found for those particular labels.
479
479
480
480
One more thing to bear in mind is that we support `prefix` per _secret_. The easiest way to explain this is via an example:
481
481
482
-
[source.yaml]
482
+
[source,yaml]
483
483
----
484
484
spring:
485
485
application:
@@ -553,15 +553,16 @@ This behavior is controlled by the `spring.cloud.kubernetes.config.paths` proper
553
553
addition to or instead of the mechanism described earlier.
554
554
`spring.cloud.kubernetes.config.paths` expects a List of full paths to each property file, because directories are not being recursively parsed. For example:
555
555
556
-
```
556
+
[source,yaml]
557
+
----
557
558
spring:
558
559
cloud:
559
560
kubernetes:
560
561
config:
561
562
paths:
562
563
- /tmp/application.properties
563
564
- /var/application.yaml
564
-
```
565
+
----
565
566
566
567
NOTE: If you use `spring.cloud.kubernetes.config.paths` or `spring.cloud.kubernetes.secrets.path` the automatic reload
567
568
functionality will not work. You will need to make a `POST` request to the `/actuator/refresh` endpoint or
@@ -599,4 +600,3 @@ by setting `spring.cloud.kubernetes.config.retry.enabled=false`.
599
600
| `spring.cloud.kubernetes.config.retry.max-interval` | `Long` | `2000` | Maximum interval for backoff.
600
601
| `spring.cloud.kubernetes.config.retry.multiplier` | `Double` | `1.1` | Multiplier for next interval.
0 commit comments