wangyang0918 commented on a change in pull request #14629:
URL: https://github.com/apache/flink/pull/14629#discussion_r581595192



##########
File path: 
flink-kubernetes/src/main/java/org/apache/flink/kubernetes/utils/KubernetesUtils.java
##########
@@ -396,6 +401,42 @@ public static String getCommonStartCommand(
                 .collect(Collectors.toList());
     }
 
+    public static FlinkPod loadPodFromTemplateFile(
+            FlinkKubeClient kubeClient, String path, String mainContainerName) 
{
+        if (!new File(path).exists()) {
+            return new FlinkPod.Builder().build();
+        }
+
+        final KubernetesPod pod = kubeClient.loadPodFromTemplateFile(path);
+        final List<Container> otherContainers = new ArrayList<>();
+        Container mainContainer = null;
+
+        for (Container container : 
pod.getInternalResource().getSpec().getContainers()) {
+            if (mainContainerName.equals(container.getName())) {
+                mainContainer = container;
+            } else {
+                otherContainers.add(container);
+            }
+        }
+
+        if (mainContainer == null) {
+            LOG.warn(

Review comment:
       Usually, the main container is necessary to set but it is not required.




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