Add option to use existing images (#4435)

This commit is contained in:
Manuel Alejandro de Brito Fontes 2019-08-13 09:15:57 -04:00 committed by GitHub
parent 0fb77ae416
commit d406c96ce8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -30,6 +30,7 @@ declare -a mandatory
mandatory=( mandatory=(
IMAGE IMAGE
ARCH ARCH
TAG
) )
missing=false missing=false
@ -56,12 +57,12 @@ trap cleanup EXIT
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/.. KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
# the ingress controller needs this two variables. To avoid the # the ingress controller needs this two variables. To avoid the
# creation of any object in the cluster we use invalid names. # creation of any object in the cluster we use invalid names.
POD_NAMESPACE="invalid-namespace" POD_NAMESPACE="invalid-namespace"
POD_NAME="invalid-namespace" POD_NAME="invalid-namespace"
export TAG=local export TAG
export IMAGE export IMAGE
if [[ "${ARCH}" != "amd64" ]]; then if [[ "${ARCH}" != "amd64" ]]; then
@ -69,8 +70,14 @@ if [[ "${ARCH}" != "amd64" ]]; then
make -C "${KUBE_ROOT}" register-qemu make -C "${KUBE_ROOT}" register-qemu
fi fi
echo -e "${BGREEN}Building ingress controller image${NC}" USE_EXISTING_IMAGE=${USE_EXISTING_IMAGE:-false}
make -C "${KUBE_ROOT}" build "sub-container-${ARCH}" if [[ "${USE_EXISTING_IMAGE}" == "true" ]]; then
echo -e "${BGREEN}Downloading ingress controller image${NC}"
docker pull "${IMAGE}-${ARCH}:${TAG}"
else
echo -e "${BGREEN}Building ingress controller image${NC}"
make -C "${KUBE_ROOT}" build "sub-container-${ARCH}"
fi
CONTEXT=$(kubectl config current-context) CONTEXT=$(kubectl config current-context)
@ -103,7 +110,7 @@ docker run \
-v "${SSL_VOLUME}:/etc/ingress-controller/ssl/" \ -v "${SSL_VOLUME}:/etc/ingress-controller/ssl/" \
-v "${HOME}/.kube:${HOME}/.kube:ro" \ -v "${HOME}/.kube:${HOME}/.kube:ro" \
${MINIKUBE_VOLUME} \ ${MINIKUBE_VOLUME} \
"${IMAGE}:${TAG}" /nginx-ingress-controller \ "${IMAGE}-${ARCH}:${TAG}" /nginx-ingress-controller \
--update-status=false \ --update-status=false \
--v=2 \ --v=2 \
--apiserver-host=http://0.0.0.0:8001 \ --apiserver-host=http://0.0.0.0:8001 \