Airflow upgrade fix

This PS has airflow upgrade script that makes sure
that the airflow-worker that is hosting currently
running instance of the script will be deleted at
last. This makes sure that all airflow-workers
will be restarted to apply new config or image.

Change-Id: Iacf6e63e0247ae836e7eb5b7ff24d0369d5e5191
This commit is contained in:
Sergiy Markin 2024-08-23 15:50:31 +00:00
parent 2abc36904a
commit a7a9bd26b9

View File

@ -78,12 +78,21 @@ do
echo -e "Proceeding to upgrade Airflow Worker..." >> /usr/local/airflow/upgrade_airflow_worker.log
echo -e "Deleting Airflow Worker Pods..." >> /usr/local/airflow/upgrade_airflow_worker.log
for i in $(kubectl get pods -n ucp | grep -i airflow-worker | awk '{print $1}'); do
# Delete Airflow Worker pod so that they will respawn with the new
# configurations and/or images
# Delete Airflow Worker pod so that they will respawn with the new
# configurations and/or images
# Get the name of the current pod
CURRENT_POD=$(hostname)
# Loop through all pods matching the 'airflow-worker' pattern, excluding the current pod
for i in $(kubectl get pods -n ucp | grep -i airflow-worker | awk '{print $1}' | grep -v $CURRENT_POD); do
kubectl delete pod $i -n ucp
done
# Finally, delete the current pod
kubectl delete pod $CURRENT_POD -n ucp
echo -e "Airflow Worker Pods Deleted!" >> /usr/local/airflow/upgrade_airflow_worker.log
return 0