Skip to content
This repository has been archived by the owner on Aug 9, 2022. It is now read-only.

Handle error events #16

Closed
Tracked by #58
mudler opened this issue Apr 5, 2022 · 7 comments
Closed
Tracked by #58

Handle error events #16

mudler opened this issue Apr 5, 2022 · 7 comments
Assignees
Labels

Comments

@mudler
Copy link
Contributor

mudler commented Apr 5, 2022

Currently errors during syncing are printed out in the operator logs, but ideally those should be streamed back as kubernetes events of the corresponding resource. Besides, there are many TODO in the code relative exactly to this. So we should pass errors by to the event reporter

Follow up of #14

@Itxaka
Copy link
Contributor

Itxaka commented Apr 5, 2022

ok, so if I understood this correctly this is generating error events for the resource pod that is running the operator, i.e. print the errors by doing kubectl describe -n cattle-rancheros-operator-system pod/rancheros-operator-6fd66bd6b4-2k8vv and check the events....

Is that even possible lol? I been a couple of hours checking this and I dont understand crap :D I cant make sense on this with all the wrangler stuff in the middle.

@mudler any pointers that I can have a look at?

@mudler
Copy link
Contributor Author

mudler commented Apr 6, 2022

I'm not sure in wrangler context, but with standard k8s api that would involve using "k8s.io/client-go/tools/record" to stream back events recording from the controller. The event recorder can be retrieved in the manager GetEventRecorderFor sigs.k8s.io/controller-runtime/pkg/manager

We could also think at status reporting for now, so we can propagate at least the error back into the object status, but reporting to events is something that in general we should have in place as a mechanism.

@Itxaka
Copy link
Contributor

Itxaka commented Apr 6, 2022

yeah, that I could find about the "standard way" of getting the recorder and the manager but Im pretty lost on where to init that crap in our context with all the autogenerated stuff. AFAI can see, we got no manager around in the wrangler context? anyway, gonna look harder

@mudler mudler mentioned this issue Apr 6, 2022
@mudler
Copy link
Contributor Author

mudler commented Apr 7, 2022

I'm trying to have a look at how make recorder generally available while working on #23 , but I won't cover propagating back errors from all the involved parts, just covering the new component

@mudler
Copy link
Contributor Author

mudler commented Apr 7, 2022

it is included here: #26 although, I've still not added tests for it yet

@mudler
Copy link
Contributor Author

mudler commented Apr 7, 2022

@Itxaka seem to work, there are still other places where to inject the same logic, but a basic step into it it's in #26

@Itxaka
Copy link
Contributor

Itxaka commented Apr 13, 2022

closed by #27

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants