From 31ae5a77c0c33c9b71d1e9324842e0ecb1657757 Mon Sep 17 00:00:00 2001 From: dougbtv Date: Wed, 18 Sep 2019 12:17:43 -0400 Subject: [PATCH] [entrypoint] Adds --additional-bin-dir option to entrypoint to generate binDir configuration option --- doc/configuration.md | 2 +- doc/how-to-use.md | 4 ++++ images/entrypoint.sh | 11 +++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/doc/configuration.md b/doc/configuration.md index 84f0f5009..07954164c 100644 --- a/doc/configuration.md +++ b/doc/configuration.md @@ -38,7 +38,7 @@ Following is the example of multus config file, in `/etc/cni/net.d/`. * `type` (string, required): "multus" * `confDir` (string, optional): directory for CNI config file that multus reads. default `/etc/cni/multus/net.d` * `cniDir` (string, optional): Multus CNI data directory, default `/var/lib/cni/multus` -* `binDir` (string, optional): directory for CNI plugins which multus calls. default `/opt/cni/bin` +* `binDir` (string, optional): additional directory for CNI plugins which multus calls, in addition to the default (the default is typically set to `/opt/cni/bin`) * `kubeconfig` (string, optional): kubeconfig file for the out of cluster communication with kube-apiserver. See the example [kubeconfig](https://github.com/intel/multus-cni/blob/master/doc/node-kubeconfig.yaml). If you would like to use CRD (i.e. network attachment definition), this is required * `logFile` (string, optional): file path for log file. multus puts log in given file * `logLevel` (string, optional): logging level ("debug", "error", "verbose", or "panic") diff --git a/doc/how-to-use.md b/doc/how-to-use.md index 513505d66..a67c3522d 100644 --- a/doc/how-to-use.md +++ b/doc/how-to-use.md @@ -545,3 +545,7 @@ When using CRIO, you may need to restart CRIO to get the Multus configuration fi Additionally when using CRIO, you may wish to have the CNI config file that's used as the source for `--multus-conf-file=auto` renamed. This boolean option when set to true automatically renames the file with a `.old` suffix to the original filename. --rename-conf-file=true + +When using `--multus-conf-file=auto` you may also care to specify a `binDir` in the configuration, this can be accomplished using the `--additional-bin-dir` option. + + --additional-bin-dir=/opt/multus/bin diff --git a/images/entrypoint.sh b/images/entrypoint.sh index 313cdd351..08634125c 100755 --- a/images/entrypoint.sh +++ b/images/entrypoint.sh @@ -20,6 +20,7 @@ EOF # Set our known directories. CNI_CONF_DIR="/host/etc/cni/net.d" CNI_BIN_DIR="/host/opt/cni/bin" +ADDITIONAL_BIN_DIR="" MULTUS_CONF_FILE="/usr/src/multus-cni/images/70-multus.conf" MULTUS_AUTOCONF_DIR="/host/etc/cni/net.d" MULTUS_BIN_FILE="/usr/src/multus-cni/bin/multus" @@ -58,6 +59,7 @@ function usage() echo -e "\t--override-network-name=false (used only with --multus-conf-file=auto)" echo -e "\t--cleanup-config-on-exit=false (used only with --multus-conf-file=auto)" echo -e "\t--rename-conf-file=false (used only with --multus-conf-file=auto)" + echo -e "\t--additional-bin-dir=$ADDITIONAL_BIN_DIR (adds binDir option to configuration, used only with --multus-conf-file=auto)" echo -e "\t--restart-crio=false (restarts CRIO after config file is generated)" } @@ -127,6 +129,9 @@ while [ "$1" != "" ]; do --rename-conf-file) RENAME_SOURCE_CONFIG_FILE=$VALUE ;; + --additional-bin-dir) + ADDITIONAL_BIN_DIR=$VALUE + ;; *) warn "unknown parameter \"$PARAM\"" ;; @@ -285,6 +290,11 @@ if [ "$MULTUS_CONF_FILE" == "auto" ]; then CNI_VERSION_STRING="\"cniVersion\": \"$CNI_VERSION\"," fi + ADDITIONAL_BIN_DIR_STRING="" + if [ ! -z "${ADDITIONAL_BIN_DIR// }" ]; then + ADDITIONAL_BIN_DIR_STRING="\"binDir\": \"$ADDITIONAL_BIN_DIR\"," + fi + if [ "$OVERRIDE_NETWORK_NAME" == "true" ]; then MASTER_PLUGIN_NET_NAME="$(cat $MULTUS_AUTOCONF_DIR/$MASTER_PLUGIN | \ python -c 'import json,sys;print json.load(sys.stdin)["name"]')" @@ -303,6 +313,7 @@ if [ "$MULTUS_CONF_FILE" == "auto" ]; then $ISOLATION_STRING $LOG_LEVEL_STRING $LOG_FILE_STRING + $ADDITIONAL_BIN_DIR_STRING "kubeconfig": "$MULTUS_KUBECONFIG_FILE_HOST", "delegates": [ $MASTER_PLUGIN_JSON