Skip to content

Commit

Permalink
Wait for CRD creation and remove snapshotclass example create
Browse files Browse the repository at this point in the history
Signed-off-by: Grant Griffiths <grant@portworx.com>
  • Loading branch information
ggriffiths committed Oct 25, 2019
1 parent 7296f9c commit 6ea9b03
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
29 changes: 24 additions & 5 deletions deploy/kubernetes-1.17/deploy-hostpath.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,26 @@ update_image () {
case "$1" in socat) return 1;; esac
}

# VolumeSnapshot CRDs are installed by cluster addon manager, which may
# not be available at this point. Run this as a background process.
function wait-for-apiserver-and-update-volumesnapshot {
# Wait until volumesnapshot CRDs are in place.
until kubectl get volumesnapshotclasses.snapshot.storage.k8s.io
do
sleep 10
done

until kubectl get volumesnapshotcontents.snapshot.storage.k8s.io
do
sleep 10
done

until kubectl get volumesnapshots.snapshot.storage.k8s.io
do
sleep 10
done
}

run () {
echo "$@" >&2
"$@"
Expand All @@ -113,6 +133,10 @@ run () {
echo "deploying volume snapshot CRDs"
kubectl apply -f ${BASE_DIR}/snapshotter/crd

# wait until CRDs are ready
echo "waiting for CRDs to be ready"
wait-for-apiserver-and-update-volumesnapshot

# rbac rules
echo "applying RBAC rules"
for component in CSI_PROVISIONER CSI_ATTACHER CSI_SNAPSHOTTER; do
Expand Down Expand Up @@ -181,8 +205,3 @@ while [ $(kubectl get pods 2>/dev/null | grep '^csi-hostpath.* Running ' | wc -l
cnt=$(($cnt + 1))
sleep 10
done
# deploy snapshotclass
echo "deploying snapshotclass"
kubectl apply -f ${BASE_DIR}/snapshotter/csi-hostpath-snapshotclass.yaml
2 changes: 1 addition & 1 deletion deploy/kubernetes-latest

0 comments on commit 6ea9b03

Please sign in to comment.