Skip to content

Commit

Permalink
Merge pull request #4290 from mdonkers/make-dev-env-linux
Browse files Browse the repository at this point in the history
Make dev-env.sh script work on Linux
  • Loading branch information
k8s-ci-robot authored Jul 8, 2019
2 parents 3a63f3d + a4d92f4 commit 3261866
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions build/dev-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,33 @@ make build container

docker save "${DEV_IMAGE}" | (eval $(minikube docker-env --shell bash) && docker load) || true

for tool in kubectl kustomize; do
echo "[dev-env] installing $tool"
$tool version || brew install $tool
done
# kubectl >= 1.14 includes Kustomize via "apply -k". Makes it easier to use on Linux as well, assuming kubectl installed
KUBE_CLIENT_VERSION=$(kubectl version --client --short | awk '{print $3}' | cut -d. -f2) || true
if [[ ${KUBE_CLIENT_VERSION} -lt 14 ]]; then
for tool in kubectl kustomize; do
echo "[dev-env] installing $tool"
$tool version || brew install $tool
done
fi

if ! kubectl get namespace "${NAMESPACE}"; then
kubectl create namespace "${NAMESPACE}"
fi

ROOT=./deploy/minikube

pushd $ROOT
kustomize edit set namespace "${NAMESPACE}"
kustomize edit set image "quay.io/kubernetes-ingress-controller/nginx-ingress-controller=${DEV_IMAGE}"
popd
if [[ ${KUBE_CLIENT_VERSION} -lt 14 ]]; then
pushd $ROOT
kustomize edit set namespace "${NAMESPACE}"
kustomize edit set image "quay.io/kubernetes-ingress-controller/nginx-ingress-controller=${DEV_IMAGE}"
popd

echo "[dev-env] deploying NGINX Ingress controller in namespace $NAMESPACE"
kustomize build $ROOT | kubectl apply -f -
else
sed -i "\\|^namespace:|c \\namespace: ${NAMESPACE}" "${ROOT}/kustomization.yaml"
sed -i "\\|^- name: quay.io|c \\- name: quay.io/kubernetes-ingress-controller/nginx-ingress-controller=${DEV_IMAGE}" "${ROOT}/kustomization.yaml"

echo "[dev-env] deploying NGINX Ingress controller in namespace $NAMESPACE"
kustomize build $ROOT | kubectl apply -f -
echo "[dev-env] deploying NGINX Ingress controller in namespace $NAMESPACE"
kubectl apply -k "${ROOT}"
fi

0 comments on commit 3261866

Please sign in to comment.