[ceph-osd] Update post apply job
The PS updates wait_for_pods() function in post apply script. The changes allow to pass wait_for_pods() function when required percent of OSDs reached (REQUIRED_PERCENT_OF_OSDS). Also removed a part of code which is not needed any more. Change-Id: I56f1292682cf2aa933c913df162d6f615cf1a133
This commit is contained in:
parent
c43331d67a
commit
d39abfe0f0
@ -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
|
||||
...
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user