Skip to content

Commit

Permalink
rancher2-deployment: fix check for namespaces (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
kr1sp1n authored and bemeyert committed Feb 13, 2020
1 parent 26743f2 commit 5da6751
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion rancher2-deployment/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,13 @@ if [[ -z $NO_LOGIN ]] ; then

rancher context switch "${RANCHER_CONTEXT}"

if rancher namespace ls --format '{{.Namespace.Name}}' | grep -q "^${RANCHER_NAMESPACE}$" ; then
echo "Check if namespace ${RANCHER_NAMESPACE} exists..."
set +e
rancher kubectl get namespace "${RANCHER_NAMESPACE}"
set -e

# Check if last command was successful:
if [[ $? -eq 0 ]] ; then
echo "Namespace ${RANCHER_NAMESPACE} already exists."
else
rancher namespace create "${RANCHER_NAMESPACE}"
Expand Down

0 comments on commit 5da6751

Please sign in to comment.