Skip to content
This repository has been archived by the owner on Jul 4, 2024. It is now read-only.

Commit

Permalink
Use minikube context for local installation (#1904)
Browse files Browse the repository at this point in the history
* Add explicit context setting for kubectl

* Extract function

* Prettify
  • Loading branch information
desislavaa committed Jun 18, 2021
1 parent f2fe2f4 commit 8d39566
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
2 changes: 2 additions & 0 deletions installation/cmd/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ if [[ ! ${SKIP_MINIKUBE_START} ]]; then
fi
fi

useMinikube

echo "Label Minikube node for benchmark execution..."
NODE=$(kubectl get nodes | tail -n 1 | cut -d ' ' -f 1)
kubectl label node "$NODE" benchmark=true || true
Expand Down
1 change: 1 addition & 0 deletions installation/scripts/install-kyma.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ LOCAL_ENV=${LOCAL_ENV:-false}
CURRENT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
SCRIPTS_DIR="${CURRENT_DIR}/../scripts"
source $SCRIPTS_DIR/utils.sh
useMinikube

POSITIONAL=()
while [[ $# -gt 0 ]]
Expand Down
5 changes: 3 additions & 2 deletions installation/scripts/run-compass-installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ set -o errexit

CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
SCRIPTS_DIR="${CURRENT_DIR}/../scripts"
source $CURRENT_DIR/utils.sh
useMinikube

DOMAIN="kyma.local"

VM_DRIVER="virtualbox"
if [ `uname -s` = "Darwin" ]; then
VM_DRIVER="hyperkit"
fi

source $CURRENT_DIR/utils.sh

POSITIONAL=()
while [[ $# -gt 0 ]]
do
Expand Down
16 changes: 15 additions & 1 deletion installation/scripts/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,18 @@ function checkInputParameterValue() {
echo "Make sure parameter value is neither empty nor start with two hyphens"
exit 1
fi
}
}

function useMinikube() {
CURRENT_CONTEXT=$(kubectl config current-context)
if [ $CURRENT_CONTEXT != "minikube" ]; then
echo "Current context is not minikube, switching to minikube..."
minikube update-context
if [ $? -ne 0 ]; then
echo "Failed to update context to minikube. Local installation requires minikube running"
return 1
fi
fi

echo "Using minikube kubectl context"
}

0 comments on commit 8d39566

Please sign in to comment.