Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set KUBECONFIG to the $HOME/.kube/config if missing #317

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions scripts/apb-docker-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ if ! [[ -z "${DOCKER_CERT_PATH}" ]] && [[ ${DOCKER_CERT_PATH} = *"minishift"* ]]
fi

KUBECONFIG_ENV="${KUBECONFIG:+-v ${KUBECONFIG}:${KUBECONFIG} -e KUBECONFIG=${KUBECONFIG}}"
[[ -z $KUBECONFIG ]] && KUBECONFIG_ENV="${KUBECONFIG:--v $HOME/.kube:/.kube -e KUBECONFIG=/.kube/config}"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe even better, remove this, and just set KUBECONFIG in line 17, if its not set yet:

KUBECONFIG=${KUBECONFIG:-/.kube/config}


if [[ $IS_MINISHIFT = true ]]; then
# If targetting minishift, there are some unique issues with using the apb
Expand All @@ -36,7 +37,7 @@ if [[ $IS_MINISHIFT = true ]]; then
unset DOCKER_CERT_PATH

docker run --rm --privileged \
-v $PWD:/mnt -v $HOME/.kube:/.kube \
-v $PWD:/mnt \
-v $MINISHIFT_DOCKER_CERT_SRC:$MINISHIFT_DOCKER_CERT_DEST \
-e DOCKER_TLS_VERIFY="1" \
-e DOCKER_HOST="${MINISHIFT_DOCKER_HOST}" \
Expand All @@ -46,7 +47,7 @@ if [[ $IS_MINISHIFT = true ]]; then
-u $UID $APB_IMAGE "$@"
else
docker run --rm --privileged \
-v $PWD:/mnt -v $HOME/.kube:/.kube \
-v $PWD:/mnt \
-v /var/run/docker.sock:/var/run/docker.sock \
${KUBECONFIG_ENV} \
-u $UID $APB_IMAGE "$@"
Expand Down