Skip to content

Commit aac57b8

Browse files
gkomlossipaul8263
andauthored
[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]>
1 parent 9749b81 commit aac57b8

File tree

4 files changed

+28
-8
lines changed

4 files changed

+28
-8
lines changed

flink-dist/src/main/resources/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ rest:
174174
#
175175
# To enable this, set the bind address to one that has access to outside-facing
176176
# network interface, such as 0.0.0.0.
177-
bind-address: localhost
177+
# bind-address: localhost
178178
# # The port to which the REST client connects to. If rest.bind-port has
179179
# # not been specified, then the server will bind to this port as well.
180180
# port: 8081

flink-dist/src/test/java/org/apache/flink/dist/BashJavaUtilsITCase.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ void testGetJmResourceParamsWithDynamicProperties() throws Exception {
133133

134134
@Test
135135
void testGetConfiguration() throws Exception {
136-
int expectedResultLines = 26;
136+
int expectedResultLines = 25;
137137
String[] commands = {
138138
RUN_BASH_JAVA_UTILS_CMD_SCRIPT,
139139
BashJavaUtils.Command.UPDATE_AND_GET_FLINK_CONFIGURATION.toString(),
@@ -209,7 +209,7 @@ void testMigrateLegacyConfigToStandardYaml() throws Exception {
209209

210210
@Test
211211
void testGetConfigurationRemoveKey() throws Exception {
212-
int expectedResultLines = 24;
212+
int expectedResultLines = 23;
213213
String[] commands = {
214214
RUN_BASH_JAVA_UTILS_CMD_SCRIPT,
215215
BashJavaUtils.Command.UPDATE_AND_GET_FLINK_CONFIGURATION.toString(),
@@ -226,7 +226,7 @@ void testGetConfigurationRemoveKey() throws Exception {
226226

227227
@Test
228228
void testGetConfigurationRemoveKeyValue() throws Exception {
229-
int expectedResultLines = 24;
229+
int expectedResultLines = 23;
230230
String[] commands = {
231231
RUN_BASH_JAVA_UTILS_CMD_SCRIPT,
232232
BashJavaUtils.Command.UPDATE_AND_GET_FLINK_CONFIGURATION.toString(),
@@ -243,7 +243,7 @@ void testGetConfigurationRemoveKeyValue() throws Exception {
243243

244244
@Test
245245
void testGetConfigurationRemoveKeyValueNotMatchingValue() throws Exception {
246-
int expectedResultLines = 26;
246+
int expectedResultLines = 25;
247247
String[] commands = {
248248
RUN_BASH_JAVA_UTILS_CMD_SCRIPT,
249249
BashJavaUtils.Command.UPDATE_AND_GET_FLINK_CONFIGURATION.toString(),
@@ -260,7 +260,7 @@ void testGetConfigurationRemoveKeyValueNotMatchingValue() throws Exception {
260260

261261
@Test
262262
void testGetConfigurationReplaceKeyValue() throws Exception {
263-
int expectedResultLines = 26;
263+
int expectedResultLines = 25;
264264
String[] commands = {
265265
RUN_BASH_JAVA_UTILS_CMD_SCRIPT,
266266
BashJavaUtils.Command.UPDATE_AND_GET_FLINK_CONFIGURATION.toString(),
@@ -277,7 +277,7 @@ void testGetConfigurationReplaceKeyValue() throws Exception {
277277

278278
@Test
279279
void testGetConfigurationReplaceKeyValueNotMatchingValue() throws Exception {
280-
int expectedResultLines = 26;
280+
int expectedResultLines = 25;
281281
String[] commands = {
282282
RUN_BASH_JAVA_UTILS_CMD_SCRIPT,
283283
BashJavaUtils.Command.UPDATE_AND_GET_FLINK_CONFIGURATION.toString(),

flink-yarn/src/main/java/org/apache/flink/yarn/entrypoint/YarnEntrypointUtils.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ public static Configuration loadConfiguration(
6565

6666
configuration.set(JobManagerOptions.ADDRESS, hostname);
6767
configuration.set(RestOptions.ADDRESS, hostname);
68-
configuration.set(RestOptions.BIND_ADDRESS, hostname);
68+
if (!configuration.contains(RestOptions.BIND_ADDRESS)) {
69+
configuration.set(RestOptions.BIND_ADDRESS, hostname);
70+
}
6971

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

flink-yarn/src/test/java/org/apache/flink/yarn/entrypoint/YarnEntrypointUtilsTest.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,24 @@ void testRestPortAndBindingPortSpecified() throws IOException {
8989
assertThat(configuration.get(RestOptions.BIND_PORT)).isEqualTo(bindingPortRange);
9090
}
9191

92+
@Test
93+
void testRestBindingAddressUnspecified() throws IOException {
94+
final Configuration initialConfiguration = new Configuration();
95+
final Configuration configuration = loadConfiguration(initialConfiguration);
96+
97+
assertThat(configuration.get(RestOptions.BIND_ADDRESS)).isEqualTo("foobar");
98+
}
99+
100+
@Test
101+
void testRestBindingAddressSpecified() throws Exception {
102+
final Configuration initialConfiguration = new Configuration();
103+
final String bindingAddress = "0.0.0.0";
104+
initialConfiguration.set(RestOptions.BIND_ADDRESS, bindingAddress);
105+
final Configuration configuration = loadConfiguration(initialConfiguration);
106+
107+
assertThat(configuration.get(RestOptions.BIND_ADDRESS)).isEqualTo(bindingAddress);
108+
}
109+
92110
@Test
93111
void testParsingValidKerberosEnv() throws IOException {
94112
final Configuration initialConfiguration = new Configuration();

0 commit comments

Comments
 (0)