You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to embed kopf in an application to perform some extra cluster functions as a response to events.
I can always use a global variable.
Actually, I have to go the embedding way as I want to build wrappers to take some custom arguments as input, validate them, form connection strings, and then start the kopf asyncio loop. Plus I have to pass these params around as every handler would need them.
This should be a pretty common ask, and I am not sure how is that done currently.
Checklist
I have read the documentation and searched there for the problem
I have searched in the GitHub Issues for similar questions
Keywords
"kopf pass context to handlers" on Google and in docs.
krish7919 Just to clarify: do you mean an arbitrary object of arbitrary class, which is passed through the call stack from the owning application down to the handlers (all of them), right? Something like a memo kwarg (per-resource container for arbitrary keys/fields), but global and of external origin?
Commented by krish7919 at 2020-04-15 21:33:47+00:00
Precisely. In Go, this is the context, or a struct with the values required.
Question
I would like to embed kopf in an application to perform some extra cluster functions as a response to events.
I can always use a global variable.
Actually, I have to go the embedding way as I want to build wrappers to take some custom arguments as input, validate them, form connection strings, and then start the kopf asyncio loop. Plus I have to pass these params around as every handler would need them.
This should be a pretty common ask, and I am not sure how is that done currently.
Checklist
I have read the documentation and searched there for the problem
I have searched in the GitHub Issues for similar questions
Keywords
"kopf pass context to handlers" on Google and in docs.
krish7919 Just to clarify: do you mean an arbitrary object of arbitrary class, which is passed through the call stack from the owning application down to the handlers (all of them), right? Something like a
memo
kwarg (per-resource container for arbitrary keys/fields), but global and of external origin?Precisely. In Go, this is the
context
, or astruct
with the values required.This is something that's interesting for our usage too, especially when we're constantly trying to connect to the Kuberentes API..
This issue also may be related to my question in #367
The text was updated successfully, but these errors were encountered: