[ 
https://issues.apache.org/jira/browse/FLINK-7108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16092400#comment-16092400
 ] 

ASF GitHub Bot commented on FLINK-7108:
---------------------------------------

Github user EronWright commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4281#discussion_r128129161
  
    --- Diff: 
flink-yarn/src/main/java/org/apache/flink/yarn/entrypoint/YarnEntrypointUtils.java
 ---
    @@ -0,0 +1,160 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.flink.yarn.entrypoint;
    +
    +import org.apache.flink.configuration.ConfigConstants;
    +import org.apache.flink.configuration.Configuration;
    +import org.apache.flink.configuration.GlobalConfiguration;
    +import org.apache.flink.configuration.HighAvailabilityOptions;
    +import org.apache.flink.configuration.JobManagerOptions;
    +import org.apache.flink.configuration.SecurityOptions;
    +import org.apache.flink.runtime.clusterframework.BootstrapTools;
    +import org.apache.flink.runtime.security.SecurityContext;
    +import org.apache.flink.runtime.security.SecurityUtils;
    +import org.apache.flink.util.Preconditions;
    +import org.apache.flink.yarn.Utils;
    +import org.apache.flink.yarn.YarnConfigKeys;
    +import org.apache.flink.yarn.cli.FlinkYarnSessionCli;
    +
    +import org.apache.hadoop.fs.CommonConfigurationKeysPublic;
    +import org.apache.hadoop.security.UserGroupInformation;
    +import org.apache.hadoop.yarn.api.ApplicationConstants;
    +import org.slf4j.Logger;
    +
    +import java.io.File;
    +import java.io.IOException;
    +import java.util.Map;
    +
    +/**
    + * This class contains utility methods for the {@link 
YarnSessionClusterEntrypoint} and
    + * {@link YarnJobClusterEntrypoint}.
    + */
    +public class YarnEntrypointUtils {
    +
    +   public static SecurityContext installSecurityContext(
    +                   Configuration configuration,
    +                   String workingDirectory) throws Exception {
    +           org.apache.hadoop.conf.Configuration hadoopConfiguration = null;
    +
    +           //To support Yarn Secure Integration Test Scenario
    +           File krb5Conf = new File(workingDirectory, 
Utils.KRB5_FILE_NAME);
    +           if (krb5Conf.exists() && krb5Conf.canRead()) {
    +                   hadoopConfiguration = new 
org.apache.hadoop.conf.Configuration();
    +                   
hadoopConfiguration.set(CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHENTICATION,
 "kerberos");
    +                   
hadoopConfiguration.set(CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHORIZATION,
 "true");
    +           }
    +
    +           SecurityUtils.SecurityConfiguration sc;
    +           if (hadoopConfiguration != null) {
    +                   sc = new 
SecurityUtils.SecurityConfiguration(configuration, hadoopConfiguration);
    +           } else {
    +                   sc = new 
SecurityUtils.SecurityConfiguration(configuration);
    +           }
    +
    +           SecurityUtils.install(sc);
    +
    +           return SecurityUtils.getInstalledContext();
    +   }
    +
    +   public static Configuration loadConfiguration(String workingDirectory, 
Map<String, String> env) {
    --- End diff --
    
    Much of this could be simplified by moving to standard dynamic properties.  
 The code seems to convert from `YarnConfigKeys` settings to native Flink 
config settings.


> Implement Session cluster entry point
> -------------------------------------
>
>                 Key: FLINK-7108
>                 URL: https://issues.apache.org/jira/browse/FLINK-7108
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Cluster Management, YARN
>            Reporter: Till Rohrmann
>            Assignee: Till Rohrmann
>              Labels: flip-6
>
> Implement a Yarn session cluster entry point.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to