Skip to content

Conversation

@wind57
Copy link
Contributor

@wind57 wind57 commented Aug 31, 2022

No description provided.


private final ResourceEventHandler<V1ConfigMap> handler = new ResourceEventHandler<>() {

@Override
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just renames here - nothing else

private final ResourceEventHandler<V1Secret> handler = new ResourceEventHandler<>() {

@Override
public void onAdd(V1Secret obj) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renames only

@Override
public Mono<Void> triggerRefresh(KubernetesObject configMap) {
return busRefreshTrigger.triggerRefresh(configMap);
public Mono<Void> triggerRefresh(KubernetesObject configMap, String appName) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can have multiple apps based in a configMap/secret now

*/

package org.springframework.cloud.kubernetes.configuration.watcher;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the main changes are in this class.

<artifactId>spring-cloud-kubernetes-client-configmap-event-reload-multiple-apps</artifactId>
<packaging>pom</packaging>

<modules>
Copy link
Contributor Author

@wind57 wind57 Sep 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

an integration test where two apps are deployed, one configmap that has the new annotation in place: that refresh both of the apps

}, refreshDelay, TimeUnit.MILLISECONDS);
Set<String> apps = apps(kubernetesObject, annotationName);

if (!apps.isEmpty()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the crox of the change is here: if the annotation that says we should restart multiple apps is present - try to get apps from it, and send events based on those names

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could simplify this a bit if we add the name to the set if its empty

<artifactId>spring-cloud-kubernetes-client-secrets-event-reload-multiple-apps</artifactId>
<packaging>pom</packaging>

<modules>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

two apps that react as a result of a secret being deployed with proper label and annotation. Just proves that we expect both applications to be updated


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:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added documentation here for the new properties

@wind57 wind57 marked this pull request as ready for review September 17, 2022 12:45
@wind57
Copy link
Contributor Author

wind57 commented Sep 17, 2022

@ryanjbaxter ready to be looked at

}, refreshDelay, TimeUnit.MILLISECONDS);
Set<String> apps = apps(kubernetesObject, annotationName);

if (!apps.isEmpty()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could simplify this a bit if we add the name to the set if its empty

@wind57 wind57 requested a review from ryanjbaxter September 21, 2022 09:01
@wind57
Copy link
Contributor Author

wind57 commented Sep 21, 2022

@ryanjbaxter take a look please to see if I got your point correct. thank you

@ryanjbaxter ryanjbaxter merged commit 6e61cf2 into spring-cloud:main Sep 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ability to refresh configuration of Spring Cloud app when multiple configmaps get changed

3 participants