From 2a9aa76ae9f055647d4a795f1614a31f9bdf2efd Mon Sep 17 00:00:00 2001 From: "Kabanov, Dmitrii" Date: Sun, 14 Jun 2020 21:15:14 -0700 Subject: [PATCH] [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 --- ceph-osd/templates/bin/_post-apply.sh.tpl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ceph-osd/templates/bin/_post-apply.sh.tpl b/ceph-osd/templates/bin/_post-apply.sh.tpl index be9fce7b7b..e4c994c4d8 100644 --- a/ceph-osd/templates/bin/_post-apply.sh.tpl +++ b/ceph-osd/templates/bin/_post-apply.sh.tpl @@ -147,7 +147,7 @@ function restart_by_rack() { } require_upgrade=0 - +max_release=0 for ds in `kubectl get ds --namespace=$CEPH_NAMESPACE -l component=osd --no-headers=true|awk '{print $1}'` do @@ -156,15 +156,15 @@ do if [[ $updatedNumberScheduled != $desiredNumberScheduled ]]; then if kubectl get ds -n $CEPH_NAMESPACE $ds -o json|jq -r .status|grep -i "numberAvailable" ;then 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 done -ds=`kubectl get ds -n $CEPH_NAMESPACE -l release_group=$RELEASE_GROUP_NAME --no-headers|awk '{print $1}'|head -n 1` -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" +echo "Latest revision of the helm chart(s) is : $max_release" -if [[ $TARGET_HELM_RELEASE -gt 1 ]]; then +if [[ $max_release -gt 1 ]]; then if [[ $require_upgrade -gt 0 ]]; then echo "waiting for inactive pgs and degraded obejcts before upgrade" wait_for_inactive_pgs