Skip to content

Commit d8c76fe

Browse files
committed
Support local snapshot RBAC for pull jobs
Signed-off-by: Grant Griffiths <grant@portworx.com>
1 parent 152396e commit d8c76fe

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

prow.sh

+16-10
Original file line numberDiff line numberDiff line change
@@ -1064,18 +1064,24 @@ main () {
10641064
# always pulling the image
10651065
# (https://github.com/kubernetes-sigs/kind/issues/328).
10661066
docker tag "$i:latest" "$i:csiprow" || die "tagging the locally built container image for $i failed"
1067-
done
10681067

1069-
if [ -e deploy/kubernetes/rbac.yaml ]; then
1070-
# This is one of those components which has its own RBAC rules (like external-provisioner).
1071-
# We are testing a locally built image and also want to test with the the current,
1072-
# potentially modified RBAC rules.
1073-
if [ "$(echo "$cmds" | wc -w)" != 1 ]; then
1074-
die "ambiguous deploy/kubernetes/rbac.yaml: need exactly one command, got: $cmds"
1068+
# For components with multiple cmds, the RBAC file should be in the following format:
1069+
# rbac-$cmd.yaml
1070+
# If this file cannot be found, we can default to the standard location:
1071+
# deploy/kubernetes/rbac.yaml
1072+
rbac_file_path=$(find . -type f -name "rbac-$i.yaml")
1073+
if [ "$rbac_file_path" == "" ]; then
1074+
rbac_file_path="$(pwd)/deploy/kubernetes/rbac.yaml"
10751075
fi
1076-
e=$(echo "$cmds" | tr '[:lower:]' '[:upper:]' | tr - _)
1077-
images="$images ${e}_RBAC=$(pwd)/deploy/kubernetes/rbac.yaml"
1078-
fi
1076+
1077+
if [ -e "$rbac_file_path" ]; then
1078+
# This is one of those components which has its own RBAC rules (like external-provisioner).
1079+
# We are testing a locally built image and also want to test with the the current,
1080+
# potentially modified RBAC rules.
1081+
e=$(echo "$i" | tr '[:lower:]' '[:upper:]' | tr - _)
1082+
images="$images ${e}_RBAC=$rbac_file_path"
1083+
fi
1084+
done
10791085
fi
10801086

10811087
if tests_need_non_alpha_cluster; then

0 commit comments

Comments
 (0)