Fix scripts to run in osx (#5061)

This commit is contained in:
Manuel Alejandro de Brito Fontes 2020-02-12 21:17:26 -03:00 committed by GitHub
parent 0365a7c172
commit 28350f9876
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 5 deletions

View file

@ -30,11 +30,21 @@ export REGISTRY=${REGISTRY:-ingress-controller}
DEV_IMAGE=${REGISTRY}/nginx-ingress-controller:${TAG}
kind --version || $(echo "Please install kind.";exit 1)
if ! command -v kind &> /dev/null; then
echo "kind is not installed"
echo "Use a package manager or visit the official site https://kind.sigs.k8s.io"
exit 1
fi
if ! command -v kubectl &> /dev/null; then
echo "Please install kubectl 1.15 or higher"
exit 1
fi
KUBE_CLIENT_VERSION=$(kubectl version --client --short | awk '{print $3}' | cut -d. -f2) || true
if [[ ${KUBE_CLIENT_VERSION} -lt 14 ]]; then
echo "[dev-env] Please update kubectl to 1.15 or higher"
echo "Please update kubectl to 1.15 or higher"
exit 1
fi
echo "[dev-env] building container"
@ -83,7 +93,7 @@ kubectl apply -k ${DIR}/../deploy/kind
echo "[dev-env] deleting old ingress-nginx pods..."
kubectl get pods --namespace ingress-nginx -o go-template \
--template '{{range .items}}{{.metadata.name}} {{.metadata.creationTimestamp}}{{"\n"}}{{end}}' | \
awk '$2 <= "'$(date -d'now-1 minute' -Ins --utc | sed 's/+0000/Z/')'" { print $1 }' | \
awk '$2 <= $(python -c "from datetime import datetime,timedelta; print((datetime.now()-timedelta(seconds=60)).strftime(\"%Y-%m-%dT%H:%M:%S%Z\"))") { print $1 }' | \
xargs --no-run-if-empty kubectl delete pod --namespace ingress-nginx
cat <<EOF

View file

@ -47,6 +47,11 @@ if ! command -v parallel &> /dev/null; then
exit 1
fi
if ! command -v kind --version &> /dev/null; then
echo "kind is not installed. Use the package manager or visit the official site https://kind.sigs.k8s.io/"
exit 1
fi
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
export TAG=dev
@ -59,8 +64,6 @@ export DOCKER_CLI_EXPERIMENTAL=enabled
KIND_CLUSTER_NAME="ingress-nginx-dev"
kind --version || $(echo "Please install kind before running e2e tests";exit 1)
echo "[dev-env] creating Kubernetes cluster with kind"
export KUBECONFIG="${HOME}/.kube/kind-config-${KIND_CLUSTER_NAME}"