git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Passing Custom Env variables while launching k8 Pod


Hi All, 
Is there a way to provide  env variables while launching K8 pod through K8 executor.
we need to pass some env variable which are referred inside our Airflow Operator.
so can we provide custom env variable to docker run command while launching task pod.
Currently it seems that it supports predefined env variable.
worker_configuration.py
    def _get_environment(self):
        """Defines any necessary environment variables for the pod executor"""
        env = {
            'AIRFLOW__CORE__DAGS_FOLDER': '/tmp/dags',
            'AIRFLOW__CORE__EXECUTOR': 'LocalExecutor'
        }
        if self.kube_config.airflow_configmap:
            env['AIRFLOW__CORE__AIRFLOW_HOME'] = self.worker_airflow_home
        return env

Thanks,
Raman Gupta