diff --git a/computer-k8s-operator/src/main/java/com/baidu/hugegraph/computer/k8s/operator/controller/ComputerJobDeployer.java b/computer-k8s-operator/src/main/java/com/baidu/hugegraph/computer/k8s/operator/controller/ComputerJobDeployer.java index 5de12a077..76a35b561 100644 --- a/computer-k8s-operator/src/main/java/com/baidu/hugegraph/computer/k8s/operator/controller/ComputerJobDeployer.java +++ b/computer-k8s-operator/src/main/java/com/baidu/hugegraph/computer/k8s/operator/controller/ComputerJobDeployer.java @@ -93,6 +93,7 @@ public class ComputerJobDeployer { private static final String TRANSPORT_PORT_NAME = "transport-port"; private static final String RPC_PORT_NAME = "rpc-port"; private static final int DEFAULT_TRANSPORT_PORT = 8099; + private static final int DEFAULT_RPC_PORT = 8190; private static final String COMPUTER_CONFIG_MAP_VOLUME = "computer-config-map-volume"; private static final String POD_IP_KEY = "status.podIP"; @@ -196,13 +197,18 @@ private Set handleConfig(ComputerJobSpec spec) { config.put(ComputerOptions.TRANSPORT_SERVER_PORT.name(), transportPort); } - ContainerPort transportContainerPort = new ContainerPortBuilder() .withName(TRANSPORT_PORT_NAME) .withContainerPort(Integer.valueOf(transportPort)) .withProtocol(PROTOCOL) .build(); - String rpcPort = config.getOrDefault(ComputerOptions.RPC_SERVER_PORT.name(), RANDOM_PORT); + + String rpcPort = config.get( + ComputerOptions.RPC_SERVER_PORT.name()); + if (StringUtils.isBlank(rpcPort) || RANDOM_PORT.equals(rpcPort)) { + rpcPort = String.valueOf(DEFAULT_RPC_PORT); + config.put(ComputerOptions.RPC_SERVER_PORT.name(), rpcPort); + } ContainerPort rpcContainerPort = new ContainerPortBuilder() .withName(RPC_PORT_NAME) .withContainerPort(Integer.valueOf(rpcPort))