Make dev-env.sh script work on Linux
This commit is contained in:
parent
7c297e001a
commit
a4d92f4244
1 changed files with 22 additions and 10 deletions
|
@ -47,10 +47,14 @@ make build container
|
|||
|
||||
docker save "${DEV_IMAGE}" | (eval $(minikube docker-env --shell bash) && docker load) || true
|
||||
|
||||
for tool in kubectl kustomize; do
|
||||
# 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
|
||||
done
|
||||
fi
|
||||
|
||||
if ! kubectl get namespace "${NAMESPACE}"; then
|
||||
kubectl create namespace "${NAMESPACE}"
|
||||
|
@ -58,10 +62,18 @@ 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 -
|
||||
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"
|
||||
kubectl apply -k "${ROOT}"
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue