Skip to content

Commit f946d8c

Browse files
committed
Only deploy snapshotclass for k8s >= 1.17
Signed-off-by: Grant Griffiths <[email protected]>
1 parent 5a4616d commit f946d8c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

deploy/util/deploy-hostpath.sh

+7-3
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ function rbac_version () {
104104
function version_gt() {
105105
versions=$(for ver in "$@"; do ver=${ver#release-}; echo ${ver#v}; done)
106106
greaterVersion=${1#"release-"};
107+
greaterVersion=${1#"kubernetes-"};
107108
greaterVersion=${greaterVersion#"v"};
108109
test "$(printf '%s' "$versions" | sort -V | head -n 1)" != "$greaterVersion"
109110
}
@@ -218,6 +219,9 @@ while [ $(kubectl get pods 2>/dev/null | grep '^csi-hostpath.* Running ' | wc -l
218219
done
219220
220221
# deploy snapshotclass
221-
echo "deploying snapshotclass"
222-
SNAPSHOTCLASS_PATH="${BASE_DIR}/snapshotter/csi-hostpath-snapshotclass.yaml"
223-
kubectl apply -f $SNAPSHOTCLASS_PATH
222+
echo "deploying snapshotclass based on snapshotter version"
223+
snapshotter_version="$(rbac_version "${BASE_DIR}/hostpath/csi-hostpath-snapshotter.yaml" csi-snapshotter false)"
224+
driver_version="$(basename $PWD)"
225+
if [ version_gt $driver_version "1.16" ]; then
226+
kubectl apply -f "https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/${snapshotter_version}/examples/kubernetes/snapshotclass.yaml"
227+
fi

0 commit comments

Comments
 (0)