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
b5420942
Commit
b5420942
authored
3 years ago
by
Benedikt Wetzel
Browse files
Options
Downloads
Patches
Plain Diff
fix: wait only for pods which have exactly the same much labels and not only the same app lable
parent
c04b712f
No related branches found
No related tags found
1 merge request
!177
Fix "Deployment not deleted with Flink"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
theodolite/src/main/kotlin/theodolite/k8s/K8sManager.kt
+2
-4
2 additions, 4 deletions
theodolite/src/main/kotlin/theodolite/k8s/K8sManager.kt
theodolite/src/main/kotlin/theodolite/k8s/ResourceByLabelHandler.kt
+3
-3
3 additions, 3 deletions
.../src/main/kotlin/theodolite/k8s/ResourceByLabelHandler.kt
with
5 additions
and
7 deletions
theodolite/src/main/kotlin/theodolite/k8s/K8sManager.kt
+
2
−
4
View file @
b5420942
...
@@ -46,8 +46,7 @@ class K8sManager(private val client: NamespacedKubernetesClient) {
...
@@ -46,8 +46,7 @@ class K8sManager(private val client: NamespacedKubernetesClient) {
this
.
client
.
apps
().
deployments
().
delete
(
resource
)
this
.
client
.
apps
().
deployments
().
delete
(
resource
)
ResourceByLabelHandler
(
client
=
client
)
ResourceByLabelHandler
(
client
=
client
)
.
blockUntilPodsDeleted
(
.
blockUntilPodsDeleted
(
labelName
=
"app"
,
matchLabels
=
resource
.
spec
.
selector
.
matchLabels
labelValue
=
resource
.
spec
.
selector
.
matchLabels
[
"app"
]
!!
)
)
logger
.
info
{
"Deployment '${resource.metadata.name}' deleted."
}
logger
.
info
{
"Deployment '${resource.metadata.name}' deleted."
}
}
}
...
@@ -59,8 +58,7 @@ class K8sManager(private val client: NamespacedKubernetesClient) {
...
@@ -59,8 +58,7 @@ class K8sManager(private val client: NamespacedKubernetesClient) {
this
.
client
.
apps
().
statefulSets
().
delete
(
resource
)
this
.
client
.
apps
().
statefulSets
().
delete
(
resource
)
ResourceByLabelHandler
(
client
=
client
)
ResourceByLabelHandler
(
client
=
client
)
.
blockUntilPodsDeleted
(
.
blockUntilPodsDeleted
(
labelName
=
"app"
,
matchLabels
=
resource
.
spec
.
selector
.
matchLabels
labelValue
=
resource
.
spec
.
selector
.
matchLabels
[
"app"
]
!!
)
)
logger
.
info
{
"StatefulSet '$resource.metadata.name' deleted."
}
logger
.
info
{
"StatefulSet '$resource.metadata.name' deleted."
}
}
}
...
...
This diff is collapsed.
Click to expand it.
theodolite/src/main/kotlin/theodolite/k8s/ResourceByLabelHandler.kt
+
3
−
3
View file @
b5420942
...
@@ -99,16 +99,16 @@ class ResourceByLabelHandler(private val client: NamespacedKubernetesClient) {
...
@@ -99,16 +99,16 @@ class ResourceByLabelHandler(private val client: NamespacedKubernetesClient) {
* @param [labelName] the label name
* @param [labelName] the label name
* @param [labelValue] the value of this label
* @param [labelValue] the value of this label
* */
* */
fun
blockUntilPodsDeleted
(
labelName
:
String
,
labelValue
:
String
)
{
fun
blockUntilPodsDeleted
(
matchLabels
:
MutableMap
<
String
,
String
>
)
{
while
(
while
(
!
this
.
client
!
this
.
client
.
pods
()
.
pods
()
.
withLabel
(
"$labelName=$labelValue"
)
.
withLabel
s
(
matchLabels
)
.
list
()
.
list
()
.
items
.
items
.
isNullOrEmpty
()
.
isNullOrEmpty
()
)
{
)
{
logger
.
info
{
"Wait for pods with label $
labelName=$labelValue
to be deleted."
}
logger
.
info
{
"Wait for pods with label $
{matchLabels.toString()}
to be deleted."
}
Thread
.
sleep
(
1000
)
Thread
.
sleep
(
1000
)
}
}
}
}
...
...
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