-
Notifications
You must be signed in to change notification settings - Fork 99
Add EventHandler that remaps APIManager-based Route events to APIManager events #561
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
Add EventHandler that remaps APIManager-based Route events to APIManager events #561
Conversation
Some example log messages output in the new handler on some scenarios: When a zync-managed Route event happens:
When
When a zync-manasged route is found but its zync-que ownerreference is specified but it does not exist. This can happen for example when APIManager object is deleted:
|
|
At the moment I don't see a need to implement it for all cases. If we need it in the future we can change it 👍 . Additionally I do it that way as a sort of optimization for our use case where we know we routes will either directly have an ownerreference or be coming from zync-que
I'll take a look at it to see how it fits 👍 |
Regarding It uses different types and method signatures. We can implement using this. When operator-sdk upgrades to the newer version of controller-runtime we will have to migrate to the new types of EnqueueRequestsFromMapFunc. It shouldn't be too hard but it will be required. |
@eguzki I've refactored the apimanager routes handler to a handler.Mapper interface to be able to be used in a |
You are right. I'm doubting between simplifying to just look at the direct owner or leaving what we have right now to give it space in case we need to generalize it in the future. |
a98793c
to
50c3f6a
Compare
50c3f6a
to
4922a31
Compare
4922a31
to
ccd6fce
Compare
…APIManager events
ccd6fce
to
7021290
Compare
This PR contains a possible implementation on how to detect changes that happen on
Route
objects that are automatically created by Zync when an APIManager installation is performed. This needs additional specific logic because Zync-managed routes do not contain an OwnerReference to an APIManager, so the commonEnqueueRequestForOwner
handler cannot be used.It also implements remapping directly owned APIManager Route events to APIManager events (like the
backend
route).The approach that this PR follows is based on the K8s
EventHandler
mechanism (https://godoc.org/sigs.k8s.io/controller-runtime/pkg/handler#EventHandler):APIManagerRoutesEventMapper
has been implemented and it watches changes ofRoute
objects in the namespace. When thoseRoute
object change it inspects the event and:APIManagerRoutesEventMapper
handler.The contents of this PR are built on top of #549 PR.
If we consider this a suitable approach and maintainable over the long term we can merge to the other branch.