Skip to content

Commit

Permalink
Adding cleanup for configmaps and restart logic
Browse files Browse the repository at this point in the history
  • Loading branch information
keshav-06-hpe authored and mtupitsyn committed Aug 7, 2024
1 parent 61762b2 commit 6152b3b
Showing 1 changed file with 35 additions and 6 deletions.
41 changes: 35 additions & 6 deletions upgrade/scripts/upgrade/prerequisites.sh
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,25 @@ else
echo "====> ${state_name} has been completed" | tee -a "${LOG_FILE}"
fi

# Cleanup for Kiali configmaps

state_name="KIALI CLEANUP FOR DELETING OLD CONFIGMAPS"
state_recorded=$(is_state_recorded "${state_name}" "$(hostname)")
if [[ ${state_recorded} == "0" && $(hostname) == "${PRIMARY_NODE}" ]]; then
echo "====> ${state_name} ..." | tee -a "${LOG_FILE}"
{
echo "Cleaning up old Configmap of Kiali"
cmap=$(kubectl get cm -n istio-system -l app=kiali,app.kubernetes.io/instance=kiali,app.kubernetes.io/name=kiali,app.kubernetes.io/part-of=kiali -o name)
if [ -n "$cmap" ]; then
kubectl delete -n istio-system "$cmap"
fi
echo "Configmap deleted"
} >> "${LOG_FILE}" 2>&1
record_state "${state_name}" "$(hostname)" | tee -a "${LOG_FILE}"
else
echo "====> ${state_name} has been completed" | tee -a "${LOG_FILE}"
fi

# upgrade all charts dependent on cray-certmanager chart
# it is neccessary to upgrade these before upgrade
do_upgrade_csm_chart cray-istio-operator platform.yaml
Expand All @@ -649,15 +668,25 @@ do_upgrade_csm_chart cray-tapms-crd sysmgmt.yaml
do_upgrade_csm_chart cray-tapms-operator sysmgmt.yaml

# Running the rollout restart script to restart the required resources in istio-injection=enabled namespaces.
bash rollout-restart.sh
state_name="RESTART_SERVICES_REFRESH_ISTIO"
state_recorded=$(is_state_recorded "${state_name}" "$(hostname)")
if [[ ${state_recorded} == "0" && $(hostname) == "${PRIMARY_NODE}" ]]; then
echo "====> ${state_name} ..." | tee -a "${LOG_FILE}"
{
bash rollout-restart.sh

# Checking the
if [ $? -eq 0 ]; then
echo "Rollout restart was executed successfully."
# Checking the status
if [ $? -eq 0 ]; then
echo "Rollout-restart was executed successfully."
else
echo "Rollout-restart failed."
fi
} >> "${LOG_FILE}" 2>&1
record_state "${state_name}" "$(hostname)" | tee -a "${LOG_FILE}"
else
echo "Rollout-restart failed."
echo "====> ${state_name} has been completed" | tee -a "${LOG_FILE}"
fi

# Note for csm 1.5/k8s 1.22 only if ANY chart depends on /v1 cert-manager api
# usage it *MUST* come after this or prerequisites will fail on an upgrade.
# Helper functions for cert-manager upgrade
Expand Down

0 comments on commit 6152b3b

Please sign in to comment.