You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2021/08/12 10:38:44 UTC
[GitHub] [flink] dmvk commented on a change in pull request #16720: [FLINK-23507] Use IP address of a kubernetes node when constructing node port connection string for the REST gateway.
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org