KubernetesPodOperator add container_resources as templated field#26982
KubernetesPodOperator add container_resources as templated field#26982alanatlemba wants to merge 0 commit intoapache:mainfrom
KubernetesPodOperator add container_resources as templated field#26982Conversation
|
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)
|
KubernetesPodOperator add container_resources as templated field
|
@eladkal thanks for triggering the run before. I'm unfamiliar with the failed. I don't think I touched anything around it, and that test is succeeding on my breeze tests. Could we please re-trigger it? thanks again. |
|
perhaps I should just update the branch to re-trigger? |
| 'config_file', | ||
| 'pod_template_file', | ||
| 'namespace', | ||
| 'k8s_resources', |
There was a problem hiding this comment.
Did you mean container_resources?
There was a problem hiding this comment.
@eladkal I wasn't sure, so I went with the comment on the previous PR on this --
There was a problem hiding this comment.
I'm also perplexed as to why I'm getting failures on google auth credentials
There was a problem hiding this comment.
I don't think this was right?
What users are doing is:
compute_resources=k8s.V1ResourceRequirements(
requests={
'memory': '512Mi',
'cpu': '500m'
},
limits={
'memory': '1Gi',
'cpu': 500m
}
)
KubernetesPodOperator(..., container_resources=compute_resources)
But what they want to do is instead of specifying hard coded values like 512Mi they want it to be templated so something like:
requests={
'memory': '{{ dag_run.conf["request_memory"] }} ',
'cpu': '500m'
}
note that the k8s_resources is not a field exposed to the users.
It is used mainly for backward compatibility where users used to pass resources in dict rather than V1ResourceRequirements:
airflow/airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py
Lines 220 to 228 in 53d6804
I think we are also about to remove this support for resources in the next release of the provider so the k8s_resources will no longer be needed? cc @jedcunningham @dstandish
There was a problem hiding this comment.
@eladkal thanks for the detailed review. I will get to this later today!
There was a problem hiding this comment.
thanks @eladkal I will rebase and re-push this PR once that PR is merged.
There was a problem hiding this comment.
Huzzah! @eladkal I'll rebase & re-push tomorrow. thx :)
|
@jedcunningham github removed you from the reviewer list when I added @eladkal . this was not intended, and it seems I cannot add you back :( |
I've added Jed back as a reviewer :) |
|
conflicts need resolution. |
|
I didn't mean to close this - I just updated my fork. I'll just link to this when I create a new PR |
|
#27457 raised after rebase. FYI @potiuk , @eladkal @jedcunningham |
closes: #23529
This is my first PR for a mainstream large scale open source project, let alone Airflow.
Sorry in advance if I've done anything improper, and thanks for your patience.
Thank you @nitinmuteja & @lior1990 for doing much of the work. This is following up on this closed/abandoned PR: #23531
Here is how I tested:
breeze testing tests --test-type "Providers[cncf]"breeze k8s run-complete-testsI'm not sure if further testing is necessary. Should I bother making sure that I see a mapped k8s pod operator dag run with the expected resources? I may need some help working through that. :)
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rstor{issue_number}.significant.rst, in newsfragments.