[entrypoint] Adds script parameter to optionally rename source CNI config file to .old

This commit is contained in:
dougbtv 2019-08-30 18:03:48 -04:00 committed by Tomofumi Hayashi
parent 56f42e0b51
commit e2f75d4ee5
3 changed files with 11 additions and 1 deletions

View File

@ -541,3 +541,7 @@ In some cases, the original CNI configuration that the Multus configuration was
When using CRIO, you may need to restart CRIO to get the Multus configuration file to take -- this is rarely necessary.
--restart-crio=false
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

View File

@ -31,6 +31,7 @@ OVERRIDE_NETWORK_NAME=false
MULTUS_CLEANUP_CONFIG_ON_EXIT=false
RESTART_CRIO=false
CRIO_RESTARTED_ONCE=false
RENAME_SOURCE_CONFIG_FILE=false
# Give help text for parameters.
function usage()
@ -56,6 +57,7 @@ function usage()
echo -e "\t--multus-log-file=$MULTUS_LOG_FILE (empty by default, used only with --multus-conf-file=auto)"
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--restart-crio=false (restarts CRIO after config file is generated)"
}
@ -122,6 +124,9 @@ while [ "$1" != "" ]; do
--restart-crio)
RESTART_CRIO=$VALUE
;;
--rename-conf-file)
RENAME_SOURCE_CONFIG_FILE=$VALUE
;;
*)
warn "unknown parameter \"$PARAM\""
;;
@ -310,7 +315,7 @@ EOF
echo $CONF
# If we're not performing the cleanup on exit, we can safely rename the config file.
if [ "$MULTUS_CLEANUP_CONFIG_ON_EXIT" == false ]; then
if [ "$RENAME_SOURCE_CONFIG_FILE" == true ]; then
mv ${MULTUS_AUTOCONF_DIR}/${MASTER_PLUGIN} ${MULTUS_AUTOCONF_DIR}/${MASTER_PLUGIN}.old
log "Original master file moved to ${MULTUS_AUTOCONF_DIR}/${MASTER_PLUGIN}.old"
fi

View File

@ -141,6 +141,7 @@ spec:
- "--cni-bin-dir=/host/usr/libexec/cni"
- "--multus-conf-file=auto"
- "--override-network-name=true"
- "--rename-conf-file=true"
resources:
requests:
cpu: "100m"