eladkal commented on code in PR #26982:
URL: https://github.com/apache/airflow/pull/26982#discussion_r998721485


##########
airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py:
##########
@@ -163,6 +163,7 @@ class KubernetesPodOperator(BaseOperator):
         'config_file',
         'pod_template_file',
         'namespace',
+        'k8s_resources',

Review 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`:
   
   
https://github.com/apache/airflow/blob/53d68049d9bf4cec6b7d57545f15409dab0caed1/airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py#L220-L228
   
   
   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 



-- 
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]

Reply via email to