TQJADE commented on code in PR #749:
URL: 
https://github.com/apache/spark-kubernetes-operator/pull/749#discussion_r3562239855


##########
spark-operator/src/main/java/org/apache/spark/k8s/operator/context/SparkAppContext.java:
##########
@@ -70,6 +70,23 @@ public Optional<Pod> getDriverPod() {
         .findAny();
   }
 
+  /**
+   * Live lookup of the driver pod against the API server, bypassing the 
informer cache.
+   *
+   * @return An Optional containing the driver Pod as known to the API server.
+   */
+  public Optional<Pod> getDriverPodFromApi() {
+    return josdkContext
+        .getClient()
+        .pods()
+        .inNamespace(sparkApplication.getMetadata().getNamespace())
+        .withLabels(driverLabels(sparkApplication))
+        .list()
+        .getItems()
+        .stream()
+        .findAny();
+  }

Review Comment:
   add lazy initialization. 



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to