dmvk commented on a change in pull request #16720:
URL: https://github.com/apache/flink/pull/16720#discussion_r687594396



##########
File path: 
flink-kubernetes/src/main/java/org/apache/flink/kubernetes/kubeclient/Fabric8FlinkKubeClient.java
##########
@@ -441,8 +435,26 @@ private int getRestPortFromExternalService(Service 
externalService) {
                 address = loadBalancer.getIngress().get(0).getHostname();
             }
         } else {
-            // Use node port
-            address = this.internalClient.getMasterUrl().getHost();
+            // Use node port. Node port is accessible on any node within 
kubernetes cluster. We'll
+            // only consider IPs with the configured address type.
+            address =
+                    internalClient.nodes().list().getItems().stream()
+                            .flatMap(node -> 
node.getStatus().getAddresses().stream())
+                            .filter(
+                                    nodeAddress ->
+                                            nodePortAddressType
+                                                    .name()
+                                                    
.equals(nodeAddress.getType()))
+                            .map(NodeAddress::getAddress)
+                            .filter(externalIp -> !externalIp.isEmpty())

Review comment:
       address is already defined in the scope, I'll change this to `ip`




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