Fix pod_override serialization in DAG details and executor path#65407
Conversation
jason810496
left a comment
There was a problem hiding this comment.
Thanks for the fix, LGTM overall.
There was a problem hiding this comment.
Pull request overview
Fixes Kubernetes V1Pod (pod_override) serialization issues affecting both the DAG details FastAPI response and Airflow’s internal serialization path, preventing API 500s and avoiding accidental stringification before the Kubernetes executor consumes the config.
Changes:
- Sanitize
default_args["executor_config"]["pod_override"]inDAGDetailsResponseto avoid Pydantic serialization failures. - Ensure
BaseSerialization.serialize()forces a Kubernetes import attempt when encounteringV1Pod, so it serializes to a structured dict instead of falling back tostr(). - Add unit tests covering the DAG details API behavior and the V1Pod serialization regression.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| airflow-core/src/airflow/api_fastapi/core_api/datamodels/dags.py | Adds default_args sanitizer for executor_config.pod_override to keep DAG details responses JSON-serializable. |
| airflow-core/src/airflow/serialization/serialized_objects.py | Forces _has_kubernetes(attempt_import=True) for V1Pod serialization to avoid stringification. |
| airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dags.py | Adds a DAG details endpoint test asserting pod_override is sanitized in the response. |
| airflow-core/tests/unit/api_fastapi/core_api/datamodels/test_dags.py | Adds unit tests for _sanitize_pod_override and the default_args validator. |
| airflow-core/tests/unit/serialization/test_serialized_objects.py | Adds regression test ensuring V1Pod serialization triggers _has_kubernetes(attempt_import=True). |
62a4749 to
0943a65
Compare
Lee-W
left a comment
There was a problem hiding this comment.
I think we're good to merge it after resolving the conflict. thanks!
Sanitize default_args["executor_config"]["pod_override"] in DAG details responses without changing other default_args values, and make V1Pod serialization force the Kubernetes import path so executor config no longer falls back to stringification. This fixes two related Kubernetes serialization bugs: one where the DAG details API could fail when pod_override was present in default_args, and another where V1Pod objects could be flattened into strings before reaching the Kubernetes executor. The updated tests cover both the API response behavior and the serializer regression with real Kubernetes pod objects.
fc4e41e to
f3a666c
Compare
|
Hi maintainer, this PR was merged without a milestone set.
|
Backport failed to create: v3-2-test. View the failure log Run detailsNote: As of Merging PRs targeted for Airflow 3.X In matter of doubt please ask in #release-management Slack channel.
You can attempt to backport this manually by running: cherry_picker ff15983 v3-2-testThis should apply the commit to the v3-2-test branch and leave the commit in conflict state marking After you have resolved the conflicts, you can continue the backport process by running: cherry_picker --continueIf you don't have cherry-picker installed, see the installation guide. |
…he#65407) Sanitize default_args["executor_config"]["pod_override"] in DAG details responses without changing other default_args values, and make V1Pod serialization force the Kubernetes import path so executor config no longer falls back to stringification. This fixes two related Kubernetes serialization bugs: one where the DAG details API could fail when pod_override was present in default_args, and another where V1Pod objects could be flattened into strings before reaching the Kubernetes executor. The updated tests cover both the API response behavior and the serializer regression with real Kubernetes pod objects.
Sanitize default_args["executor_config"]["pod_override"] in DAG details responses without changing other default_args values, and make V1Pod serialization force the Kubernetes import path so executor config no longer falls back to stringification. This fixes two related Kubernetes serialization bugs: one where the DAG details API could fail when pod_override was present in default_args, and another where V1Pod objects could be flattened into strings before reaching the Kubernetes executor. The updated tests cover both the API response behavior and the serializer regression with real Kubernetes pod objects. (cherry picked from commit ff15983)
…) (#66898) Sanitize default_args["executor_config"]["pod_override"] in DAG details responses without changing other default_args values, and make V1Pod serialization force the Kubernetes import path so executor config no longer falls back to stringification. This fixes two related Kubernetes serialization bugs: one where the DAG details API could fail when pod_override was present in default_args, and another where V1Pod objects could be flattened into strings before reaching the Kubernetes executor. The updated tests cover both the API response behavior and the serializer regression with real Kubernetes pod objects. (cherry picked from commit ff15983) Co-authored-by: Ephraim Anierobi <splendidzigy24@gmail.com>
Sanitize default_args["executor_config"]["pod_override"] in DAG details responses without changing other default_args values, and make V1Pod serialization force the Kubernetes import path so executor config no longer falls back to stringification.
This fixes two related Kubernetes serialization bugs: one where the DAG details API could fail when pod_override was present in default_args, and another where V1Pod objects could be flattened into strings before reaching the Kubernetes executor. The updated tests cover both the API response behavior and the serializer regression with real Kubernetes pod objects.
Was generative AI tooling used to co-author this PR?
Generated-by: claude sonnet 4.6
closes: #57743