alex-astronomer commented on a change in pull request #18615:
URL: https://github.com/apache/airflow/pull/18615#discussion_r719658930



##########
File path: airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py
##########
@@ -325,6 +324,16 @@ def create_labels_for_pod(context) -> dict:
     def create_pod_launcher(self) -> Type[pod_launcher.PodLauncher]:
         return pod_launcher.PodLauncher(kube_client=self.client, 
extract_xcom=self.do_xcom_push)
 
+    def _build_env_vars(self):
+        """
+        Convert env vars into expected object (should happen after templating) 
and add the
+        pod_runtime_info_envs to the env also.
+
+        """
+        self.env_vars = convert_env_vars(self.env_vars) if self.env_vars else 
[]
+        if self.pod_runtime_info_envs:
+            self.env_vars.extend([convert_pod_runtime_info_env(p) for p in 
self.pod_runtime_info_envs])
+

Review comment:
       Shouldn't take too long!  Check out the source for `convert_env_vars`:
   
   ```
   def convert_env_vars(env_vars) -> List[k8s.V1EnvVar]:
       """
       Converts a dictionary into a list of env_vars
   
       :param env_vars:
       :return:
       """
       if isinstance(env_vars, dict):
           res = []
           for k, v in env_vars.items():
               res.append(k8s.V1EnvVar(name=k, value=v))
           return res
       elif isinstance(env_vars, list):
           return env_vars
       else:
           raise AirflowException(f"Expected dict or list, got 
{type(env_vars)}")
   ```




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