import-stx: namespace validation after KUBECONFIG export
Changing the order where we check if the namespace exists as we need the KUBECONFIG file exported before we can use kubectl Signed-off-by: Luis Sampaio <luis.sampaio@windriver.com> Change-Id: I6b87f8584830973cec88132b0578cb7df6026747
This commit is contained in:
parent
a6e4871dd9
commit
818ab28eec
10
import-stx
10
import-stx
@ -139,11 +139,6 @@ elif [ "$STX_PLATFORM" = "kubernetes" ]; then
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! kubectl get namespace 2>/dev/null | grep -q $STX_K8S_NAMESPACE; then
|
|
||||||
notice_warn "namespace $STX_K8S_NAMESPACE not found"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$KUBECONFIG" ]; then
|
if [ -z "$KUBECONFIG" ]; then
|
||||||
# Kubeconfig default location inside STX_BUILD_HOME
|
# Kubeconfig default location inside STX_BUILD_HOME
|
||||||
export KUBECONFIG=$STX_BUILD_HOME/.kube/config
|
export KUBECONFIG=$STX_BUILD_HOME/.kube/config
|
||||||
@ -155,6 +150,11 @@ elif [ "$STX_PLATFORM" = "kubernetes" ]; then
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if ! kubectl get namespace 2>/dev/null | grep -q $STX_K8S_NAMESPACE; then
|
||||||
|
notice_warn "namespace $STX_K8S_NAMESPACE not found"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
notice_warn "\$STX_PLATFORM not specified, valid options are: 'minikube' or 'kubernetes'"
|
notice_warn "\$STX_PLATFORM not specified, valid options are: 'minikube' or 'kubernetes'"
|
||||||
return 1
|
return 1
|
||||||
|
Loading…
Reference in New Issue
Block a user