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
The update of kind: ChildResource should run the logic of the child resource and update the ParentResource without re-runinng the logic of child resource.
Actual Behavior
When updating the ChildResource and try to update the spec of ParentResource the logic of ChildResourcewill re trigger.
Can you please clarify on "… without re-runinng the logic of child resource"? What is "re-running" here? When and how does it happen? Maybe a simplified example would help?
If there is a handler defined for the child resource, and an update happens, it is reasonable to expect that the handler will be executed.
One way to avoid this is to use @kopf.on.field(..., field='spec.something') handler, which will be called only when spec.something or spec.something.deeper fields are changed, but not when e.g. status.message or metadata.labels are changed — this will be silently ignored (with no logs).
There are few restrictions though. The spec stenza triggers the update handlers always, for any sub-field. Same is true for top-level data fields (not in spec/status/meatdata). The status stenza — only if some of the fields are explicitly awaited in @kopf.on.field() decorators, and is ignored otherwise. The metadata stenza triggers the handlers only for labels & annotations (except for a couple of known "system annotations"), and ignores the rest of the system fields.
So, it is possible to define the handlers that are executed not for any resource update, but for some fields-of-interest only.
There are also plans for a more advanced cross-resource communication (see #58 (comment) and ideation gist) — but the syntax/DSL is not yet clear enough to express this as an issue. The last two ideas in that gist (lines 229+) look like the way to go.
Nevertheless, the communication will be implicitly performed through the resources' status fields. Which, in turn, will trigger the handlers, if those handlers are defined to react to these status fields (as described above).
The text was updated successfully, but these errors were encountered:
Expected Behavior
Handle
kopf.on.update
for subresourcesLet's say that i want to handle subresources updates and updating the parent resources. For example:
The update of
kind: ChildResource
should run the logic of the child resource and update theParentResource
without re-runinng the logic of child resource.Actual Behavior
When updating the
ChildResource
and try to update the spec ofParentResource
the logic ofChildResource
will re trigger.Specifications
GKE
python --version
)pip freeze --all
)Can you please clarify on "… without re-runinng the logic of child resource"? What is "re-running" here? When and how does it happen? Maybe a simplified example would help?
If there is a handler defined for the child resource, and an update happens, it is reasonable to expect that the handler will be executed.
One way to avoid this is to use
@kopf.on.field(..., field='spec.something')
handler, which will be called only whenspec.something
orspec.something.deeper
fields are changed, but not when e.g.status.message
ormetadata.labels
are changed — this will be silently ignored (with no logs).There are few restrictions though. The
spec
stenza triggers the update handlers always, for any sub-field. Same is true for top-level data fields (not in spec/status/meatdata). Thestatus
stenza — only if some of the fields are explicitly awaited in@kopf.on.field()
decorators, and is ignored otherwise. Themetadata
stenza triggers the handlers only for labels & annotations (except for a couple of known "system annotations"), and ignores the rest of the system fields.This logic is expressed in the resource's essence extraction.
So, it is possible to define the handlers that are executed not for any resource update, but for some fields-of-interest only.
There are also plans for a more advanced cross-resource communication (see #58 (comment) and ideation gist) — but the syntax/DSL is not yet clear enough to express this as an issue. The last two ideas in that gist (lines 229+) look like the way to go.
Nevertheless, the communication will be implicitly performed through the resources' status fields. Which, in turn, will trigger the handlers, if those handlers are defined to react to these status fields (as described above).
The text was updated successfully, but these errors were encountered: