Skip to content

Commit fe1f284

Browse files
authored
Merge pull request #121 from kvaps/namespace-check
Check namespace for snapshot-controller
2 parents 8fdf0f7 + ece0f50 commit fe1f284

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

prow.sh

+6-5
Original file line numberDiff line numberDiff line change
@@ -796,16 +796,17 @@ install_snapshot_controller() {
796796
echo "kubectl apply -f ${SNAPSHOT_CONTROLLER_YAML}(modified)"
797797
done
798798
else
799-
echo "kubectl apply -f ${CONTROLLER_DIR}/deploy/kubernetes/snapshot-controller/setup-snapshot-controller.yaml"
800-
kubectl apply -f "${CONTROLLER_DIR}/deploy/kubernetes/snapshot-controller/setup-snapshot-controller.yaml"
799+
echo "kubectl apply -f $SNAPSHOT_CONTROLLER_YAML"
800+
kubectl apply -f "$SNAPSHOT_CONTROLLER_YAML"
801801
fi
802802
803803
cnt=0
804-
expected_running_pods=$(curl https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/"${CSI_SNAPSHOTTER_VERSION}"/deploy/kubernetes/snapshot-controller/setup-snapshot-controller.yaml | grep replicas | cut -d ':' -f 2-)
805-
while [ "$(kubectl get pods -l app=snapshot-controller | grep 'Running' -c)" -lt "$expected_running_pods" ]; do
804+
expected_running_pods=$(kubectl apply --dry-run=client -o "jsonpath={.spec.replicas}" -f "$SNAPSHOT_CONTROLLER_YAML")
805+
expected_namespace=$(kubectl apply --dry-run=client -o "jsonpath={.metadata.namespace}" -f "$SNAPSHOT_CONTROLLER_YAML")
806+
while [ "$(kubectl get pods -n "$expected_namespace" -l app=snapshot-controller | grep 'Running' -c)" -lt "$expected_running_pods" ]; do
806807
if [ $cnt -gt 30 ]; then
807808
echo "snapshot-controller pod status:"
808-
kubectl describe pods -l app=snapshot-controller
809+
kubectl describe pods -n "$expected_namespace" -l app=snapshot-controller
809810
echo >&2 "ERROR: snapshot controller not ready after over 5 min"
810811
exit 1
811812
fi

0 commit comments

Comments
 (0)