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:
Chinasubbareddy Mallavarapu 2019-06-24 15:47:31 -05:00
parent 819cf51083
commit ddbe20a30b
3 changed files with 17 additions and 9 deletions

View File

@ -40,6 +40,7 @@ function storageclass_validation()
pod_name=$2 pod_name=$2
pvc_name=$3 pvc_name=$3
storageclass=$4 storageclass=$4
echo "--> Starting validation" echo "--> Starting validation"
# storageclass check # storageclass check
@ -64,9 +65,9 @@ spec:
EOF EOF
# waiting for pvc to get create # waiting for pvc to get create
end=$(($(date +%s) + 120)) end=$(($(date +%s) + TEST_POD_WAIT_TIMEOUT))
while ! kubectl get pvc -n $pvc_namespace $pvc_name|grep Bound; do while ! kubectl get pvc -n $pvc_namespace $pvc_name | grep Bound; do
if [ "$(date +%s)" -gt $end ]; then if [ "$(date +%s)" -gt "${end}" ]; then
kubectl get pvc -n $pvc_namespace $pvc_name kubectl get pvc -n $pvc_namespace $pvc_name
kubectl get pv kubectl get pv
echo "Storageclass is available but can't create PersistentVolumeClaim." echo "Storageclass is available but can't create PersistentVolumeClaim."
@ -101,12 +102,16 @@ spec:
claimName: $pvc_name claimName: $pvc_name
EOF EOF
# waiting for pod to get create # waiting for pod to get completed
sleep 60 end=$(($(date +%s) + TEST_POD_WAIT_TIMEOUT))
if ! kubectl get pods -n $pvc_namespace $pod_name; then while ! kubectl get pods -n $pvc_namespace $pod_name | grep -i Completed; do
echo "Can not create POD with rbd storage class $storageclass based PersistentVolumeClaim." if [ "$(date +%s)" -gt "${end}" ]; then
echo 1 kubectl get pods -n $pvc_namespace $pod_name
echo "Cannot create POD with rbd storage class $storageclass based PersistentVolumeClaim."
exit 1
fi fi
sleep 10
done
} }

View File

@ -91,6 +91,8 @@ spec:
value: {{ .Values.pod.test_pod.cephfs.name }} value: {{ .Values.pod.test_pod.cephfs.name }}
- name: CEPHFS_TEST_PVC_NAME - name: CEPHFS_TEST_PVC_NAME
value: {{ .Values.pod.test_pod.cephfs.pvc_name }} value: {{ .Values.pod.test_pod.cephfs.pvc_name }}
- name: TEST_POD_WAIT_TIMEOUT
value: {{ .Values.pod.test_pod.wait_timeout | quote }}
command: command:
- /tmp/helm-tests.sh - /tmp/helm-tests.sh
volumeMounts: volumeMounts:

View File

@ -53,6 +53,7 @@ labels:
pod: pod:
test_pod: test_pod:
wait_timeout: 120
rbd: rbd:
name: rbd-prov-test-pod name: rbd-prov-test-pod
pvc_name: rbd-prov-test-pvc pvc_name: rbd-prov-test-pvc