Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
geosphere-deploy
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cspp_geo
geosphere
geosphere-deploy
Commits
99d50e7a
Verified
Commit
99d50e7a
authored
4 years ago
by
David Hoese
Browse files
Options
Downloads
Patches
Plain Diff
Try some fancier PVC checks
parent
3064409a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+1
-1
1 addition, 1 deletion
.gitlab-ci.yml
helpers/create_pvc.sh
+27
-8
27 additions, 8 deletions
helpers/create_pvc.sh
with
28 additions
and
9 deletions
.gitlab-ci.yml
+
1
−
1
View file @
99d50e7a
...
...
@@ -64,7 +64,7 @@ create geotiff storage:
# copy secret kubeconfig to the mounted (pwd) directory
-
cp $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"
"cspp-geo-geo2grid"
"$kubeconfig"
# this job doesn't actually need any artifacts from previous jobs
dependencies
:
[]
rules
:
...
...
This diff is collapsed.
Click to expand it.
helpers/create_pvc.sh
+
27
−
8
View file @
99d50e7a
#!/usr/bin/env bash
if
[[
$#
-eq
2
]]
;
then
fail
()
{
echo
"
$@
"
exit
3
}
if
[[
$#
-eq
3
]]
;
then
ns
=
$1
pvc
=
$2
pvc_file
=
$2
pvc_name
=
$3
EXTRA_ARGS
=
"--namespace
$ns
"
elif
[[
$#
-eq
3
]]
;
then
elif
[[
$#
-eq
4
]]
;
then
ns
=
$1
pvc
=
$2
kubeconfig
=
$3
pvc_file
=
$2
pvc_name
=
$3
kubeconfig
=
$4
EXTRA_ARGS
=
"--namespace
$ns
--kubeconfig
$kubeconfig
"
else
echo
"Usage: ./create_pvc.sh <kubernetes namespace> <PVC YAML definition> <kubernetes config file>"
echo
"Usage: ./create_pvc.sh <kubernetes namespace> <PVC YAML definition>
<PVC name> [
<kubernetes config file>
]
"
exit
1
fi
...
...
@@ -19,11 +26,23 @@ fi
# didn't change. Let's make sure it exists on the cluster and if so, don't
# try to recreate it.
if
[[
$CI_PIPELINE_SOURCE
==
"pipeline"
]]
;
then
pvc_exists
=
$(
kubectl
$EXTRA_ARGS
get pvc
$pvc
-o
jsonpath
=
"{.metadata.name}"
||
echo
""
)
pvc_exists
=
$(
kubectl
$EXTRA_ARGS
get pvc
$pvc
_name
-o
jsonpath
=
"{.metadata.name}"
||
echo
""
)
if
[[
"
$pvc_exists
"
!=
""
]]
;
then
# it exists
exit
0
fi
fi
kubectl
$EXTRA_ARGS
replace
-f
$pvc
\ No newline at end of file
pvc_pending
=
$(
kubectl
$EXTRA_ARGS
get pvc
$pvc_name
-o
jsonpath
=
"{.status.phase}"
||
echo
""
)
if
[[
$pvc_pending
==
""
]]
;
then
echo
"PVC does not exist, creating..."
elif
[[
$pvc_pending
!=
"Pending"
]]
;
then
echo
"PVC already exists and is not pending. Manually 'helm uninstall' all bound pods"
exit
2
else
echo
"PVC exists but is pending, deleting..."
# kubectl $EXTRA_ARGS delete $pvc_name || fail "Could not delete existing PVC"
fi
kubectl
$EXTRA_ARGS
replace
-f
$pvc_file
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment