Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
e10e443a
Commit
e10e443a
authored
Apr 01, 2021
by
Rémy Coutable
Committed by
Albert Salim
Apr 07, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't try to delete non-existing K8s resources
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
d99352f7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
0 deletions
+12
-0
spec/tooling/lib/tooling/kubernetes_client_spec.rb
spec/tooling/lib/tooling/kubernetes_client_spec.rb
+10
-0
tooling/lib/tooling/kubernetes_client.rb
tooling/lib/tooling/kubernetes_client.rb
+2
-0
No files found.
spec/tooling/lib/tooling/kubernetes_client_spec.rb
View file @
e10e443a
...
...
@@ -123,6 +123,16 @@ RSpec.describe Tooling::KubernetesClient do
it_behaves_like
'a kubectl command to delete resources by older than given creation time'
end
context
'with no resources found'
do
let
(
:resource_names
)
{
[]
}
it
'does not call #delete_by_exact_names'
do
expect
(
subject
).
not_to
receive
(
:delete_by_exact_names
)
subject
.
cleanup_by_created_at
(
resource_type:
resource_type
,
created_before:
two_days_ago
)
end
end
end
describe
'#raw_resource_names'
do
...
...
tooling/lib/tooling/kubernetes_client.rb
View file @
e10e443a
...
...
@@ -22,6 +22,8 @@ module Tooling
def
cleanup_by_created_at
(
resource_type
:,
created_before
:,
wait:
true
)
resource_names
=
resource_names_created_before
(
resource_type:
resource_type
,
created_before:
created_before
)
return
if
resource_names
.
empty?
delete_by_exact_names
(
resource_type:
resource_type
,
resource_names:
resource_names
,
wait:
wait
)
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment