Operator-level memos, optionally passed into embedded operators #667
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Extend the existing
memo
kwarg to operators' handlers and embedded operators' options, and connect global memos to per-resource memos.Now, an external memo can be passed into an embedded operator via
memo=
option, and all the keys will be seen both in operator-level and resource-level handlers. An object of any arbitrary class can be passed as the operator's memo, as long as all handlers understand it and use it accordingly, and it is capable of shallow-copying.Alternatively or in addition to that, a default
memo
dictionary (kopf.Memo
) can be populated in the operator-level startup handlers, and all the keys will also be seen in all the resource-level handlers.With Python's mutable structures as values (lists, dicts, or new memos), all handlers can exchange information across all resources of all resource kinds if needed — i.e. globally (an equivalent of global variables).
closes #347, closes #367