You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/01/18 06:50:28 UTC

[GitHub] [airflow] shihabcsedu09 opened a new issue #13734: Macros not working on Kubernetes Operator

shihabcsedu09 opened a new issue #13734:
URL: https://github.com/apache/airflow/issues/13734


   **Apache Airflow version**: 2.0.0
   
   **Kubernetes version (if you are using kubernetes)** (use `kubectl version`): 1.18.10
   
   **Environment**:
   
   - **Cloud provider or hardware configuration**: Azure AKS
   - **OS** (e.g. from /etc/os-release): Linux
   - **Kernel** (e.g. `uname -a`): Linux
   - **Install tools**: All
   
   **What happened**:
   
   While injecting execution date and previous execution date success as environment variables using macros the values are not rendered in the pod
   
   **What you expected to happen**:
   
   Values are correctly rendered in the pod so that I can use that in my task.
   
   **How to reproduce it**:
   
   1. Define Kubernetes environment variable like this
   ` k8s_env_variable = k8s.V1EnvVar(
               name='execution_date_1',
               value='{{ ts }}'
           )`
   2. Inject it in the operator 
   ```
   KubernetesPodOperator(
               namespace='airflow',
               name=name,
               task_id=name,
               image="Use your dag image id",
               env_vars=[k8s_env_variable],
               image_pull_policy='Always',
               get_logs=True,
               log_events_on_failure=True,
               resources=resources,
               is_delete_operator_pod=True,
               node_selector={'agentpool': 'airflowtasks'},
               termination_grace_period=60
           )
   ```
   3. Print execution date in your dag
   ```
   import os
   print(os.getenv('execution_date'))
   ```
   4. It should have printed the correct execution date instead of nothing.
   
   If you are using kubernetes, please attempt to recreate the issue using minikube or kind.
   
   ## Install minikube/kind
   
   - Minikube https://minikube.sigs.k8s.io/docs/start/
   - Kind https://kind.sigs.k8s.io/docs/user/quick-start/
   
   
   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] mik-laj commented on issue #13734: Macros not working on Kubernetes Operator

Posted by GitBox <gi...@apache.org>.
mik-laj commented on issue #13734:
URL: https://github.com/apache/airflow/issues/13734#issuecomment-762255276


   Duplicate: https://github.com/apache/airflow/issues/13522


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] boring-cyborg[bot] commented on issue #13734: Macros not working on Kubernetes Operator

Posted by GitBox <gi...@apache.org>.
boring-cyborg[bot] commented on issue #13734:
URL: https://github.com/apache/airflow/issues/13734#issuecomment-762025488


   Thanks for opening your first issue here! Be sure to follow the issue template!
   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] mik-laj closed issue #13734: Macros not working on Kubernetes Operator

Posted by GitBox <gi...@apache.org>.
mik-laj closed issue #13734:
URL: https://github.com/apache/airflow/issues/13734


   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org