Ensure Krb auth before killing YARN apps in graceful shutdown (#9785)

This commit is contained in:
Lucas Capistrant 2020-11-16 11:59:14 -06:00 committed by GitHub
parent 9e6978609a
commit 3447934a75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -97,9 +97,8 @@ public class JobHelper
* Dose authenticate against a secured hadoop cluster
* In case of any bug fix make sure to fix the code at HdfsStorageAuthentication#authenticate as well.
*
* @param config containing the principal name and keytab path.
*/
public static void authenticate(HadoopDruidIndexerConfig config)
public static void authenticate()
{
String principal = HadoopDruidIndexerConfig.HADOOP_KERBEROS_CONFIG.getPrincipal();
String keytab = HadoopDruidIndexerConfig.HADOOP_KERBEROS_CONFIG.getKeytab();
@ -348,7 +347,7 @@ public class JobHelper
public static void ensurePaths(HadoopDruidIndexerConfig config)
{
authenticate(config);
authenticate();
// config.addInputPaths() can have side-effects ( boo! :( ), so this stuff needs to be done before anything else
try {
Job job = Job.getInstance(

View File

@ -35,6 +35,7 @@ import org.apache.druid.indexer.HadoopDruidIndexerConfig;
import org.apache.druid.indexer.HadoopDruidIndexerJob;
import org.apache.druid.indexer.HadoopIngestionSpec;
import org.apache.druid.indexer.IngestionState;
import org.apache.druid.indexer.JobHelper;
import org.apache.druid.indexer.MetadataStorageUpdaterJobHandler;
import org.apache.druid.indexer.TaskMetricsGetter;
import org.apache.druid.indexer.TaskMetricsUtils;
@ -762,6 +763,8 @@ public class HadoopIndexTask extends HadoopTask implements ChatHandler
}
if (jobId != null) {
// This call to JobHelper#authenticate will be transparent if already authenticated or using inseucre Hadoop.
JobHelper.authenticate();
int res = ToolRunner.run(new JobClient(), new String[]{
"-kill",
jobId