-
Notifications
You must be signed in to change notification settings - Fork 14.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add pod_template_dict
field to KubernetesPodOperator
#33174
Conversation
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst)
|
I like the idea, but it needs at least some unit tests to be considered as worthy merging. Without tests it's prone to regressions. |
pod_template_content
field to KubernetesPodOperator
…zonur/airflow into pod_template_content_field
…zonur/airflow into pod_template_content_field
Added testcase |
pod_template_content
field to KubernetesPodOperator
pod_template_dict
field to KubernetesPodOperator
My first proposal was to add content string (in YAML format) but while writing unit tests, I realized that a pod template dictionary might be easier to use. What do you think? Refactored the code in my last commit. PTAL |
k = KubernetesPodOperator( | ||
task_id="task", | ||
random_name_suffix=randomize_name, | ||
pod_template_dict=pod_generator.PodGenerator.serialize_pod(templated_pod), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should support both types V1Pod
and dict 🤔
I tested it and it seems like when we use V1Pod
the template fields are not resolved. I will check if there is a simple solution for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My first intention was to make full_pod_spec
field templated instead of adding a new field. But templater does not resolve V1Pod
as you referred. I might have a simple solution, will try once I have some time 🤞
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good, LGTM
Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions. |
I would like to propose adding a new templated field to kubernetes pod operator. Currently, operator has
pod_template_file
field to create base pod spec but you need to create a file to use this feature. IMHO it might be useful to accept stream or content, thus users might easily configure the base pod spec.Use Case
I would like to write airflow dag which clones git repository and mounts volume for cloned branch. Branch name should be parameterized so that users can specify it while running the DAG. Example code: