Replies: 2 comments 7 replies
-
Hi @rivamarco ! Thanks for this discussion! @csviri implemented basically all of this logic in the JOSDK: https://github.com/java-operator-sdk/java-operator-sdk Additionally, the JOSDK should be pretty usable even from a Scala project (please open issues if you find rough edges) despite the need for Annotations 😝 . |
Beta Was this translation helpful? Give feedback.
-
@rivamarco I assume you don't write an operator, if you do, pls consider using JOSDK, where it is implemented. If leadership is lost what we do is just exit the process (System.exit). Since we don't want to have parallel processing, I guess since you do leader election might be a good idea for you. In this case we can assume that other instance is already the leader. Regarding self healing and events, in Informer that is already built int, if you mean that. |
Beta Was this translation helpful? Give feedback.
-
Hi everyone,
I would like to build an event handler (i.e. something that will constantly receive some add, update and delete events) inside a Scala microservice, in order to watch for kubernetes resources that is resilient and in particular that:
So I've tried to build something using LeaderElection + SharedInformers (this is a very little example):
What I noticed is that this piece of code may fail (because of network error or also because of Kuberetes API errors) and is not able to restart itself if the leadership is lost.
I've also tried to put the
elector.run()
inside a while loop but it seems is not working correctly.I don't know if i have to build an external structure to perform this kind of self healing process or if there is something out of the box.
I think I'm doing something wrong but I can't figure out what.
Thank you for your help
Beta Was this translation helpful? Give feedback.
All reactions