Skip to content

Commit b23a782

Browse files
authored
Merge pull request #266 from pohly/kubernetes-distributed-deploy-fix-2
deploy: fix CSIStorageCapacity check on alpha clusters
2 parents d28ece6 + bc8e66b commit b23a782

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

deploy/kubernetes-distributed/deploy.sh

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,19 @@ case "$CSI_PROVISIONER_TAG" in
144144
"") csistoragecapacities_api=v1alpha1;; # unchanged, assume version from YAML
145145
*) csistoragecapacities_api=v1beta1;; # set, assume that it is more recent *and* a version that uses v1beta1 (https://github.com/kubernetes-csi/external-provisioner/pull/584)
146146
esac
147-
resources=$(kubectl api-resources)
148-
if echo "$resources" | grep -q "csistoragecapacities.*storage.k8s.io/$csistoragecapacities_api"; then
149-
have_csistoragecapacity=true
150-
else
147+
get_csistoragecapacities=$(kubectl get csistoragecapacities.${csistoragecapacities_api}.storage.k8s.io 2>&1 || true)
148+
if echo "$get_csistoragecapacities" | grep -q "the server doesn't have a resource type"; then
151149
have_csistoragecapacity=false
150+
else
151+
have_csistoragecapacity=true
152+
echo "csistoragecapacities.${csistoragecapacities_api}.storage.k8s.io:"
153+
show_lines=4
154+
echo "$get_csistoragecapacities" | head -n $show_lines | sed -e 's/^/ /'
155+
if [ $(echo "$get_csistoragecapacities" | wc -l) -gt $show_lines ]; then
156+
echo " ..."
157+
fi
152158
fi
153-
echo "deploying with CSIStorageCapacity: $have_csistoragecapacity"
159+
echo "deploying with CSIStorageCapacity $csistoragecapacities_api: $have_csistoragecapacity"
154160

155161
# deploy hostpath plugin and registrar sidecar
156162
echo "deploying hostpath components"

0 commit comments

Comments
 (0)