Ceph-Provisioner: wait for helm tests related pods
This is to update logic to wait for pods created by helm tests. Change-Id: Ic1ee293613a0b050be9fa01a29642bfc9e8de2d7
This commit is contained in:
parent
819cf51083
commit
ddbe20a30b
@ -40,6 +40,7 @@ function storageclass_validation()
|
||||
pod_name=$2
|
||||
pvc_name=$3
|
||||
storageclass=$4
|
||||
|
||||
echo "--> Starting validation"
|
||||
|
||||
# storageclass check
|
||||
@ -64,9 +65,9 @@ spec:
|
||||
EOF
|
||||
|
||||
# waiting for pvc to get create
|
||||
end=$(($(date +%s) + 120))
|
||||
while ! kubectl get pvc -n $pvc_namespace $pvc_name|grep Bound; do
|
||||
if [ "$(date +%s)" -gt $end ]; then
|
||||
end=$(($(date +%s) + TEST_POD_WAIT_TIMEOUT))
|
||||
while ! kubectl get pvc -n $pvc_namespace $pvc_name | grep Bound; do
|
||||
if [ "$(date +%s)" -gt "${end}" ]; then
|
||||
kubectl get pvc -n $pvc_namespace $pvc_name
|
||||
kubectl get pv
|
||||
echo "Storageclass is available but can't create PersistentVolumeClaim."
|
||||
@ -101,12 +102,16 @@ spec:
|
||||
claimName: $pvc_name
|
||||
EOF
|
||||
|
||||
# waiting for pod to get create
|
||||
sleep 60
|
||||
if ! kubectl get pods -n $pvc_namespace $pod_name; then
|
||||
echo "Can not create POD with rbd storage class $storageclass based PersistentVolumeClaim."
|
||||
echo 1
|
||||
fi
|
||||
# waiting for pod to get completed
|
||||
end=$(($(date +%s) + TEST_POD_WAIT_TIMEOUT))
|
||||
while ! kubectl get pods -n $pvc_namespace $pod_name | grep -i Completed; do
|
||||
if [ "$(date +%s)" -gt "${end}" ]; then
|
||||
kubectl get pods -n $pvc_namespace $pod_name
|
||||
echo "Cannot create POD with rbd storage class $storageclass based PersistentVolumeClaim."
|
||||
exit 1
|
||||
fi
|
||||
sleep 10
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
|
@ -91,6 +91,8 @@ spec:
|
||||
value: {{ .Values.pod.test_pod.cephfs.name }}
|
||||
- name: CEPHFS_TEST_PVC_NAME
|
||||
value: {{ .Values.pod.test_pod.cephfs.pvc_name }}
|
||||
- name: TEST_POD_WAIT_TIMEOUT
|
||||
value: {{ .Values.pod.test_pod.wait_timeout | quote }}
|
||||
command:
|
||||
- /tmp/helm-tests.sh
|
||||
volumeMounts:
|
||||
|
@ -53,6 +53,7 @@ labels:
|
||||
|
||||
pod:
|
||||
test_pod:
|
||||
wait_timeout: 120
|
||||
rbd:
|
||||
name: rbd-prov-test-pod
|
||||
pvc_name: rbd-prov-test-pvc
|
||||
|
Loading…
Reference in New Issue
Block a user