-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
schedule reconnect in case of HTTP_GONE #1800
Conversation
Reset resource version to null and schedule reconnect in case of HTTP_GHONE
Can one of the admins verify this patch? |
Couldn't figure out how this could fail |
ok to test |
@honnix : Not your fault. Our tests are flaky. |
I seems I should fix these test cases as they look very relevant. |
I meant integration tests, not unit tests |
@rohanKanojia Yeah I'm working on it. Not very familiar with the code base, so I didn't find the test case. |
b93e136
to
22d79d1
Compare
kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/WatchTest.java
Outdated
Show resolved
Hide resolved
Now this makes me wondering whether watching from the beginning of history is a bad idea. Can someone point me how |
@@ -92,55 +92,38 @@ public void onClose(KubernetesClientException cause) {} | |||
} | |||
|
|||
@Test | |||
public void testOutdated() throws InterruptedException { | |||
logger.info("testOutdated"); | |||
public void testHttpErrorReconnectOutdatedAndModified() throws InterruptedException { |
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.
This file is not named properly and doesn't seem to be picked up by junit.
Maybe it is ok because when this happens, old resource versions got wiped out from history. |
@rohanKanojia PTAL again. Thanks. |
@honnix : Could you please add a line to CHANGELOG regarding this change? |
@rohanKanojia Sure. I saw that label but didn't realise I should update it. Will do. |
[merge] |
Thanks - appreciate the quick turn around. |
Likewise, thanks for pointing out the defect. |
I'm a novice, so.... could you please tell me when or why kubernetes api returns HTTP_GONE? |
In the context of a watch, it will return |
@xiateapu : ^^ |
Thanks for your answer ^ ^ |
^ ^ |
References: * ManageIQ/kubeclient#452 (comment) * fabric8io/kubernetes-client#1800 (comment) * kubernetes/kubernetes#25151 (comment) * kubernetes/kubernetes#35068 (comment) * https://github.com/kubernetes/kubernetes/blob/dde6e8e7465468c32642659cb708a5cc922add64/test/e2e/apimachinery/protocol.go#L68-L75 * https://kubernetes.io/docs/reference/using-api/api-concepts/#410-gone-responses * https://kubernetes.io/docs/reference/using-api/api-concepts/#efficient-detection-of-changes * https://www.baeldung.com/java-kubernetes-watch#1-resource-versions
References: * ManageIQ/kubeclient#452 (comment) * fabric8io/kubernetes-client#1800 (comment) * kubernetes/kubernetes#25151 (comment) * kubernetes/kubernetes#35068 (comment) * https://github.com/kubernetes/kubernetes/blob/dde6e8e7465468c32642659cb708a5cc922add64/test/e2e/apimachinery/protocol.go#L68-L75 * https://kubernetes.io/docs/reference/using-api/api-concepts/#410-gone-responses * https://kubernetes.io/docs/reference/using-api/api-concepts/#efficient-detection-of-changes * https://www.baeldung.com/java-kubernetes-watch#1-resource-versions
what about an informer?
I am asking this in the context of spring-cloud-kubernetes project. Previously, we had used Watches for detecting changes in config maps/secrets. I am trying to move to informers now. So our code is like this at the moment:
If I move this to informers, it seems that I should handle this in the same manner, something like:
I am a bit lost (due to my limited knowledge) between "this should be handled", or an informer (like a watcher) will know what to do on its own. Can some of the pros comment on this please? thank you. |
Hi @wind57 In any case, as suggested in some of the reported issues, Spring Cloud should migrate from using raw Watchers to Informers. Informers are self-healing, so as a client consumer you should not worry about reconnecting, and so on. You can use the For your use-case, you can consider Informers as improved Watchers which take care of all the stuff for you. |
thank you @manusa. this is exactly what I am trying to do currently, move to informers, it's almost ready For the time being I will comment As usual, much appreciate your answer. |
Reset resource version to null and schedule reconnect in case of HTTP_GHONE
This tries to address #1529