Skip to content
Snippets Groups Projects
Verified Commit 2faf7f62 authored by David Hoese's avatar David Hoese
Browse files

Fix elif in create_pvc.sh

parent c829cb02
No related branches found
No related tags found
No related merge requests found
...@@ -68,7 +68,7 @@ create geotiff storage: ...@@ -68,7 +68,7 @@ create geotiff storage:
# copy secret kubeconfig to the mounted (pwd) directory # copy secret kubeconfig to the mounted (pwd) directory
- cp $kubekorner_k3s_config . - cp $kubekorner_k3s_config .
- kubeconfig=$(basename $kubekorner_k3s_config) - kubeconfig=$(basename $kubekorner_k3s_config)
- ./helpers/create_pvc.sh $ns production/geotiff-pvc.yaml $kubeconfig - ./helpers/create_pvc.sh "$ns" "production/geotiff-pvc.yaml" "$kubeconfig"
rules: rules:
- changes: - changes:
- production/geotiff-pvc.yaml - production/geotiff-pvc.yaml
......
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
if [[ $# -eq 2 ]]; then if [[ $# -eq 2 ]]; then
ns=$1 ns=$1
pvc=$2 pvc=$2
EXTRA_ARGS="" EXTRA_ARGS="--namespace $ns"
else if [[ $# -eq 3 ]]; then elif [[ $# -eq 3 ]]; then
ns=$1 ns=$1
pvc=$2 pvc=$2
kubeconfig=$3 kubeconfig=$3
EXTRA_ARGS="--kubeconfig $kubeconfig" EXTRA_ARGS="--namespace $ns --kubeconfig $kubeconfig"
else else
echo "Usage: ./create_pvc.sh <kubernetes namespace> <PVC YAML definition> <kubernetes config file>" echo "Usage: ./create_pvc.sh <kubernetes namespace> <PVC YAML definition> <kubernetes config file>"
exit 1 exit 1
...@@ -19,7 +19,7 @@ fi ...@@ -19,7 +19,7 @@ fi
# didn't change. Let's make sure it exists on the cluster and if so, don't # didn't change. Let's make sure it exists on the cluster and if so, don't
# try to recreate it. # try to recreate it.
if [[ $CI_PIPELINE_SOURCE == "pipeline" ]]; then if [[ $CI_PIPELINE_SOURCE == "pipeline" ]]; then
pvc_exists=$(kubectl $EXTRA_ARGS get pvc --namespace $ns $pvc -o jsonpath="{.metadata.name}" || echo "") pvc_exists=$(kubectl $EXTRA_ARGS get pvc $pvc -o jsonpath="{.metadata.name}" || echo "")
if [[ "$pvc_exists" != "" ]]; then if [[ "$pvc_exists" != "" ]]; then
# it exists # it exists
exit 0 exit 0
...@@ -27,4 +27,3 @@ if [[ $CI_PIPELINE_SOURCE == "pipeline" ]]; then ...@@ -27,4 +27,3 @@ if [[ $CI_PIPELINE_SOURCE == "pipeline" ]]; then
fi fi
kubectl $EXTRA_ARGS apply -f $pvc kubectl $EXTRA_ARGS apply -f $pvc
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment