kosteev commented on code in PR #43762:
URL: https://github.com/apache/airflow/pull/43762#discussion_r1832642155


##########
providers/src/airflow/providers/cncf/kubernetes/operators/pod.py:
##########
@@ -563,7 +563,7 @@ def log_matching_pod(self, pod: k8s.V1Pod, context: 
Context) -> None:
 
     def get_or_create_pod(self, pod_request_obj: k8s.V1Pod, context: Context) 
-> k8s.V1Pod:
         if self.reattach_on_restart:
-            pod = self.find_pod(self.namespace or 
pod_request_obj.metadata.namespace, context=context)
+            pod = self.find_pod(pod_request_obj.metadata.namespace or 
self.namespace, context=context)  # type: ignore

Review Comment:
   self.namespace is already used in `build_pod_request_obj` method:
   
https://github.com/apache/airflow/blob/0483ddad14adf13c3aa2564b2d1b894001ed790e/providers/src/airflow/providers/cncf/kubernetes/operators/pod.py#L1069
   
   The current logic of acquiring value for namespace is taking into account:
   - pod_template
   - self.namespace
   - hook_namespace
   - self._incluster_namespace
   - and also namespace can be overriden in pod_mutation_hook
   
   But this logic is incorporated in `build_pod_request_obj` method, and once 
namespace is resolved there, there is no need to resolve it again in other 
places.



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