- Notifications
You must be signed in to change notification settings - Fork221
-
Hi everyone, I'm trying to implement a system that is able to react to events in order to perform some operations. I have started asking thisfabric8io/kubernetes-client#4789 because I had troubles if some connection issues / not responsive kubernetes API, and i think it can be also related to this:fabric8io/kubernetes-client#4781 Given that, I'm trying a different approaches and I've tried also to implement a "little" operator. Seems all ok and it seems also more robust on lack of connection but the "issue" is that I don't know how (or if it's possible) to retrieve the old and the new resources on updates, basically similar to this:
What I wrote is like this:
But in this case I only have the "latest" resource, and not the previous one so I can't compare the status value in order to react to such events. Am I doing the right thing or should i do something else? Thank you very much for the big help! 😄 |
BetaWas this translation helpful?Give feedback.
All reactions
Replies: 3 comments 4 replies
-
Hi@rivamarco pls take a look on this: events are not there on purpose. |
BetaWas this translation helpful?Give feedback.
All reactions
-
Out of curiosity, where is the first example coming from? |
BetaWas this translation helpful?Give feedback.
All reactions
-
That is the API of the informer event handler |
BetaWas this translation helpful?Give feedback.
All reactions
-
D'oh! 🤦🏼 |
BetaWas this translation helpful?Give feedback.
All reactions
-
note that this issue only happens after a while, and it's quite rare. Was not reported by other users of JOSDK. What version of K8S are you using? |
BetaWas this translation helpful?Give feedback.
All reactions
-
Yes I wrote that just to give more context, the issue happened with fabric8 and not with JOSDK, that works well with reconnection but as you said I don't have access to "complete" events, so I can write the same code unfortunately. And yes, it happens after a while and rarely but I would like if possibile to have a more bullet proof code in order to don't miss events that are important. Anyway, k8s version is 1.23.5 for now |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
So just to clarify, it is not that case, that you would note receive an event if something changed. It can happen however that there were multiple events and you just receive the last one (still containing the latest resource). IMO it is impossible now to have all the events in all cases guaranteed. But that is why Kubernetes reconciliations are level based. If your logic really depends on events and diffs that is kinda smell, but there are some usecases that might require that. At least heard before. Pls take a look on this issue: Note this discussion on k8s slack:https://kubernetes.slack.com/archives/C0EG7JC6T/p1673376066590699 Basically there can be an additional periodic listing, however that won't assure that you don't miss an event in some case either. |
BetaWas this translation helpful?Give feedback.
All reactions
👍 1