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:
[email protected]