From 1a2f8ccc9b09740100ef46b9880156e54103dba0 Mon Sep 17 00:00:00 2001 From: dougbtv Date: Wed, 28 Aug 2019 13:23:28 -0400 Subject: [PATCH] [entrypoint] Adds one-shot CRIO restart, plus renames source CNI config to .old when not using the watch loop --- images/entrypoint.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/images/entrypoint.sh b/images/entrypoint.sh index 82a2662c0..72f614f1d 100755 --- a/images/entrypoint.sh +++ b/images/entrypoint.sh @@ -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