Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
notebooks-operations
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
702
Projekty
notebooks-operations
Commits
a0bcc831
Commit
a0bcc831
authored
8 months ago
by
František Dvořák
Browse files
Options
Downloads
Patches
Plain Diff
More robust pods cleaner script - kill everything in Terminating state
parent
4d54f853
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cesnet-central/playbooks/files/usr/local/bin/k8s-pods-cleaner.sh
+4
-5
4 additions, 5 deletions
...central/playbooks/files/usr/local/bin/k8s-pods-cleaner.sh
cesnet-central/playbooks/notebooks.yaml
+1
-1
1 addition, 1 deletion
cesnet-central/playbooks/notebooks.yaml
with
5 additions
and
6 deletions
cesnet-central/playbooks/files/usr/local/bin/k8s-pods-cleaner.sh
+
4
−
5
View file @
a0bcc831
...
@@ -5,18 +5,17 @@
...
@@ -5,18 +5,17 @@
#
#
# Example:
# Example:
#
#
# k8s-pods-cleaner.sh hub
app=jupyterhub,component=singleuser-server
--yes
# k8s-pods-cleaner.sh hub --yes
#
#
if
[
-z
"
$1
"
]
;
then
if
[
-z
"
$1
"
]
;
then
echo
"Usage:
$0
NAMESPACE
[QUERY
[--yes]
]
"
echo
"Usage:
$0
NAMESPACE [--yes]"
exit
0
exit
0
fi
fi
NS
=
"
$1
"
NS
=
"
$1
"
QUERY
=
"
$2
"
PERFORM
=
"
$2
"
PERFORM
=
"
$3
"
for
pod
in
$(
kubectl get pod
-n
"
$NS
"
|
awk
'NR>1 && $3=="Terminating" {print $1}'
)
;
do
for
pod
in
$(
kubectl get pod
-n
"
$NS
"
-l
"
$QUERY
"
--field-selector
=
"status.phase==Failed"
-ojsonpath
=
'{.items[*].metadata.name}'
)
;
do
if
[
-n
"
$PERFORM
"
]
;
then
if
[
-n
"
$PERFORM
"
]
;
then
kubectl get pod
-n
"
$NS
"
"
$pod
"
-oyaml
>
"/tmp/
$NS
-
$pod
.yaml"
kubectl get pod
-n
"
$NS
"
"
$pod
"
-oyaml
>
"/tmp/
$NS
-
$pod
.yaml"
kubectl delete pod
-n
"
$NS
"
"
$pod
"
--force
kubectl delete pod
-n
"
$NS
"
"
$pod
"
--force
...
...
This diff is collapsed.
Click to expand it.
cesnet-central/playbooks/notebooks.yaml
+
1
−
1
View file @
a0bcc831
...
@@ -133,7 +133,7 @@
...
@@ -133,7 +133,7 @@
name
:
"
Notebooks
{{
name
}}
cleanup"
name
:
"
Notebooks
{{
name
}}
cleanup"
minute
:
"
*"
minute
:
"
*"
hour
:
"
*"
hour
:
"
*"
job
:
"
KUBECONFIG=$HOME/.kube/config
/usr/local/bin/k8s-pods-cleaner.sh
'{{
name
}}'
app=jupyterhub,component=singleuser-server
--yes
>/dev/null
2>&1"
job
:
"
KUBECONFIG=$HOME/.kube/config
/usr/local/bin/k8s-pods-cleaner.sh
'{{
name
}}'
--yes
>/dev/null
2>&1"
user
:
egi
user
:
egi
with_fileglob
:
with_fileglob
:
-
"
../deployments/*.yaml"
-
"
../deployments/*.yaml"
...
...
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