Repository navigation
Conversation
…che#75014) Closes: apache#75014 Forward log_events_on_startup from GKEStartPodOperator and EksPodOperator to their respective deferrable pod triggers (GKEStartPodTrigger and EksPodTrigger). - GKEStartPodOperator forwards log_events_on_startup to GKEStartPodTrigger - GKEStartPodTrigger preserves log_events_on_startup on serialization only when False - EksPodOperator forwards log_events_on_startup to EksPodTrigger - EksPodTrigger accepts log_events_on_startup in __init__ (default True) and passes it to super().__init__ - Update cncf-kubernetes docs to state that GKE and EKS operators honor the flag in both sync and deferrable modes - Add unit and regression tests in Google and Amazon providers for operator forwarding, serialization/roundtrip, and disabled event watching in triggerer
shahar1
left a comment
There was a problem hiding this comment.
Could you please resolve conflicts and merge from latest main?
|
@shahar1 Done! Conflicts have been resolved and the branch is merged with latest |
| "last_log_time": self.last_log_time, | ||
| "trigger_kwargs": self.trigger_kwargs, | ||
| } | ||
| if not self.log_events_on_startup: |
There was a problem hiding this comment.
Any chance to reuse super().serialize() like EksPodTrigger does? This block is now a copy of the base class logic, and the next parameter added to KubernetesPodTrigger will get lost the same way.
There was a problem hiding this comment.
+1. This ties into your other note too: even if the operator forwarded startup_check_interval, on_kill_action and termination_grace_period, this serialize() would drop them. Building on super().serialize() fixes that half, so it's probably easiest to do both together, here or in the follow-up.
There was a problem hiding this comment.
Agreed! As @o-nikolas pointed out, refactoring GKEStartPodTrigger.serialize() to build on super().serialize() goes hand-in-hand with forwarding startup_check_interval, on_kill_action, and termination_grace_period. I will open a dedicated follow-up PR for both right after this lands so we can keep this PR focused strictly on #75014.
closes: #75014
Description
#75016 introduced
log_events_on_startup(defaulting toTrue) toKubernetesPodOperatorandKubernetesPodTriggerto allow disabling the startup pod event watcher on clusters with high event churn.While
GKEStartPodOperatorandEksPodOperatorinherit fromKubernetesPodOperatorand honored the flag in synchronous mode, the parameter was lost in deferrable mode:GKEStartPodOperator.invoke_defer_methodconstructedGKEStartPodTriggerwith an explicit argument list omittinglog_events_on_startup, andGKEStartPodTrigger.serialize()did not preserve it.EksPodOperator.invoke_defer_methodconstructedEksPodTriggerwithoutlog_events_on_startup, andEksPodTrigger.__init__had a fixed keyword-only signature withoutlog_events_on_startupor**kwargs.Changes
log_events_on_startup=self.log_events_on_startupinGKEStartPodOperator.invoke_defer_method.GKEStartPodTrigger.serialize()to conditionally emit"log_events_on_startup": Falseonly when disabled, keeping default serialization identical and backwards-compatible with older triggerers.log_events_on_startup=self.log_events_on_startupinEksPodOperator.invoke_defer_method.log_events_on_startup: bool = TruetoEksPodTrigger.__init__and pass it tosuper().__init__().False,super().serialize()emits it andEksPodTriggerdeserializes cleanly.providers/cncf/kubernetes/docs/operators.rstto remove the limitation stating that GKE and EKS deferrable triggers do not forward the parameter.test_invoke_defer_method), conditional serialization (test_serialize_emits_log_events_on_startup_only_when_disabled), and disabled event watching in_wait_for_pod_start.test_invoke_defer_method_passes_log_events_on_startup_to_trigger), serialization round-trip (test_serialize_emits_log_events_on_startup_only_when_disabled), and disabled event watching in_wait_for_pod_start.Compatibility & Dependencies
True).apache-airflow-providers-cncf-kubernetes>=11.0.0is already in place for Amazon and>=10.25.0for Google, both shippinglog_events_on_startup.Was generative AI tooling used to co-author this PR?
[✓] Yes (please specify the tool below)
Generated-by: Antigravity following the guidelines https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions