-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Re-watch events when disconnected from k8s API #570
Conversation
if (log.isDebugEnabled()) { | ||
log.warn("Try to re-watch: " + name, error); | ||
} | ||
watchConfigMap(name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we not get into some kind of infinite loop where we indefinitely retry here? It would be nice if we could add some backoff functionality or even just try a set number of times.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. I'll try to implement backoff because the errors reported in #558 occur periodically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added backoff functionality by ba47a20. Please check it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ryanjbaxter Should I make any additional changes?
@ryanjbaxter @yuusaku-t seems like I have same issue, watcher failed and doesn't reconnect again, what is the status of that PR? will it be merged soon? |
I'm waiting for a re-review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the slow response! Could you add some tests?
@ryanjbaxter I added test cases by 613eb3d. Could you please check? |
@yuusaku-t I was reviewing this with other team members and they were wondering if we could use Spring Retry? This could simplify the implementation a bit. Did you look into that at all? |
@ryanjbaxter I hadn't thought about using Spring Retry at all, because it's not included in the spring-cloud-kubernetes-config project's dependency libraries. Let me see if I can simplify the implementation using Spring Retry. |
@yuusaku-t thanks, one thought might to make it optional and have retry implementation of spring retry is on the class path |
Spring Retry is also being used in this PR #648 |
Will this also address #730 |
@ryanjbaxter Sorry for the delay in response. Could you please check 57bf977 ? |
I have also encountered this problem. |
When will it be fixed and released? |
I actually think this was addressed in this PR #842 It should be in our 2020.0.4 release |
If any errors occur and kubernetes client is disconnected from the API,
EventBasedConfigurationChangeDetector
should re-watch the events for external resources like ConfigMap. This patch implements theonClose
methods of Watcher for the error handling:ref: https://github.com/fabric8io/kubernetes-client/blob/v4.4.0/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/Watcher.java#L27
An example of the errors
In my case, the following exception is passed to
onClose
method under the same situation as reported in #558:The kubernetes client will not automatically reconnect when such an error occurs. The following code is causing the reconnection to be interrupted:
https://github.com/fabric8io/kubernetes-client/blob/v4.4.0/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/WatchConnectionManager.java#L285-L292
Releated Issues