Replies: 4 comments 1 reply
-
I'd like to contribute to this, but I am unaware if this was attempted before and perhaps some limitation in the K8s API prevents this. Naively, I don't understand what possible implementation detail prevents us from doing: One option is to rely on a private method as it's how airflow/airflow/providers/cncf/kubernetes/pod_generator.py Lines 559 to 572 in ba053f7 There are few others options involving writing our own deserializer or just serialize to YAML and pass it similar to |
Beta Was this translation helpful? Give feedback.
-
@ketozhang |
Beta Was this translation helpful? Give feedback.
-
@ketozhang can you make a DAG example showing how this would look? We had something kind of like this in earlier versions of the k8sexecutor and it did not go very well. I'm open to hearing more but want to be careful. |
Beta Was this translation helpful? Give feedback.
-
This sounds similar to how KPOs and k8sexecutor configs were defined pre-2.0. See #10393 for context for this was removed. Simplifying would be amazing, but agree with @dimberman that we need to tread carefully. I am going to convert this into a discussion so we can brainstorm examples of how this will look. |
Beta Was this translation helpful? Give feedback.
-
Description
KubernetesPodOperator
and operator'spod_override
support the K8s Python API data models/types and in some cases also supports passing in Python standard data types (e.g.,env_vars
,cmds
, etc).It would be nice to expand the cases to allow defining all K8s spec with Python standard data types instead of using the API's data types. Users would have to sacrifice type integrity, but they have options to use type hinting (e.g., with the K8s type stubs package).
Current alternative is to rely on
pod_template_dict
.Use case/motivation
pod_override: dict | V1Pod
ports: list[int] | list[V1ContainerPort]
volume_mounts: list[dict] | list[V1VolumeMount]
volumes: list[dict] | list[V1Volume]
Related issues
No response
Are you willing to submit a PR?
Code of Conduct
Beta Was this translation helpful? Give feedback.
All reactions