Skip to content

Commit 65922ea

Browse files
authored
Merge pull request #170 from pohly/canary-snapshot-controller
prow.sh: deploy canary snapshot-controller in canary jobs
2 parents 0438f15 + c0bdfb3 commit 65922ea

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

prow.sh

+13-2
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@ install_snapshot_controller() {
795795
kind load docker-image --name csi-prow ${NEW_IMG} || die "could not load the snapshot-controller:csiprow image into the kind cluster"
796796

797797
# deploy snapshot-controller
798-
echo "Deploying snapshot-controller"
798+
echo "Deploying snapshot-controller from ${SNAPSHOT_CONTROLLER_YAML} with $NEW_IMG."
799799
# Replace image in SNAPSHOT_CONTROLLER_YAML with snapshot-controller:csiprow and deploy
800800
# NOTE: This logic is similar to the logic here:
801801
# https://github.com/kubernetes-csi/csi-driver-host-path/blob/v1.4.0/deploy/util/deploy-hostpath.sh#L155
@@ -832,8 +832,19 @@ install_snapshot_controller() {
832832
echo "$modified"
833833
exit 1
834834
fi
835-
echo "kubectl apply -f ${SNAPSHOT_CONTROLLER_YAML}(modified)"
836835
done
836+
elif [ "${CSI_PROW_DRIVER_CANARY}" = "canary" ]; then
837+
echo "Deploying snapshot-controller from ${SNAPSHOT_CONTROLLER_YAML} with canary images."
838+
yaml="$(kubectl apply --dry-run=client -o yaml -f "$SNAPSHOT_CONTROLLER_YAML")"
839+
# Ignore: See if you can use ${variable//search/replace} instead.
840+
# shellcheck disable=SC2001
841+
modified="$(echo "$yaml" | sed -e "s;image: .*/\([^/:]*\):.*;image: ${CSI_PROW_DRIVER_CANARY_REGISTRY}/\1:canary;")"
842+
diff <(echo "$yaml") <(echo "$modified")
843+
if ! echo "$modified" | kubectl apply -f -; then
844+
echo "modified version of $SNAPSHOT_CONTROLLER_YAML:"
845+
echo "$modified"
846+
exit 1
847+
fi
837848
else
838849
echo "kubectl apply -f $SNAPSHOT_CONTROLLER_YAML"
839850
kubectl apply -f "$SNAPSHOT_CONTROLLER_YAML"

0 commit comments

Comments
 (0)