From c2bf76cb9916c594e6ba91076a827583b11418e6 Mon Sep 17 00:00:00 2001 From: buildmaster Date: Wed, 14 Dec 2022 03:48:21 +0000 Subject: [PATCH] Bumping versions --- README.adoc | 30 +++++++++++++++++-- docs/src/main/asciidoc/_configprops.adoc | 1 + .../watch/CatalogWatchWithNamespacesIT.java | 6 ++-- 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/README.adoc b/README.adoc index b3dd55c4..3b08c5d7 100644 --- a/README.adoc +++ b/README.adoc @@ -237,15 +237,41 @@ Spring Cloud Kubernetes can also watch the Kubernetes service catalog for change milliseconds (by default it is `30000`). The heartbeat event will contain the target references (and their namespaces of the addresses of all endpoints (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 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. -The endpoints will be queried in either all namespaces (enabled via `spring.cloud.kubernetes.discovery.all-namespaces=true`), or -we will use: xref:property-source-config.adoc#namespace-resolution[Namespace Resolution]. +The endpoints will be queried in either : + - all namespaces (enabled via `spring.cloud.kubernetes.discovery.all-namespaces=true`) + - specific namespaces (enabled via `spring.cloud.kubernetes.discovery.namespaces`), for example: +``` +spring: + cloud: + kubernetes: + discovery: + namespaces: + - namespace-a + - namespace-b +``` + +- we will use: xref:property-source-config.adoc#namespace-resolution[Namespace Resolution] if the above two paths are not taken. In order to enable this functionality you need to add `@EnableScheduling` on a configuration class in your application. +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: + +``` +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + namespace: default + name: namespace-reader +rules: + - apiGroups: ["discovery.k8s.io"] + resources: ["endpointslices"] + verbs: ["get", "list", "watch"] +``` + == Kubernetes native service discovery Kubernetes itself is capable of (server side) service discovery (see: https://kubernetes.io/docs/concepts/services-networking/service/#discovering-services). diff --git a/docs/src/main/asciidoc/_configprops.adoc b/docs/src/main/asciidoc/_configprops.adoc index fc94dbf3..fa1fc6f0 100644 --- a/docs/src/main/asciidoc/_configprops.adoc +++ b/docs/src/main/asciidoc/_configprops.adoc @@ -74,6 +74,7 @@ |spring.cloud.kubernetes.discovery.order | `+++0+++` | |spring.cloud.kubernetes.discovery.primary-port-name | | |spring.cloud.kubernetes.discovery.service-labels | | +|spring.cloud.kubernetes.discovery.use-endpoint-slices | `+++false+++` | |spring.cloud.kubernetes.discovery.wait-cache-ready | `+++true+++` | |spring.cloud.kubernetes.leader.auto-startup | `+++true+++` | Should leader election be started automatically on startup. Default: true |spring.cloud.kubernetes.leader.config-map-name | `+++leaders+++` | Kubernetes ConfigMap where leaders information will be stored. Default: leaders diff --git a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-catalog-watcher/src/test/java/org/springframework/cloud/kubernetes/fabric8/catalog/watch/CatalogWatchWithNamespacesIT.java b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-catalog-watcher/src/test/java/org/springframework/cloud/kubernetes/fabric8/catalog/watch/CatalogWatchWithNamespacesIT.java index 997b5005..5f0f8166 100644 --- a/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-catalog-watcher/src/test/java/org/springframework/cloud/kubernetes/fabric8/catalog/watch/CatalogWatchWithNamespacesIT.java +++ b/spring-cloud-kubernetes-integration-tests/spring-cloud-kubernetes-fabric8-client-catalog-watcher/src/test/java/org/springframework/cloud/kubernetes/fabric8/catalog/watch/CatalogWatchWithNamespacesIT.java @@ -97,8 +97,10 @@ class CatalogWatchWithNamespacesIT { @BeforeEach void beforeEach() throws Exception { - client.namespaces().resource(new NamespaceBuilder().withNewMetadata().withName(NAMESPACE_A).and().build()).create(); - client.namespaces().resource(new NamespaceBuilder().withNewMetadata().withName(NAMESPACE_B).and().build()).create(); + client.namespaces().resource(new NamespaceBuilder().withNewMetadata().withName(NAMESPACE_A).and().build()) + .create(); + client.namespaces().resource(new NamespaceBuilder().withNewMetadata().withName(NAMESPACE_B).and().build()) + .create(); Fabric8Utils.setUpClusterWide(client, NAMESPACE_DEFAULT, Set.of(NAMESPACE_DEFAULT, NAMESPACE_A, NAMESPACE_B)); deployBusyboxManifests(); }