}
function install_k8s_storageclass() {
- kubectl apply -f https://openebs.github.io/charts/openebs-operator-1.6.0.yaml
- local storageclass_timeout=300
+ OPENEBS_DIR="$(mktemp -d -q --tmpdir "openebs.XXXXXX")"
+ trap 'rm -rf "${OPENEBS_DIR}"' EXIT
+ wget -q https://openebs.github.io/charts/openebs-operator-1.6.0.yaml -P $OPENEBS_DIR
+ kubectl apply -f $OPENEBS_DIR
+ local storageclass_timeout=400
local counter=0
+ local storageclass_ready=""
echo "Waiting for storageclass"
while (( counter < storageclass_timeout ))
do
if [ $? -eq 0 ] ; then
echo "Storageclass available"
+ storageclass_ready="y"
break
else
counter=$((counter + 15))
sleep 15
fi
done
+ [ -n "$storageclass_ready" ] || FATAL "Storageclass not ready after $storageclass_timeout seconds. Cannot install openebs"
kubectl patch storageclass openebs-hostpath -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
}