diff --git a/.prow.sh b/.prow.sh index 1d0d3f3a1..89d334d25 100755 --- a/.prow.sh +++ b/.prow.sh @@ -1,7 +1,9 @@ #! /bin/bash -CSI_PROW_TESTS="unit" - . release-tools/prow.sh + +CSI_PROW_DRIVER_VERSION='fix_deploy_loop_for_k8s116' +CSI_PROW_DRIVER_REPO='https://github.com/ggriffiths/csi-driver-host-path' + main diff --git a/release-tools/prow.sh b/release-tools/prow.sh index d54dea518..5d028d430 100755 --- a/release-tools/prow.sh +++ b/release-tools/prow.sh @@ -723,7 +723,16 @@ install_snapshot_crds() { # Install snapshot controller and associated RBAC, retrying until the pod is running. install_snapshot_controller() { - kubectl apply -f "https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/${CSI_SNAPSHOTTER_VERSION}/deploy/kubernetes/snapshot-controller/rbac-snapshot-controller.yaml" + set -x + get_local_rbac_path # assigned to local_rbac_path + if ${CSI_PROW_BUILD_JOB}; then + snapshot_controller_rbac_path="$(pwd)/deploy/kubernetes/snapshot-controller/rbac-snapshot-controller.yaml" + else + snapshot_controller_rbac_path="https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/${CSI_SNAPSHOTTER_VERSION}/deploy/kubernetes/snapshot-controller/rbac-snapshot-controller.yaml" + fi + kubectl apply -f "$snapshot_controller_rbac_path" + set +x + cnt=0 until kubectl get clusterrolebinding snapshot-controller-role; do if [ $cnt -gt 30 ]; then @@ -1064,16 +1073,27 @@ main () { docker tag "$i:latest" "$i:csiprow" || die "tagging the locally built container image for $i failed" done - if [ -e deploy/kubernetes/rbac.yaml ]; then - # This is one of those components which has its own RBAC rules (like external-provisioner). - # We are testing a locally built image and also want to test with the the current, - # potentially modified RBAC rules. - if [ "$(echo "$cmds" | wc -w)" != 1 ]; then - die "ambiguous deploy/kubernetes/rbac.yaml: need exactly one command, got: $cmds" + for i in $cmds; do + # For components with multiple cmds, the RBAC file should be in the following format: + # rbac-$cmd.yaml + # If this file cannot be found, we can default to the standard location: + # deploy/kubernetes/rbac.yaml + rbac_file_path=$(find . -type f -name "rbac-$i.yaml") + if [ "$rbac_file_path" == "" ]; then + rbac_file_path="$(pwd)/deploy/kubernetes/rbac.yaml" fi - e=$(echo "$cmds" | tr '[:lower:]' '[:upper:]' | tr - _) - images="$images ${e}_RBAC=$(pwd)/deploy/kubernetes/rbac.yaml" - fi + + if [ -e "$rbac_file_path" ]; then + # This is one of those components which has its own RBAC rules (like external-provisioner). + # We are testing a locally built image and also want to test with the the current, + # potentially modified RBAC rules. + + # snapshot-controller RBAC is handled by the cluster manager + # see install_snapshot_controller() for how this is installed + e=$(echo "$i" | tr '[:lower:]' '[:upper:]' | tr - _) + images="$images ${e}_RBAC=$rbac_file_path" + fi + done fi if tests_need_non_alpha_cluster; then