Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
theodolite
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Contributor 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
Sören Henning
theodolite
Commits
505cb2db
Commit
505cb2db
authored
3 years ago
by
Lorenz Boguhn
Committed by
Sören Henning
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Block after deletion
for deployments in K8sManager.kt
parent
29e0d5dc
No related branches found
No related tags found
4 merge requests
!159
Re-implementation of Theodolite with Kotlin/Quarkus
,
!157
Update Graal Image in CI pipeline
,
!130
Fix K8sManager + EnvVarPatcher
,
!83
WIP: Re-implementation of Theodolite with Kotlin/Quarkus
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
theodolite-quarkus/src/main/kotlin/theodolite/k8s/K8sManager.kt
+21
-2
21 additions, 2 deletions
...lite-quarkus/src/main/kotlin/theodolite/k8s/K8sManager.kt
with
21 additions
and
2 deletions
theodolite-quarkus/src/main/kotlin/theodolite/k8s/K8sManager.kt
+
21
−
2
View file @
505cb2db
...
...
@@ -39,16 +39,35 @@ class K8sManager(private val client: NamespacedKubernetesClient) {
*/
fun
remove
(
resource
:
KubernetesResource
)
{
when
(
resource
)
{
is
Deployment
->
is
Deployment
->
{
val
label
=
resource
.
spec
.
selector
.
matchLabels
[
"app"
]
!!
this
.
client
.
apps
().
deployments
().
delete
(
resource
)
blockUntilDeleted
(
label
)
}
is
Service
->
this
.
client
.
services
().
delete
(
resource
)
is
ConfigMap
->
this
.
client
.
configMaps
().
delete
(
resource
)
is
StatefulSet
->
is
StatefulSet
->
{
val
label
=
resource
.
spec
.
selector
.
matchLabels
[
"app"
]
!!
this
.
client
.
apps
().
statefulSets
().
delete
(
resource
)
blockUntilDeleted
(
label
)
}
is
ServiceMonitorWrapper
->
resource
.
delete
(
client
)
else
->
throw
IllegalArgumentException
(
"Unknown Kubernetes resource."
)
}
}
private
fun
blockUntilDeleted
(
label
:
String
)
{
var
deleted
=
false
do
{
val
pods
=
this
.
client
.
pods
().
withLabel
(
label
).
list
().
items
if
(
pods
.
isNullOrEmpty
())
{
deleted
=
true
}
Thread
.
sleep
(
1000
)
}
while
(!
deleted
)
}
}
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