diff --git a/ceph-osd/Chart.yaml b/ceph-osd/Chart.yaml index 0af580792..997c495fb 100644 --- a/ceph-osd/Chart.yaml +++ b/ceph-osd/Chart.yaml @@ -15,6 +15,6 @@ apiVersion: v1 appVersion: v1.0.0 description: OpenStack-Helm Ceph OSD name: ceph-osd -version: 0.1.7 +version: 0.1.8 home: https://github.com/ceph/ceph ... diff --git a/ceph-osd/templates/bin/_post-apply.sh.tpl b/ceph-osd/templates/bin/_post-apply.sh.tpl index 86ace691e..e47c041bf 100644 --- a/ceph-osd/templates/bin/_post-apply.sh.tpl +++ b/ceph-osd/templates/bin/_post-apply.sh.tpl @@ -32,14 +32,6 @@ ceph --cluster ${CLUSTER} -s function wait_for_pods() { timeout=${2:-1800} end=$(date -ud "${timeout} seconds" +%s) - # Sorting out the pods which are not in Running or Succeeded state. - # In a query the status of containers is checked thus the check - # of init containers is not required. - fields="{name: .metadata.name, \ - status: .status.containerStatuses[].ready, \ - phase: .status.phase}" - select="select((.status) or (.phase==\"Succeeded\") | not)" - query=".items | map( ${fields} | ${select}) | .[]" # Selecting containers with "ceph-osd-default" name and # counting them based on "ready" field. count_pods=".items | map(.status.containerStatuses | .[] | \ @@ -48,8 +40,12 @@ function wait_for_pods() { min_osds="add | if .true >= (.false + .true)*${REQUIRED_PERCENT_OF_OSDS}/100 \ then \"pass\" else \"fail\" end" while true; do - unhealthy_pods=$(kubectl get pods --namespace="${1}" -o json -l component=osd| jq -c "${query}") - if [[ -z "${unhealthy_pods}" ]]; then + # Leaving while loop if minimum amount of OSDs are ready. + # It allows to proceed even if some OSDs are not ready + # or in "CrashLoopBackOff" state + state=$(kubectl get pods --namespace="${1}" -l component=osd -o json | jq "${count_pods}") + osd_state=$(jq -s "${min_osds}" <<< "${state}") + if [[ "${osd_state}" == \"pass\" ]]; then break fi sleep 5 @@ -57,15 +53,6 @@ function wait_for_pods() { if [ $(date -u +%s) -gt $end ] ; then echo -e "Containers failed to start after $timeout seconds\n" kubectl get pods --namespace "${1}" -o wide -l component=osd - # Leaving while loop if minimum amount of OSDs are ready. - # It allows to proceed even if some OSDs are not ready - # or in "CrashLoopBackOff" state - state=$(kubectl get pods --namespace="${1}" -l component=osd -o json | jq "${count_pods}") - osd_state=$(jq -s "${min_osds}" <<< "${state}") - non_osd_state=$(kubectl get pods --namespace="${1}" -l component!=osd -o json | jq -c "${query}") - if [[ -z "${non_osd_state}" && "${osd_state}" == "pass" ]]; then - break - fi exit 1 fi done