Skip to content

Commit 35c63f9

Browse files
authored
Merge pull request #262 from pohly/kubernetes-distributed-capacity-detection
deploy: fix CSIStorageCapacity version check
2 parents 4e95588 + 89e339b commit 35c63f9

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

deploy/kubernetes-distributed/deploy.sh

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,21 @@ for component in CSI_PROVISIONER; do
136136
run kubectl apply -f "${current}"
137137
done
138138

139-
if kubectl get csistoragecapacities 2>&1 | grep "the server doesn't have a resource type"; then
140-
have_csistoragecapacity=false
141-
else
139+
# The cluster must support exactly the version that the external-provisioner supports.
140+
# The problem then becomes that the version of the external-provisioner might get
141+
# changed via CSI_PROVISIONER_TAG, so we cannot just check for the version currently
142+
# listed in the YAML file.
143+
case "$CSI_PROVISIONER_TAG" in
144+
"") csistoragecapacities_api=v1alpha1;; # unchanged, assume version from YAML
145+
*) 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)
146+
esac
147+
resources=$(kubectl api-resources)
148+
if echo "$resources" | grep -q "csistoragecapacities.*storage.k8s.io/$csistoragecapacities_api"; then
142149
have_csistoragecapacity=true
150+
else
151+
have_csistoragecapacity=false
143152
fi
153+
echo "deploying with CSIStorageCapacity: $have_csistoragecapacity"
144154

145155
# deploy hostpath plugin and registrar sidecar
146156
echo "deploying hostpath components"

0 commit comments

Comments
 (0)