Skip to content

Commit 9aa126a

Browse files
committed
Update SNAPSHOT to 2.0.4
1 parent 58b9394 commit 9aa126a

File tree

53 files changed

+231
-57
lines changed
  • docs
  • spring-cloud-kubernetes-client-autoconfig
  • spring-cloud-kubernetes-client-config
  • spring-cloud-kubernetes-client-discovery
  • spring-cloud-kubernetes-client-loadbalancer
  • spring-cloud-kubernetes-commons
  • spring-cloud-kubernetes-controllers
  • spring-cloud-kubernetes-dependencies
  • spring-cloud-kubernetes-examples
  • spring-cloud-kubernetes-fabric8-autoconfig
  • spring-cloud-kubernetes-fabric8-config
  • spring-cloud-kubernetes-fabric8-discovery
  • spring-cloud-kubernetes-fabric8-istio
  • spring-cloud-kubernetes-fabric8-leader
  • spring-cloud-kubernetes-fabric8-loadbalancer
  • spring-cloud-kubernetes-integration-tests
  • spring-cloud-kubernetes-test-support
  • spring-cloud-starter-kubernetes-client
  • spring-cloud-starter-kubernetes-client-all
  • spring-cloud-starter-kubernetes-client-config
  • spring-cloud-starter-kubernetes-client-loadbalancer
  • spring-cloud-starter-kubernetes-fabric8
  • spring-cloud-starter-kubernetes-fabric8-all
  • spring-cloud-starter-kubernetes-fabric8-config
  • spring-cloud-starter-kubernetes-fabric8-loadbalancer

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+231
-57
lines changed

README.adoc

Lines changed: 177 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,9 @@ spring:
272272

273273
In the preceding example, if `spring.cloud.kubernetes.config.namespace` had not been set,
274274
the `ConfigMap` named `c1` would be looked up in the namespace that the application runs.
275+
See <<namespace-resolution,Namespace resolution>> to get a better understanding of how the namespace
276+
of the application is resolved.
277+
275278

276279
Any matching `ConfigMap` that is found is processed as follows:
277280

@@ -494,6 +497,135 @@ spec:
494497
----
495498
====
496499

500+
You could run into a situation where there are multiple configs maps that have the same property names. For example:
501+
502+
====
503+
[source,yaml]
504+
----
505+
kind: ConfigMap
506+
apiVersion: v1
507+
metadata:
508+
name: config-map-one
509+
data:
510+
application.yml: |-
511+
greeting:
512+
message: Say Hello from one
513+
----
514+
====
515+
516+
and
517+
518+
====
519+
[source,yaml]
520+
----
521+
kind: ConfigMap
522+
apiVersion: v1
523+
metadata:
524+
name: config-map-two
525+
data:
526+
application.yml: |-
527+
greeting:
528+
message: Say Hello from two
529+
----
530+
====
531+
532+
Depending on the order in which you place these in `bootstrap.yaml|properties`, you might end up with an un-expected result (the last config map wins). For example:
533+
534+
====
535+
[source,yaml]
536+
----
537+
spring:
538+
application:
539+
name: cloud-k8s-app
540+
cloud:
541+
kubernetes:
542+
config:
543+
namespace: default-namespace
544+
sources:
545+
- name: config-map-two
546+
- name: config-map-one
547+
----
548+
====
549+
550+
will result in property `greetings.message` being `Say Hello from one`.
551+
552+
There is a way to change this default configuration by specifying `useNameAsPrefix`. For example:
553+
554+
====
555+
[source,yaml]
556+
----
557+
spring:
558+
application:
559+
name: with-prefix
560+
cloud:
561+
kubernetes:
562+
config:
563+
useNameAsPrefix: true
564+
namespace: default-namespace
565+
sources:
566+
- name: config-map-one
567+
useNameAsPrefix: false
568+
- name: config-map-two
569+
----
570+
====
571+
572+
Such a configuration will result in two properties being generated:
573+
574+
- `greetings.message` equal to `Say Hello from one`.
575+
576+
- `config-map-two.greetings.message` equal to `Say Hello from two`
577+
578+
Notice that `spring.cloud.kubernetes.config.useNameAsPrefix` has a _lower_ priority than `spring.cloud.kubernetes.config.sources.useNameAsPrefix`.
579+
This allows you to set a "default" strategy for all sources, at the same time allowing to override only a few.
580+
581+
If using the config map name is not an option, you can specify a different strategy, called : `explicitPrefix`. Since this is an _explicit_ prefix that
582+
you select, it can only be supplied to the `sources` level. At the same time it has a higher priority than `useNameASPrefix`. Let's suppose we have a third config map with these entries:
583+
584+
585+
====
586+
[source,yaml]
587+
----
588+
kind: ConfigMap
589+
apiVersion: v1
590+
metadata:
591+
name: config-map-three
592+
data:
593+
application.yml: |-
594+
greeting:
595+
message: Say Hello from three
596+
----
597+
====
598+
599+
A configuration like the one below:
600+
601+
====
602+
[source,yaml]
603+
----
604+
spring:
605+
application:
606+
name: with-prefix
607+
cloud:
608+
kubernetes:
609+
config:
610+
useNameAsPrefix: true
611+
namespace: default-namespace
612+
sources:
613+
- name: config-map-one
614+
useNameAsPrefix: false
615+
- name: config-map-two
616+
explicitPrefix: two
617+
- name: config-map-three
618+
----
619+
====
620+
621+
will result in three properties being generated:
622+
623+
- `greetings.message` equal to `Say Hello from one`.
624+
625+
- `two.greetings.message` equal to `Say Hello from two`.
626+
627+
- `config-map-three.greetings.message` equal to `Say Hello from three`.
628+
497629
NOTE: You should check the security configuration section. To access config maps from inside a pod you need to have the correct
498630
Kubernetes service accounts, roles and role bindings.
499631

@@ -659,7 +791,7 @@ spring:
659791
sources:
660792
# Spring Cloud Kubernetes looks up a Secret named s1 in namespace default-namespace
661793
- name: s1
662-
# Spring Cloud Kubernetes looks up a Secret named default-name in whatever namespace n2
794+
# Spring Cloud Kubernetes looks up a Secret named default-name in namespace n2
663795
- namespace: n2
664796
# Spring Cloud Kubernetes looks up a Secret named s3 in namespace n3
665797
- namespace: n3
@@ -669,6 +801,8 @@ spring:
669801

670802
In the preceding example, if `spring.cloud.kubernetes.secrets.namespace` had not been set,
671803
the `Secret` named `s1` would be looked up in the namespace that the application runs.
804+
See <<namespace-resolution,namespace-resolution>> to get a better understanding of how the namespace
805+
of the application is resolved.
672806

673807

674808
.Properties:
@@ -694,6 +828,44 @@ https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-Configuration-Bi
694828
You can find an example of an application that uses secrets (though it has not been updated to use the new `spring-cloud-kubernetes` project) at
695829
https://github.com/fabric8-quickstarts/spring-boot-camel-config[spring-boot-camel-config]
696830

831+
[[namespace-resolution]]
832+
=== Namespace resolution
833+
Finding an application namespace happens on a best-effort basis. There are some steps that we iterate in order
834+
to find it. The easiest and most common one, is to specify it in the proper configuration, for example:
835+
836+
====
837+
[source,yaml]
838+
----
839+
spring:
840+
application:
841+
name: app
842+
cloud:
843+
kubernetes:
844+
secrets:
845+
name: secret
846+
namespace: default
847+
sources:
848+
# Spring Cloud Kubernetes looks up a Secret named 'a' in namespace 'default'
849+
- name: a
850+
# Spring Cloud Kubernetes looks up a Secret named 'secret' in namespace 'b'
851+
- namespace: b
852+
# Spring Cloud Kubernetes looks up a Secret named 'd' in namespace 'c'
853+
- namespace: c
854+
name: d
855+
----
856+
====
857+
858+
Remember that the same can be done for config maps. If such a namespace is not specified, it will be read (in this order):
859+
860+
1. from property `spring.cloud.kubernetes.client.namespace`
861+
2. from a String residing in a file denoted by `spring.cloud.kubernetes.client.serviceAccountNamespacePath` property
862+
3. from a String residing in `/var/run/secrets/kubernetes.io/serviceaccount/namespace` file
863+
(kubernetes default namespace path)
864+
4. from a designated client method call (for example fabric8's : `KubernetesClient::getNamespace`), if the client provides
865+
such a method.
866+
867+
Failure to find a namespace from the above steps will result in an Exception being raised.
868+
697869
=== `PropertySource` Reload
698870

699871
WARNING: This functionality has been deprecated in the 2020.0 release. Please see
@@ -856,13 +1028,16 @@ The Kubernetes health indicator (which is part of the core module) exposes the f
8561028
* Pod name, IP address, namespace, service account, node name, and its IP address
8571029
* A flag that indicates whether the Spring Boot application is internal or external to Kubernetes
8581030

1031+
You can disable this `HealthContributor` by setting `management.health.kubernetes.enabled`
1032+
to `false` in `application.[properties | yaml]`.
1033+
8591034
== Info Contributor
8601035

8611036
Spring Cloud Kubernetes includes an `InfoContributor` which adds Pod information to
8621037
Spring Boot's `/info` Acturator endpoint.
8631038

8641039
You can disable this `InfoContributor` by setting `management.info.kubernetes.enabled`
865-
to `false` in `bootstrap.[properties | yaml]`.
1040+
to `false` in `application.[properties | yaml]`.
8661041

8671042
== Leader Election
8681043
The Spring Cloud Kubernetes leader election mechanism implements the leader election API of Spring Integration using a Kubernetes ConfigMap.

docs/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<parent>
99
<groupId>org.springframework.cloud</groupId>
1010
<artifactId>spring-cloud-kubernetes</artifactId>
11-
<version>2.0.5-SNAPSHOT</version>
11+
<version>2.0.4</version>
1212
</parent>
1313
<packaging>jar</packaging>
1414
<name>Spring Cloud Kubernetes Docs</name>

docs/src/main/asciidoc/_configprops.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
|spring.cloud.kubernetes.config.namespace | |
5353
|spring.cloud.kubernetes.config.paths | |
5454
|spring.cloud.kubernetes.config.sources | |
55+
|spring.cloud.kubernetes.config.use-name-as-prefix | `false` |
5556
|spring.cloud.kubernetes.discovery.all-namespaces | `false` | If discovering all namespaces.
5657
|spring.cloud.kubernetes.discovery.cache-loading-timeout-seconds | `60` | Timeout for initializing discovery cache, will abort the application if exceeded.
5758
|spring.cloud.kubernetes.discovery.enabled | `true` | If Kubernetes Discovery is enabled.
@@ -96,5 +97,6 @@
9697
|spring.cloud.kubernetes.secrets.namespace | |
9798
|spring.cloud.kubernetes.secrets.paths | |
9899
|spring.cloud.kubernetes.secrets.sources | |
100+
|spring.cloud.kubernetes.secrets.use-name-as-prefix | `false` |
99101

100102
|===

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
</parent>
3030

3131
<artifactId>spring-cloud-kubernetes</artifactId>
32-
<version>2.0.5-SNAPSHOT</version>
32+
<version>2.0.4</version>
3333
<packaging>pom</packaging>
3434
<name>Spring Cloud Kubernetes</name>
3535

spring-cloud-kubernetes-client-autoconfig/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>spring-cloud-kubernetes</artifactId>
77
<groupId>org.springframework.cloud</groupId>
8-
<version>2.0.5-SNAPSHOT</version>
8+
<version>2.0.4</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

spring-cloud-kubernetes-client-config/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>spring-cloud-kubernetes</artifactId>
77
<groupId>org.springframework.cloud</groupId>
8-
<version>2.0.5-SNAPSHOT</version>
8+
<version>2.0.4</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

spring-cloud-kubernetes-client-discovery/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>spring-cloud-kubernetes</artifactId>
77
<groupId>org.springframework.cloud</groupId>
8-
<version>2.0.5-SNAPSHOT</version>
8+
<version>2.0.4</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

spring-cloud-kubernetes-client-loadbalancer/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>spring-cloud-kubernetes</artifactId>
77
<groupId>org.springframework.cloud</groupId>
8-
<version>2.0.5-SNAPSHOT</version>
8+
<version>2.0.4</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

spring-cloud-kubernetes-commons/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.springframework.cloud</groupId>
77
<artifactId>spring-cloud-kubernetes</artifactId>
8-
<version>2.0.5-SNAPSHOT</version>
8+
<version>2.0.4</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

spring-cloud-kubernetes-controllers/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>spring-cloud-kubernetes</artifactId>
77
<groupId>org.springframework.cloud</groupId>
8-
<version>2.0.5-SNAPSHOT</version>
8+
<version>2.0.4</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111
<packaging>pom</packaging>

spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configuration-watcher/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>spring-cloud-kubernetes-controllers</artifactId>
77
<groupId>org.springframework.cloud</groupId>
8-
<version>2.0.5-SNAPSHOT</version>
8+
<version>2.0.4</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

spring-cloud-kubernetes-dependencies/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323
<parent>
2424
<artifactId>spring-cloud-dependencies-parent</artifactId>
2525
<groupId>org.springframework.cloud</groupId>
26-
<version>3.0.5-SNAPSHOT</version>
26+
<version>3.0.4</version>
2727
<relativePath/>
2828
</parent>
2929
<artifactId>spring-cloud-kubernetes-dependencies</artifactId>
30-
<version>2.0.5-SNAPSHOT</version>
30+
<version>2.0.4</version>
3131
<packaging>pom</packaging>
3232
<name>Spring Cloud Kubernetes :: Dependencies</name>
3333
<description>Spring Cloud Kubernetes Dependencies</description>

spring-cloud-kubernetes-examples/kubernetes-hello-world-example/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>spring-cloud-kubernetes-examples</artifactId>
77
<groupId>org.springframework.cloud</groupId>
8-
<version>2.0.5-SNAPSHOT</version>
8+
<version>2.0.4</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

spring-cloud-kubernetes-examples/kubernetes-leader-election-example/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.springframework.cloud</groupId>
88
<artifactId>spring-cloud-kubernetes-examples</artifactId>
9-
<version>2.0.5-SNAPSHOT</version>
9+
<version>2.0.4</version>
1010
</parent>
1111

1212
<artifactId>kubernetes-leader-election-example</artifactId>

spring-cloud-kubernetes-examples/kubernetes-loadbalancer-example/greeting-service/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>kubernetes-loadbalancer-example</artifactId>
77
<groupId>org.springframework.cloud</groupId>
8-
<version>2.0.5-SNAPSHOT</version>
8+
<version>2.0.4</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

spring-cloud-kubernetes-examples/kubernetes-loadbalancer-example/name-service/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>kubernetes-loadbalancer-example</artifactId>
77
<groupId>org.springframework.cloud</groupId>
8-
<version>2.0.5-SNAPSHOT</version>
8+
<version>2.0.4</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

spring-cloud-kubernetes-examples/kubernetes-loadbalancer-example/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>spring-cloud-kubernetes-examples</artifactId>
77
<groupId>org.springframework.cloud</groupId>
8-
<version>2.0.5-SNAPSHOT</version>
8+
<version>2.0.4</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111
<artifactId>kubernetes-loadbalancer-example</artifactId>

spring-cloud-kubernetes-examples/kubernetes-reload-example/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<parent>
2323
<artifactId>spring-cloud-kubernetes-examples</artifactId>
2424
<groupId>org.springframework.cloud</groupId>
25-
<version>2.0.5-SNAPSHOT</version>
25+
<version>2.0.4</version>
2626
</parent>
2727
<modelVersion>4.0.0</modelVersion>
2828

0 commit comments

Comments
 (0)