hkc-8010 opened a new pull request, #66471: URL: https://github.com/apache/airflow/pull/66471
Closes #66470 ## What this PR does This fixes the synchronous `KubernetesPodOperator` event polling path when the first `list_namespaced_event` response is empty. Today `PodManager.watch_pod_events()` only advances `resource_version` from individual event items. If the first response contains no items, the loop keeps calling `list_namespaced_event` without a `resource_version`, which can lead to repeated unversioned event LISTs during pod startup. This change seeds `resource_version` from the list response metadata immediately after `read_pod_events()` returns, so subsequent polls can use `resource_version_match="NotOlderThan"` even when the first response is empty. ## Why this is still needed Recent kubernetes provider fixes improved event handling in related areas, but they do not cover this specific synchronous empty-first-response path in `PodManager`. ## Tests Added a regression test covering: - first event list response has no items - response metadata includes `resource_version` - second poll uses that `resource_version` - second poll sets `resource_version_match="NotOlderThan"` ## Local validation Ran locally: - `prek run --from-ref upstream/main --to-ref HEAD` - `breeze testing providers-tests --backend postgres --python 3.10 --db-reset providers/cncf/kubernetes/tests/unit/cncf/kubernetes/utils/test_pod_manager.py providers/cncf/kubernetes/tests/unit/cncf/kubernetes/hooks/test_kubernetes.py` - `breeze testing providers-tests --backend sqlite --python 3.10 --db-reset --force-lowest-dependencies providers/cncf/kubernetes/tests/unit/cncf/kubernetes/utils/test_pod_manager.py providers/cncf/kubernetes/tests/unit/cncf/kubernetes/hooks/test_kubernetes.py` Note: pushing from the fork required bypassing a pre-push hook failure in `dev/registry` that also reproduces on clean `upstream/main` and is unrelated to this PR. ## Gen-AI disclosure This PR was created with assistance from generative AI tools. I reviewed and validated the generated changes locally, including static checks and targeted Breeze test runs. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
