[Ceph-OSD] Add comparision of releases of Daemonsets

The PS adds comparison of releases of Daemonsets. If there is
more than one release we need run post-apply job.

Change-Id: If0c55aba4e6450815972586701f0611505d41af5
This commit is contained in:
Kabanov, Dmitrii 2020-06-14 21:15:14 -07:00
parent d88b553727
commit 2a9aa76ae9

View File

@ -147,7 +147,7 @@ function restart_by_rack() {
} }
require_upgrade=0 require_upgrade=0
max_release=0
for ds in `kubectl get ds --namespace=$CEPH_NAMESPACE -l component=osd --no-headers=true|awk '{print $1}'` for ds in `kubectl get ds --namespace=$CEPH_NAMESPACE -l component=osd --no-headers=true|awk '{print $1}'`
do do
@ -156,15 +156,15 @@ do
if [[ $updatedNumberScheduled != $desiredNumberScheduled ]]; then if [[ $updatedNumberScheduled != $desiredNumberScheduled ]]; then
if kubectl get ds -n $CEPH_NAMESPACE $ds -o json|jq -r .status|grep -i "numberAvailable" ;then if kubectl get ds -n $CEPH_NAMESPACE $ds -o json|jq -r .status|grep -i "numberAvailable" ;then
require_upgrade=$((require_upgrade+1)) require_upgrade=$((require_upgrade+1))
_release=`kubectl get ds -n $CEPH_NAMESPACE $ds -o json|jq -r .status.observedGeneration`
max_release=$(( max_release > _release ? max_release : _release ))
fi fi
fi fi
done done
ds=`kubectl get ds -n $CEPH_NAMESPACE -l release_group=$RELEASE_GROUP_NAME --no-headers|awk '{print $1}'|head -n 1` echo "Latest revision of the helm chart(s) is : $max_release"
TARGET_HELM_RELEASE=`kubectl get ds -n $CEPH_NAMESPACE $ds -o json|jq -r .status.observedGeneration`
echo "Latest revision of the helm chart $RELEASE_GROUP_NAME is : $TARGET_HELM_RELEASE"
if [[ $TARGET_HELM_RELEASE -gt 1 ]]; then if [[ $max_release -gt 1 ]]; then
if [[ $require_upgrade -gt 0 ]]; then if [[ $require_upgrade -gt 0 ]]; then
echo "waiting for inactive pgs and degraded obejcts before upgrade" echo "waiting for inactive pgs and degraded obejcts before upgrade"
wait_for_inactive_pgs wait_for_inactive_pgs