Skip to content

Commit

Permalink
[FLINK-24474] Default rest.bind-address to localhost in flink-conf.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
autophagy committed Feb 15, 2022
1 parent fdb8010 commit 6222532
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
9 changes: 7 additions & 2 deletions flink-dist/src/main/resources/flink-conf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,20 @@ jobmanager.execution.failover-strategy: region

# The address to which the REST client will connect to
#
#rest.address: 0.0.0.0
rest.address: localhost

# Port range for the REST and web server to bind to.
#
#rest.bind-port: 8080-8090

# The address that the REST & web server binds to
# By default, this is localhost, which prevents the REST & web server from
# being able to communicate outside of the machine/container it is running on.
#
#rest.bind-address: 0.0.0.0
# To enable this, set the bind address to one that has access to outside-facing
# network interface, such as 0.0.0.0.
#
rest.bind-address: localhost

# Flag to specify whether job submission is enabled from the web-based
# runtime monitor. Uncomment to disable.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ public FlinkContainers build() {
this.conf.set(
CheckpointingOptions.CHECKPOINTS_DIRECTORY,
CHECKPOINT_PATH.toAbsolutePath().toUri().toString());
this.conf.set(RestOptions.BIND_ADDRESS, "0.0.0.0");

// Create temporary directory for building Flink image
final Path imageBuildingTempDir;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.apache.flink.annotation.VisibleForTesting;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.configuration.DeploymentOptionsInternal;
import org.apache.flink.configuration.RestOptions;
import org.apache.flink.kubernetes.configuration.KubernetesConfigOptions;
import org.apache.flink.kubernetes.kubeclient.FlinkPod;
import org.apache.flink.kubernetes.kubeclient.parameters.AbstractKubernetesParameters;
Expand Down Expand Up @@ -156,6 +157,7 @@ private Map<String, String> getClusterSidePropertiesMap(Configuration flinkConfi
// Remove some configuration options that should not be taken to cluster side.
clusterSideConfig.removeConfig(KubernetesConfigOptions.KUBE_CONFIG_FILE);
clusterSideConfig.removeConfig(DeploymentOptionsInternal.CONF_DIR);
clusterSideConfig.removeConfig(RestOptions.BIND_ADDRESS);
return clusterSideConfig.toMap();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public static Configuration loadConfiguration(

configuration.setString(JobManagerOptions.ADDRESS, hostname);
configuration.setString(RestOptions.ADDRESS, hostname);
configuration.setString(RestOptions.BIND_ADDRESS, hostname);

// if a web monitor shall be started, set the port to random binding
if (configuration.getInteger(WebOptions.PORT, 0) >= 0) {
Expand Down

0 comments on commit 6222532

Please sign in to comment.