fuyi opened a new issue #8965:
URL: https://github.com/apache/airflow/issues/8965


   **Description**
   
   <!-- A short description of your feature -->
   
   According to the [Kubernetes Executor 
doc](https://airflow.apache.org/docs/stable/kubernetes.html),  
pod_mutation_hook is used to mutate pod object before sending to the Kubernetes 
client for scheduling. 
   
   We deploy Airflow in K8S environment and use both Kubernetes Executor and 
KubernetesPodOperator. We need to set almost completely different set of fields 
for Executor pod and KubernetesPodOperator pod. 
   
   Since `pod_mutation_hook` is applied to all Pod creation requests, we have 
to check which type of pod in the function then add a different set of K8S 
fields.
   
   Pseudo code:
   
   ```python
   
   def pod_mutation_hook:
      if pod.type == 'kubernetes executor workers pod':
           pod.annotations['pod-type'] = 'kubernetes-executor-worker-pod'
      if pod.type == 'PodOperator pod': 
           pod.annotations['pod-type'] = 'pod-operator-pod'
   ```
   
   The issues:
   
   * It is not clear what fields are applied to what Pod type
   * This is not good practice for separate of concerns.
   
   **Use case / motivation**
   
   I propose we keep `pod_mutation_hook` for mutating PodOperator pod and use a 
separate hook like `executor_pod_mutation_hook` to mutate Kuberenetes Executor 
pod.
   
   


----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to