This is an automated email from the ASF dual-hosted git repository.
gaborgsomogyi pushed a commit to branch release-1.20
in repository https://gitbox.apache.org/repos/asf/flink.git
The following commit(s) were added to refs/heads/release-1.20 by this push:
new aac57b8f154 [FLINK-35332][yarn] Do not set "rest.address" to the
actual IP address of the YARN NM to support dual network envs
aac57b8f154 is described below
commit aac57b8f154842b64bff73b7bdea66f7c00197f8
Author: Gyula Komlossi <[email protected]>
AuthorDate: Fri Nov 28 23:59:57 2025 +0100
[FLINK-35332][yarn] Do not set "rest.address" to the actual IP address of
the YARN NM to support dual network envs
Co-authored-by: Paul Zhang <[email protected]>
---
flink-dist/src/main/resources/config.yaml | 2 +-
.../org/apache/flink/dist/BashJavaUtilsITCase.java | 12 ++++++------
.../flink/yarn/entrypoint/YarnEntrypointUtils.java | 4 +++-
.../flink/yarn/entrypoint/YarnEntrypointUtilsTest.java | 18 ++++++++++++++++++
4 files changed, 28 insertions(+), 8 deletions(-)
diff --git a/flink-dist/src/main/resources/config.yaml
b/flink-dist/src/main/resources/config.yaml
index 467525c9402..c7587142763 100644
--- a/flink-dist/src/main/resources/config.yaml
+++ b/flink-dist/src/main/resources/config.yaml
@@ -174,7 +174,7 @@ rest:
#
# To enable this, set the bind address to one that has access to
outside-facing
# network interface, such as 0.0.0.0.
- bind-address: localhost
+ # bind-address: localhost
# # The port to which the REST client connects to. If rest.bind-port has
# # not been specified, then the server will bind to this port as well.
# port: 8081
diff --git
a/flink-dist/src/test/java/org/apache/flink/dist/BashJavaUtilsITCase.java
b/flink-dist/src/test/java/org/apache/flink/dist/BashJavaUtilsITCase.java
index 55b12f10653..796daebab95 100644
--- a/flink-dist/src/test/java/org/apache/flink/dist/BashJavaUtilsITCase.java
+++ b/flink-dist/src/test/java/org/apache/flink/dist/BashJavaUtilsITCase.java
@@ -133,7 +133,7 @@ class BashJavaUtilsITCase extends JavaBashTestBase {
@Test
void testGetConfiguration() throws Exception {
- int expectedResultLines = 26;
+ int expectedResultLines = 25;
String[] commands = {
RUN_BASH_JAVA_UTILS_CMD_SCRIPT,
BashJavaUtils.Command.UPDATE_AND_GET_FLINK_CONFIGURATION.toString(),
@@ -209,7 +209,7 @@ class BashJavaUtilsITCase extends JavaBashTestBase {
@Test
void testGetConfigurationRemoveKey() throws Exception {
- int expectedResultLines = 24;
+ int expectedResultLines = 23;
String[] commands = {
RUN_BASH_JAVA_UTILS_CMD_SCRIPT,
BashJavaUtils.Command.UPDATE_AND_GET_FLINK_CONFIGURATION.toString(),
@@ -226,7 +226,7 @@ class BashJavaUtilsITCase extends JavaBashTestBase {
@Test
void testGetConfigurationRemoveKeyValue() throws Exception {
- int expectedResultLines = 24;
+ int expectedResultLines = 23;
String[] commands = {
RUN_BASH_JAVA_UTILS_CMD_SCRIPT,
BashJavaUtils.Command.UPDATE_AND_GET_FLINK_CONFIGURATION.toString(),
@@ -243,7 +243,7 @@ class BashJavaUtilsITCase extends JavaBashTestBase {
@Test
void testGetConfigurationRemoveKeyValueNotMatchingValue() throws Exception
{
- int expectedResultLines = 26;
+ int expectedResultLines = 25;
String[] commands = {
RUN_BASH_JAVA_UTILS_CMD_SCRIPT,
BashJavaUtils.Command.UPDATE_AND_GET_FLINK_CONFIGURATION.toString(),
@@ -260,7 +260,7 @@ class BashJavaUtilsITCase extends JavaBashTestBase {
@Test
void testGetConfigurationReplaceKeyValue() throws Exception {
- int expectedResultLines = 26;
+ int expectedResultLines = 25;
String[] commands = {
RUN_BASH_JAVA_UTILS_CMD_SCRIPT,
BashJavaUtils.Command.UPDATE_AND_GET_FLINK_CONFIGURATION.toString(),
@@ -277,7 +277,7 @@ class BashJavaUtilsITCase extends JavaBashTestBase {
@Test
void testGetConfigurationReplaceKeyValueNotMatchingValue() throws
Exception {
- int expectedResultLines = 26;
+ int expectedResultLines = 25;
String[] commands = {
RUN_BASH_JAVA_UTILS_CMD_SCRIPT,
BashJavaUtils.Command.UPDATE_AND_GET_FLINK_CONFIGURATION.toString(),
diff --git
a/flink-yarn/src/main/java/org/apache/flink/yarn/entrypoint/YarnEntrypointUtils.java
b/flink-yarn/src/main/java/org/apache/flink/yarn/entrypoint/YarnEntrypointUtils.java
index 0480b13814e..499ca5c2d77 100644
---
a/flink-yarn/src/main/java/org/apache/flink/yarn/entrypoint/YarnEntrypointUtils.java
+++
b/flink-yarn/src/main/java/org/apache/flink/yarn/entrypoint/YarnEntrypointUtils.java
@@ -65,7 +65,9 @@ public class YarnEntrypointUtils {
configuration.set(JobManagerOptions.ADDRESS, hostname);
configuration.set(RestOptions.ADDRESS, hostname);
- configuration.set(RestOptions.BIND_ADDRESS, hostname);
+ if (!configuration.contains(RestOptions.BIND_ADDRESS)) {
+ configuration.set(RestOptions.BIND_ADDRESS, hostname);
+ }
// if a web monitor shall be started, set the port to random binding
if (configuration.get(WebOptions.PORT, 0) >= 0) {
diff --git
a/flink-yarn/src/test/java/org/apache/flink/yarn/entrypoint/YarnEntrypointUtilsTest.java
b/flink-yarn/src/test/java/org/apache/flink/yarn/entrypoint/YarnEntrypointUtilsTest.java
index 3973139e0d5..6a3f0a85d37 100644
---
a/flink-yarn/src/test/java/org/apache/flink/yarn/entrypoint/YarnEntrypointUtilsTest.java
+++
b/flink-yarn/src/test/java/org/apache/flink/yarn/entrypoint/YarnEntrypointUtilsTest.java
@@ -89,6 +89,24 @@ class YarnEntrypointUtilsTest {
assertThat(configuration.get(RestOptions.BIND_PORT)).isEqualTo(bindingPortRange);
}
+ @Test
+ void testRestBindingAddressUnspecified() throws IOException {
+ final Configuration initialConfiguration = new Configuration();
+ final Configuration configuration =
loadConfiguration(initialConfiguration);
+
+
assertThat(configuration.get(RestOptions.BIND_ADDRESS)).isEqualTo("foobar");
+ }
+
+ @Test
+ void testRestBindingAddressSpecified() throws Exception {
+ final Configuration initialConfiguration = new Configuration();
+ final String bindingAddress = "0.0.0.0";
+ initialConfiguration.set(RestOptions.BIND_ADDRESS, bindingAddress);
+ final Configuration configuration =
loadConfiguration(initialConfiguration);
+
+
assertThat(configuration.get(RestOptions.BIND_ADDRESS)).isEqualTo(bindingAddress);
+ }
+
@Test
void testParsingValidKerberosEnv() throws IOException {
final Configuration initialConfiguration = new Configuration();