eladkal commented on issue #29973:
URL: https://github.com/apache/airflow/issues/29973#issuecomment-1460942477

   Something does look odd here but i'm not sure if it's related to templating 
as both cases it looks like wrong syntax?
   
   ```
   from datetime import datetime
   
   from kubernetes import client as k8s
   
   from airflow import DAG
   from airflow.models import Param
   from airflow.providers.cncf.kubernetes.operators.kubernetes_pod import 
KubernetesPodOperator
   
   with DAG(
       dag_id="my_kube_dag",
       start_date=datetime(2023, 3, 7),
       schedule_interval=None,
       catchup=False,
       params={
           "request_memory": Param("2000", type="string"),
           "request_cpu": Param("4000", type="string"),
           "limit_memory": Param("4G", type="string"),
           "limit_cpu": Param("5000", type="string"),
       }
   ) as dag:
       task1 = KubernetesPodOperator(
           namespace="default",
           image="ubuntu:16.04",
           cmds=["bash", "-cx"],
           arguments=["lalala"],
           task_id="task1",
           in_cluster=False,
           do_xcom_push=False,
           is_delete_operator_pod=False,
           container_resources=k8s.V1ResourceRequirements(
               limits={
                   "cpu": "1",
                   "memory": "1G",
               },
               requests={
                   "cpu": "1",
                   "memory": "1",
               },
           )
       )
   
       task2 = KubernetesPodOperator(
           namespace="default",
           image="ubuntu:16.04",
           cmds=["bash", "-cx"],
           arguments=["lalala"],
           task_id="task2",
           in_cluster=False,
           do_xcom_push=False,
           is_delete_operator_pod=False,
           container_resources=k8s.V1ResourceRequirements(
               limits={
                   "cpu": "{{ params.limit_cpu }}",
                   "memory": "{{ params.limit_memory }}",
               },
               requests={
                   "cpu": "{{ params.request_cpu }}",
                   "memory": "{{ params.request_memory }}",
               }
           )
       )
   
   ```
   
   task1:
   ![Screenshot 2023-03-09 at 0 07 
10](https://user-images.githubusercontent.com/45845474/223861758-9da25118-6eed-4677-b813-d44b6068c2c3.png)
   
   
   task2:
   ![Screenshot 2023-03-09 at 0 04 
35](https://user-images.githubusercontent.com/45845474/223861798-9b9de41b-bbb0-4db6-95ea-8c67edad960e.png)


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