From 3f0058f14005631d23331d5ca28bf23da74b1ad4 Mon Sep 17 00:00:00 2001 From: buildmaster Date: Fri, 23 Sep 2022 04:00:40 +0000 Subject: [PATCH] Bumping versions --- README.adoc | 29 ++++++++++++++++--- .../configuration/watcher/WatcherUtil.java | 2 +- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/README.adoc b/README.adoc index dd884b1d..6275d043 100644 --- a/README.adoc +++ b/README.adoc @@ -1609,11 +1609,32 @@ Spring Cloud Kubernetes Configuration Watcher will react to changes in ConfigMap or any Secret with a label of `spring.cloud.kubernetes.secret` with the value `true`. If the ConfigMap or Secret does not have either of those labels or the values of those labels is not `true` then any changes will be ignored. -The labels Spring Cloud Kubernetes Configuration Watcher looks for on ConfigMaps and Secrets can be changed by setting -`spring.cloud.kubernetes.configuration.watcher.configLabel` and `spring.cloud.kubernetes.configuration.watcher.secretLabel` respectively. - If a change is made to a ConfigMap or Secret with valid labels then Spring Cloud Kubernetes Configuration Watcher will take the name of the ConfigMap or Secret -and send a notification to the application with that name. +and send a notification to the application with that name. This might not be enough for your use-case though, you could for example what to: + +- bind a config-map to multiple applications, so that a change inside a single configmap triggers a refresh for many services +- have profile based sources trigger events for your application + +For that reasons there is an addition annotation you could specify: + +`spring.cloud.kubernetes.configmap.apps` or `spring.cloud.kubernetes.secret.apps`. It takes a String of apps separated by comma, +that specifies the names of applications that will receive a notification when changes happen in this secret/configmap. + +For example: + +==== +[source,yaml] +---- +kind: ConfigMap +apiVersion: v1 +metadata: + name: example-configmap + labels: + spring.cloud.kubernetes.config: "true" + annotations: + spring.cloud.kubernetes.configmap.apps: "app-a, app-b" +---- +==== ### HTTP Implementation diff --git a/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configuration-watcher/src/main/java/org/springframework/cloud/kubernetes/configuration/watcher/WatcherUtil.java b/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configuration-watcher/src/main/java/org/springframework/cloud/kubernetes/configuration/watcher/WatcherUtil.java index a04ff645..f1347b24 100644 --- a/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configuration-watcher/src/main/java/org/springframework/cloud/kubernetes/configuration/watcher/WatcherUtil.java +++ b/spring-cloud-kubernetes-controllers/spring-cloud-kubernetes-configuration-watcher/src/main/java/org/springframework/cloud/kubernetes/configuration/watcher/WatcherUtil.java @@ -62,7 +62,7 @@ final class WatcherUtil { LOG.info(() -> "will schedule remote refresh based on apps : " + apps); apps.forEach(appName -> schedule(type, appName, refreshDelay, executorService, triggerRefresh, - kubernetesObject)); + kubernetesObject)); } else {