Skip to content

Commit c2bf76c

Browse files
committed
Bumping versions
1 parent e3ae419 commit c2bf76c

File tree

3 files changed

+33
-4
lines changed

3 files changed

+33
-4
lines changed

README.adoc

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,15 +237,41 @@ Spring Cloud Kubernetes can also watch the Kubernetes service catalog for change
237237
milliseconds (by default it is `30000`). The heartbeat event will contain the target references (and their namespaces of the addresses of all endpoints
238238
(for the exact details of what will get returned you can take a look inside `KubernetesCatalogWatch`). This is an implementation detail, and listeners of the heartbeat event
239239
should not rely on the details. Instead, they should see if there are differences between two subsequent heartbeats via `equals` method. We will take care to return a correct implementation that adheres to the equals contract.
240-
The endpoints will be queried in either all namespaces (enabled via `spring.cloud.kubernetes.discovery.all-namespaces=true`), or
241-
we will use: xref:property-source-config.adoc#namespace-resolution[Namespace Resolution].
240+
The endpoints will be queried in either :
242241

242+
- all namespaces (enabled via `spring.cloud.kubernetes.discovery.all-namespaces=true`)
243243

244+
- specific namespaces (enabled via `spring.cloud.kubernetes.discovery.namespaces`), for example:
244245

246+
```
247+
spring:
248+
cloud:
249+
kubernetes:
250+
discovery:
251+
namespaces:
252+
- namespace-a
253+
- namespace-b
254+
```
255+
256+
- we will use: xref:property-source-config.adoc#namespace-resolution[Namespace Resolution] if the above two paths are not taken.
245257

246258
In order to enable this functionality you need to add
247259
`@EnableScheduling` on a configuration class in your application.
248260

261+
By default, we use the `Endpoints`(see https://kubernetes.io/docs/concepts/services-networking/service/#endpoints) API to find out the current state of services. There is another way though, via `EndpointSlices` (https://kubernetes.io/docs/concepts/services-networking/endpoint-slices/). Such support can be enabled via a property: `spring.cloud.kubernetes.discovery.use-endpoint-slices=true` (by default it is `false`). Of course, your cluster has to support it also. As a matter of fact, if you enable this property, but your cluster does not support it, we will fail starting the application. If you decide to enable such support, you also need proper Role/ClusterRole set-up. For example:
262+
263+
```
264+
apiVersion: rbac.authorization.k8s.io/v1
265+
kind: Role
266+
metadata:
267+
namespace: default
268+
name: namespace-reader
269+
rules:
270+
- apiGroups: ["discovery.k8s.io"]
271+
resources: ["endpointslices"]
272+
verbs: ["get", "list", "watch"]
273+
```
274+
249275
== Kubernetes native service discovery
250276

251277
Kubernetes itself is capable of (server side) service discovery (see: https://kubernetes.io/docs/concepts/services-networking/service/#discovering-services).

docs/src/main/asciidoc/_configprops.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
|spring.cloud.kubernetes.discovery.order | `+++0+++` |
7575
|spring.cloud.kubernetes.discovery.primary-port-name | |
7676
|spring.cloud.kubernetes.discovery.service-labels | |
77+
|spring.cloud.kubernetes.discovery.use-endpoint-slices | `+++false+++` |
7778
|spring.cloud.kubernetes.discovery.wait-cache-ready | `+++true+++` |
7879
|spring.cloud.kubernetes.leader.auto-startup | `+++true+++` | Should leader election be started automatically on startup. Default: true
7980
|spring.cloud.kubernetes.leader.config-map-name | `+++leaders+++` | Kubernetes ConfigMap where leaders information will be stored. Default: leaders

spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-catalog-watcher/src/test/java/org/springframework/cloud/kubernetes/fabric8/catalog/watch/CatalogWatchWithNamespacesIT.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,10 @@ static void beforeAll() throws Exception {
9797

9898
@BeforeEach
9999
void beforeEach() throws Exception {
100-
client.namespaces().resource(new NamespaceBuilder().withNewMetadata().withName(NAMESPACE_A).and().build()).create();
101-
client.namespaces().resource(new NamespaceBuilder().withNewMetadata().withName(NAMESPACE_B).and().build()).create();
100+
client.namespaces().resource(new NamespaceBuilder().withNewMetadata().withName(NAMESPACE_A).and().build())
101+
.create();
102+
client.namespaces().resource(new NamespaceBuilder().withNewMetadata().withName(NAMESPACE_B).and().build())
103+
.create();
102104
Fabric8Utils.setUpClusterWide(client, NAMESPACE_DEFAULT, Set.of(NAMESPACE_DEFAULT, NAMESPACE_A, NAMESPACE_B));
103105
deployBusyboxManifests();
104106
}

0 commit comments

Comments
 (0)