You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/11/03 20:29:40 UTC

[GitHub] [airflow] ferruzzi opened a new pull request #19398: Decouple name randomization from name kwarg

ferruzzi opened a new pull request #19398:
URL: https://github.com/apache/airflow/pull/19398


   Moved KubernetesPodOperator.name randomization behind a new feature flag, defaulted to True so random name suffix can be used with pod templates or full specs are used.
   
   closes: https://github.com/apache/airflow/issues/15434


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] ferruzzi commented on a change in pull request #19398: Decouple name randomization from name kwarg

Posted by GitBox <gi...@apache.org>.
ferruzzi commented on a change in pull request #19398:
URL: https://github.com/apache/airflow/pull/19398#discussion_r743784073



##########
File path: airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py
##########
@@ -484,6 +489,11 @@ def create_pod_request_obj(self) -> k8s.V1Pod:
             ),
         )
 
+        if self.random_name_suffix:
+            if pod_template:
+                pod_template.metadata.name = PodGenerator.make_unique_pod_id(pod_template.metadata.name)
+            pod.metadata.name = PodGenerator.make_unique_pod_id(pod.metadata.name)
+
         pod = PodGenerator.reconcile_pods(pod_template, pod)

Review comment:
       Sure, I'll move this.  That simplifies things.  Cheers.




-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] ferruzzi commented on a change in pull request #19398: Decouple name randomization from name kwarg

Posted by GitBox <gi...@apache.org>.
ferruzzi commented on a change in pull request #19398:
URL: https://github.com/apache/airflow/pull/19398#discussion_r743784073



##########
File path: airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py
##########
@@ -484,6 +489,11 @@ def create_pod_request_obj(self) -> k8s.V1Pod:
             ),
         )
 
+        if self.random_name_suffix:
+            if pod_template:
+                pod_template.metadata.name = PodGenerator.make_unique_pod_id(pod_template.metadata.name)
+            pod.metadata.name = PodGenerator.make_unique_pod_id(pod.metadata.name)
+
         pod = PodGenerator.reconcile_pods(pod_template, pod)

Review comment:
       Sure, I'll move this.  Is there a particular reason that I missed or just preference?

##########
File path: airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py
##########
@@ -484,6 +489,11 @@ def create_pod_request_obj(self) -> k8s.V1Pod:
             ),
         )
 
+        if self.random_name_suffix:
+            if pod_template:
+                pod_template.metadata.name = PodGenerator.make_unique_pod_id(pod_template.metadata.name)
+            pod.metadata.name = PodGenerator.make_unique_pod_id(pod.metadata.name)
+
         pod = PodGenerator.reconcile_pods(pod_template, pod)

Review comment:
       Sure, I'll move this.  That simplifies things.  Cheers.

##########
File path: airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py
##########
@@ -484,6 +489,11 @@ def create_pod_request_obj(self) -> k8s.V1Pod:
             ),
         )
 
+        if self.random_name_suffix:
+            if pod_template:
+                pod_template.metadata.name = PodGenerator.make_unique_pod_id(pod_template.metadata.name)
+            pod.metadata.name = PodGenerator.make_unique_pod_id(pod.metadata.name)
+
         pod = PodGenerator.reconcile_pods(pod_template, pod)

Review comment:
       See: https://github.com/apache/airflow/pull/19398/commits/2d34a160b89fa3217cce9ce7996a4787660b799b




-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] ferruzzi commented on a change in pull request #19398: Decouple name randomization from name kwarg

Posted by GitBox <gi...@apache.org>.
ferruzzi commented on a change in pull request #19398:
URL: https://github.com/apache/airflow/pull/19398#discussion_r743803679



##########
File path: airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py
##########
@@ -484,6 +489,11 @@ def create_pod_request_obj(self) -> k8s.V1Pod:
             ),
         )
 
+        if self.random_name_suffix:
+            if pod_template:
+                pod_template.metadata.name = PodGenerator.make_unique_pod_id(pod_template.metadata.name)
+            pod.metadata.name = PodGenerator.make_unique_pod_id(pod.metadata.name)
+
         pod = PodGenerator.reconcile_pods(pod_template, pod)

Review comment:
       See: https://github.com/apache/airflow/pull/19398/commits/2d34a160b89fa3217cce9ce7996a4787660b799b




-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] jedcunningham commented on a change in pull request #19398: Decouple name randomization from name kwarg

Posted by GitBox <gi...@apache.org>.
jedcunningham commented on a change in pull request #19398:
URL: https://github.com/apache/airflow/pull/19398#discussion_r743270704



##########
File path: airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py
##########
@@ -484,6 +489,11 @@ def create_pod_request_obj(self) -> k8s.V1Pod:
             ),
         )
 
+        if self.random_name_suffix:
+            if pod_template:
+                pod_template.metadata.name = PodGenerator.make_unique_pod_id(pod_template.metadata.name)
+            pod.metadata.name = PodGenerator.make_unique_pod_id(pod.metadata.name)
+
         pod = PodGenerator.reconcile_pods(pod_template, pod)

Review comment:
       ```suggestion
           pod = PodGenerator.reconcile_pods(pod_template, pod)
           
           if self.random_name_suffix:
               pod.metadata.name = PodGenerator.make_unique_pod_id(pod.metadata.name)
   ```
   
   Can we randomize after we reconcile the 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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] jedcunningham commented on a change in pull request #19398: Decouple name randomization from name kwarg

Posted by GitBox <gi...@apache.org>.
jedcunningham commented on a change in pull request #19398:
URL: https://github.com/apache/airflow/pull/19398#discussion_r743270704



##########
File path: airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py
##########
@@ -484,6 +489,11 @@ def create_pod_request_obj(self) -> k8s.V1Pod:
             ),
         )
 
+        if self.random_name_suffix:
+            if pod_template:
+                pod_template.metadata.name = PodGenerator.make_unique_pod_id(pod_template.metadata.name)
+            pod.metadata.name = PodGenerator.make_unique_pod_id(pod.metadata.name)
+
         pod = PodGenerator.reconcile_pods(pod_template, pod)

Review comment:
       ```suggestion
           pod = PodGenerator.reconcile_pods(pod_template, pod)
           
           if self.random_name_suffix:
               pod.metadata.name = PodGenerator.make_unique_pod_id(pod.metadata.name)
   ```
   
   Can we randomize after we reconcile the 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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] ferruzzi commented on a change in pull request #19398: Decouple name randomization from name kwarg

Posted by GitBox <gi...@apache.org>.
ferruzzi commented on a change in pull request #19398:
URL: https://github.com/apache/airflow/pull/19398#discussion_r743784073



##########
File path: airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py
##########
@@ -484,6 +489,11 @@ def create_pod_request_obj(self) -> k8s.V1Pod:
             ),
         )
 
+        if self.random_name_suffix:
+            if pod_template:
+                pod_template.metadata.name = PodGenerator.make_unique_pod_id(pod_template.metadata.name)
+            pod.metadata.name = PodGenerator.make_unique_pod_id(pod.metadata.name)
+
         pod = PodGenerator.reconcile_pods(pod_template, pod)

Review comment:
       Sure, I'll move this.  Is there a particular reason that I missed or just preference?




-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk merged pull request #19398: Decouple name randomization from name kwarg

Posted by GitBox <gi...@apache.org>.
potiuk merged pull request #19398:
URL: https://github.com/apache/airflow/pull/19398


   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] jedcunningham commented on a change in pull request #19398: Decouple name randomization from name kwarg

Posted by GitBox <gi...@apache.org>.
jedcunningham commented on a change in pull request #19398:
URL: https://github.com/apache/airflow/pull/19398#discussion_r743270704



##########
File path: airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py
##########
@@ -484,6 +489,11 @@ def create_pod_request_obj(self) -> k8s.V1Pod:
             ),
         )
 
+        if self.random_name_suffix:
+            if pod_template:
+                pod_template.metadata.name = PodGenerator.make_unique_pod_id(pod_template.metadata.name)
+            pod.metadata.name = PodGenerator.make_unique_pod_id(pod.metadata.name)
+
         pod = PodGenerator.reconcile_pods(pod_template, pod)

Review comment:
       ```suggestion
           pod = PodGenerator.reconcile_pods(pod_template, pod)
           
           if self.random_name_suffix:
               pod.metadata.name = PodGenerator.make_unique_pod_id(pod.metadata.name)
   ```
   
   Can we randomize after we reconcile the 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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] ferruzzi commented on a change in pull request #19398: Decouple name randomization from name kwarg

Posted by GitBox <gi...@apache.org>.
ferruzzi commented on a change in pull request #19398:
URL: https://github.com/apache/airflow/pull/19398#discussion_r743784073



##########
File path: airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py
##########
@@ -484,6 +489,11 @@ def create_pod_request_obj(self) -> k8s.V1Pod:
             ),
         )
 
+        if self.random_name_suffix:
+            if pod_template:
+                pod_template.metadata.name = PodGenerator.make_unique_pod_id(pod_template.metadata.name)
+            pod.metadata.name = PodGenerator.make_unique_pod_id(pod.metadata.name)
+
         pod = PodGenerator.reconcile_pods(pod_template, pod)

Review comment:
       Sure, I'll move this.  Is there a particular reason that I missed or just preference?

##########
File path: airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py
##########
@@ -484,6 +489,11 @@ def create_pod_request_obj(self) -> k8s.V1Pod:
             ),
         )
 
+        if self.random_name_suffix:
+            if pod_template:
+                pod_template.metadata.name = PodGenerator.make_unique_pod_id(pod_template.metadata.name)
+            pod.metadata.name = PodGenerator.make_unique_pod_id(pod.metadata.name)
+
         pod = PodGenerator.reconcile_pods(pod_template, pod)

Review comment:
       Sure, I'll move this.  That simplifies things.  Cheers.

##########
File path: airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py
##########
@@ -484,6 +489,11 @@ def create_pod_request_obj(self) -> k8s.V1Pod:
             ),
         )
 
+        if self.random_name_suffix:
+            if pod_template:
+                pod_template.metadata.name = PodGenerator.make_unique_pod_id(pod_template.metadata.name)
+            pod.metadata.name = PodGenerator.make_unique_pod_id(pod.metadata.name)
+
         pod = PodGenerator.reconcile_pods(pod_template, pod)

Review comment:
       See: https://github.com/apache/airflow/pull/19398/commits/2d34a160b89fa3217cce9ce7996a4787660b799b




-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org