KubernetesPodOperator new callbacks and allow multiple callbacks #44357
+214
−60
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.
I would like to have multiple callbacks in the kubernetes pod operator, and add two new callbacks.
on_manifest_finalization
would allow the callback to make changes just before the manifest is turned into a pod.on_pod_wrapup
would happen after the calls toon_pod_completion
but just before the pod is deleted.Adding both of these plus allowing multiple callbacks would allow you to do things in the kubernetes pod operator akin to how it approaches XComs but in a modular way. My use case here is I'm running DBT in kpo, and I want to do multiple things to the DBT artefacts after the DBT job has run, I could use
on_manifest_finalization
to insert an alpine sidecar with volumes mounted with the same intention as the XCom sidecar, where the sidecar keeps the volumes alive as files are extracted from it.on_pod_wrapup
would allow me to insert a single sidecar and have multiple callbacks run theiron_pod_completion
beforeon_pod_wrapup
kills the sidecar.