davlum commented on a change in pull request #6230: [AIRFLOW-5413] Allow K8S 
worker pod to be configured from JSON/YAML file
URL: https://github.com/apache/airflow/pull/6230#discussion_r357419658
 
 

 ##########
 File path: airflow/kubernetes/worker_configuration.py
 ##########
 @@ -389,11 +386,14 @@ def make_pod(self, namespace, worker_uuid, pod_id, 
dag_id, task_id, execution_da
             envs=self._get_environment(),
             node_selectors=self.kube_config.kube_node_selectors,
             service_account_name=self.kube_config.worker_service_account_name,
-        )
+            pod_template_file_or_string=self.kube_config.pod_template_file
+        ).gen_pod()
 
-        pod = pod_generator.gen_pod()
-        pod.spec.containers[0].env_from = pod.spec.containers[0].env_from or []
-        pod.spec.containers[0].env_from.extend(self._get_env_from())
-        pod.spec.security_context = self._get_security_context()
+        if self.kube_config.pod_template_file:
 
 Review comment:
   The logic behind file and config options would be fairly complex. Would 
config override file or file override config? That would also further the 
complexity of this PR.
   I added some fairly meager validation 
[here](https://github.com/apache/airflow/blob/06e942e2c0a4009e731c33bf7c4f79ace0175a5a/airflow/executors/kubernetes_executor.py#L230)
 essentially just allowing the kube_configuration to be empty if 
`pod_template_file` is passed. The other alternative would be erroring on 
anything that is non-empty in the kube_config, which seems overly strict. 

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


With regards,
Apache Git Services

Reply via email to