You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by rm...@apache.org on 2020/08/11 08:58:38 UTC

[flink-docker] branch dev-master updated: [FLINK-15793] Support native K8s mode (#37)

This is an automated email from the ASF dual-hosted git repository.

rmetzger pushed a commit to branch dev-master
in repository https://gitbox.apache.org/repos/asf/flink-docker.git


The following commit(s) were added to refs/heads/dev-master by this push:
     new b4391a9  [FLINK-15793] Support native K8s mode (#37)
b4391a9 is described below

commit b4391a9cc0e83a862f746b5d752171b500342437
Author: Yang Wang <da...@gmail.com>
AuthorDate: Tue Aug 11 16:58:27 2020 +0800

    [FLINK-15793] Support native K8s mode (#37)
    
    * [FLINK-15793] Support native K8s mode
    
    Integrate kubernetes-entry.sh into the unified docker-entrypoint.sh. After then users can enable build-in plugins much more easily. This is a prerequisite to remove kubernetes-entry.sh from Flink.
    
    * fixup! [FLINK-15793] Support native K8s mode
---
 docker-entrypoint.sh | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh
index 6084f06..6478466 100755
--- a/docker-entrypoint.sh
+++ b/docker-entrypoint.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/env bash
 
 ###############################################################################
 #  Licensed to the Apache Software Foundation (ASF) under one
@@ -19,6 +19,7 @@
 ###############################################################################
 
 COMMAND_STANDALONE="standalone-job"
+COMMAND_NATIVE_KUBERNETES="native-k8s"
 
 # If unspecified, the hostname of the container is taken as the JobManager address
 JOB_MANAGER_RPC_ADDRESS=${JOB_MANAGER_RPC_ADDRESS:-$(hostname -f)}
@@ -92,7 +93,7 @@ prepare_job_manager_start() {
 }
 
 if [ "$1" = "help" ]; then
-    echo "Usage: $(basename "$0") (jobmanager|${COMMAND_STANDALONE}|taskmanager|help)"
+    echo "Usage: $(basename "$0") (jobmanager|${COMMAND_STANDALONE}|taskmanager|${COMMAND_NATIVE_KUBERNETES}|help)"
     exit 0
 elif [ "$1" = "jobmanager" ]; then
     shift 1
@@ -120,6 +121,16 @@ elif [ "$1" = "taskmanager" ]; then
     envsubst < "${CONF_FILE}" > "${CONF_FILE}.tmp" && mv "${CONF_FILE}.tmp" "${CONF_FILE}"
 
     exec $(drop_privs_cmd) "$FLINK_HOME/bin/taskmanager.sh" start-foreground "$@"
+elif [ "$1" = "$COMMAND_NATIVE_KUBERNETES" ]; then
+    shift 1
+    copy_plugins_if_required
+
+    export _FLINK_HOME_DETERMINED=true
+    . $FLINK_HOME/bin/config.sh
+    export FLINK_CLASSPATH="`constructFlinkClassPath`:$INTERNAL_HADOOP_CLASSPATHS"
+    # Start commands for jobmanager and taskmanager are generated by Flink internally.
+    echo "Start command: $*"
+    exec $(drop_privs_cmd) bash -c "$@"
 fi
 
 exec "$@"