[entrypoint] Adds one-shot CRIO restart, plus renames source CNI config to .old when not using the watch loop

This commit is contained in:
dougbtv 2019-08-28 13:23:28 -04:00
parent d7b233d0f4
commit 1a2f8ccc9b

View File

@ -30,6 +30,7 @@ MULTUS_LOG_FILE=""
OVERRIDE_NETWORK_NAME=false
MULTUS_CLEANUP_CONFIG_ON_EXIT=false
RESTART_CRIO=false
CRIO_RESTARTED_ONCE=false
# Give help text for parameters.
function usage()
@ -306,10 +307,20 @@ EOF
echo $CONF > $CNI_CONF_DIR/00-multus.conf
log "Config file created @ $CNI_CONF_DIR/00-multus.conf"
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
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
if [ "$RESTART_CRIO" == true ]; then
log "Restarting crio"
systemctl restart crio
# Restart CRIO only once.
if [ "$CRIO_RESTARTED_ONCE" == false ]; then
log "Restarting crio"
systemctl restart crio
CRIO_RESTARTED_ONCE=true
fi
fi
fi
done