Skip to content

Commit

Permalink
[FLINK-31321][Deployment/YARN] Yarn-session mode, securityConfigurati…
Browse files Browse the repository at this point in the history
…on supports dynamic configuration

This closes apache#22119
  • Loading branch information
felixzh2020 authored and xintongsong committed Mar 17, 2023
1 parent 81f77a9 commit 6f9bca9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* Helper class for supporting dynamic property commandline options in {@link CustomCommandLine
* CustomCommandLines}.
*/
class DynamicPropertiesUtil {
public class DynamicPropertiesUtil {

/**
* Dynamic properties allow the user to specify additional configuration values with -D, such as
Expand All @@ -49,7 +49,7 @@ class DynamicPropertiesUtil {
* Parses dynamic properties from the given {@link CommandLine} and sets them on the {@link
* Configuration}.
*/
static void encodeDynamicProperties(
public static void encodeDynamicProperties(
final CommandLine commandLine, final Configuration effectiveConfiguration) {

final Properties properties = commandLine.getOptionProperties(DYNAMIC_PROPERTIES.getOpt());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

import org.apache.flink.client.cli.CliArgsException;
import org.apache.flink.client.cli.CliFrontend;
import org.apache.flink.client.cli.CliFrontendParser;
import org.apache.flink.client.cli.DynamicPropertiesUtil;
import org.apache.flink.client.deployment.ClusterClientFactory;
import org.apache.flink.client.deployment.ClusterClientServiceLoader;
import org.apache.flink.client.deployment.ClusterSpecification;
Expand Down Expand Up @@ -853,7 +855,12 @@ public static void main(final String[] args) {
"",
""); // no prefix for the YARN session

SecurityUtils.install(new SecurityConfiguration(flinkConfiguration));
final CommandLine commandLine = CliFrontendParser.parse(cli.allOptions, args, true);

final Configuration securityFlinkConfiguration = flinkConfiguration.clone();
DynamicPropertiesUtil.encodeDynamicProperties(commandLine, securityFlinkConfiguration);

SecurityUtils.install(new SecurityConfiguration(securityFlinkConfiguration));

retCode = SecurityUtils.getInstalledContext().runSecured(() -> cli.run(args));
} catch (CliArgsException e) {
Expand Down

0 comments on commit 6f9bca9

Please sign in to comment.