From 3f7ee75617feba5255202ab379bffaa74ea6f976 Mon Sep 17 00:00:00 2001 From: JunRuiLee Date: Thu, 26 Oct 2023 20:25:03 +0800 Subject: [PATCH] introduce standard yaml config --- Dockerfile-ubuntu.template | 15 ++++++++++----- docker-entrypoint.sh | 9 ++++++++- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/Dockerfile-ubuntu.template b/Dockerfile-ubuntu.template index 7073eec4..69b0c49b 100644 --- a/Dockerfile-ubuntu.template +++ b/Dockerfile-ubuntu.template @@ -81,11 +81,16 @@ RUN set -ex; \ chown -R flink:flink .; \ \ # Replace default REST/RPC endpoint bind address to use the container's network interface \ - sed -i 's/rest.address: localhost/rest.address: 0.0.0.0/g' $FLINK_HOME/conf/flink-conf.yaml; \ - sed -i 's/rest.bind-address: localhost/rest.bind-address: 0.0.0.0/g' $FLINK_HOME/conf/flink-conf.yaml; \ - sed -i 's/jobmanager.bind-host: localhost/jobmanager.bind-host: 0.0.0.0/g' $FLINK_HOME/conf/flink-conf.yaml; \ - sed -i 's/taskmanager.bind-host: localhost/taskmanager.bind-host: 0.0.0.0/g' $FLINK_HOME/conf/flink-conf.yaml; \ - sed -i '/taskmanager.host: localhost/d' $FLINK_HOME/conf/flink-conf.yaml; + CONF_FILE="$FLINK_HOME/conf/flink-conf.yaml"; \ + if [ ! -e "$FLINK_HOME/conf/flink-conf.yaml" ]; then \ + CONF_FILE="${FLINK_HOME}/conf/config.yaml"; \ + /bin/bash "$FLINK_HOME/bin/flatten-config.sh" "${FLINK_HOME}/conf" "${FLINK_HOME}/bin" "${FLINK_HOME}/lib"; \ + fi; \ + sed -i 's/rest.address: localhost/rest.address: 0.0.0.0/g' "$CONF_FILE"; \ + sed -i 's/rest.bind-address: localhost/rest.bind-address: 0.0.0.0/g' "$CONF_FILE"; \ + sed -i 's/jobmanager.bind-host: localhost/jobmanager.bind-host: 0.0.0.0/g' "$CONF_FILE"; \ + sed -i 's/taskmanager.bind-host: localhost/taskmanager.bind-host: 0.0.0.0/g' "$CONF_FILE"; \ + sed -i '/taskmanager.host: localhost/d' "$CONF_FILE"; # Configure container COPY docker-entrypoint.sh / diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 8b0350e2..e823f2d7 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -23,7 +23,7 @@ COMMAND_HISTORY_SERVER="history-server" # If unspecified, the hostname of the container is taken as the JobManager address JOB_MANAGER_RPC_ADDRESS=${JOB_MANAGER_RPC_ADDRESS:-$(hostname -f)} -CONF_FILE="${FLINK_HOME}/conf/flink-conf.yaml" +CONF_FILE_DIR="${FLINK_HOME}/conf" drop_privs_cmd() { if [ $(id -u) != 0 ]; then @@ -112,6 +112,13 @@ maybe_enable_jemalloc copy_plugins_if_required +CONF_FILE="" + +if [ -e "${CONF_FILE_DIR}/flink-conf.yaml" ]; then + CONF_FILE="${CONF_FILE_DIR}/flink-conf.yaml" +else + CONF_FILE="${CONF_FILE_DIR}/config.yaml" +fi prepare_configuration args=("$@")