File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
2- [ -z " $DEBUG " ] || set -x
3- set -eo pipefail
2+ [ -z " ${ DEBUG:- } " ] || set -x
3+ set -euo pipefail
44
5- [ -z " $1 " ] && echo " First arg should be the path to a _temporary_ kubeconfig file" && exit 1
5+ [ -z " ${1 :- } " ] && echo " First arg should be the path to a _temporary_ kubeconfig file" && exit 1
66
77CONFTEMP=" $1 "
88
99[ ! -f " $CONFTEMP " ] && echo " Temporary file $CONFTEMP not found. No import performed." && exit 1
1010
11- [ -z " $KUBECONFIG " ] && echo " This script requires a KUBECONFIG env. Aborting merge." && exit 1
11+ [ -z " ${ KUBECONFIG:- } " ] && echo " This script requires a KUBECONFIG env. Aborting merge." && exit 1
1212
1313if [ -f " $KUBECONFIG " ]; then
1414 echo " Target kubeconfig $KUBECONFIG already exists. Merging."
15+ # note: current-context becomes whatever CONFTEMP set, because CONFTEMP is listed
16+ # first in KUBECONFIG and --flatten preserves the merged current-context.
1517 KUBECONFIG=" $CONFTEMP :$KUBECONFIG " kubectl config view --flatten > " $CONFTEMP -merged"
1618 mv " $CONFTEMP -merged" " $CONFTEMP "
1719else
You can’t perform that action at this time.
0 commit comments