@@ -163,6 +163,11 @@ echo "Back-up complete and available at $BACKUP_DIR."
163163# ###### CLEAN_UP MANIFEST FILE
164164# In case the previous run of this script was partially successful or unsuccessful, we'd like to start from a clean
165165# state, independent of any previous runs
166+ # retrieve the scheduler config file name used in the manifest file, if any
167+ old_scheduler_config_file_path=$( grep " - --config" " $MANIFEST_FILE " | cut -d " =" -f 2)
168+ old_scheduler_config_file=$( basename " $old_scheduler_config_file_path " )
169+ echo " current scheduler config file name from manifest is: $old_scheduler_config_file "
170+
166171sed -i ' /^ - --config/d' " $MANIFEST_FILE "
167172sed -i ' /^ - --policy-configmap/d' " $MANIFEST_FILE "
168173sed -i ' /^ - --policy-configmap-namespace/d' " $MANIFEST_FILE "
@@ -171,7 +176,12 @@ sed -i '/^ dnsPolicy: ClusterFirstWithHostNet/d' "$MANIFEST_FILE"
171176scheduler_config_file=$( basename " $scheduler_config_file_path " )
172177# clean-up scheduler configuration
173178sed -i ' /hostPath/d' " $MANIFEST_FILE "
174- sed -i " /$scheduler_config_file /d" " $MANIFEST_FILE "
179+ # if we're updating the scheduler config name we need to clean the manifest file of the old scheduler config file name
180+ if [ -n " $old_scheduler_config_file " ] && [ " $old_scheduler_config_file " != " $scheduler_config_file " ]; then
181+ sed -i " /$old_scheduler_config_file /d" " $MANIFEST_FILE "
182+ else
183+ sed -i " /$scheduler_config_file /d" " $MANIFEST_FILE "
184+ fi
175185sed -i ' /name: schedulerconfig/d' " $MANIFEST_FILE "
176186# clean-up certs configuration
177187sed -i ' /certs/d' " $MANIFEST_FILE "
0 commit comments