Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stop pruning events on deploy to avoid timeouts #909

Merged
merged 2 commits into from
Nov 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## next

- Add `Event` to the list of resources not to be pruned on a deployment. Kubernetes should clean these up automatically. This can cause unnessessary deployment timeouts and increased deployment time.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀


## 3.0.0

Expand Down
2 changes: 1 addition & 1 deletion lib/krane/cluster_resource_discovery.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def crds
end

def prunable_resources(namespaced:)
black_list = %w(Namespace Node ControllerRevision)
black_list = %w(Namespace Node ControllerRevision Event)
fetch_resources(namespaced: namespaced).map do |resource|
next unless resource["verbs"].one? { |v| v == "delete" }
next if black_list.include?(resource["kind"])
Expand Down
4 changes: 2 additions & 2 deletions test/unit/cluster_resource_discovery_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ def test_prunable_namespaced_resources
crd = mocked_cluster_resource_discovery
kinds = crd.prunable_resources(namespaced: true).map { |k| k.split('/').last }.uniq

assert_equal(24, kinds.length)
assert_equal(23, kinds.length)
%w(ConfigMap CronJob Deployment).each do |expected_kind|
assert(kinds.one? { |k| k.include?(expected_kind) })
end
%w(controllerrevision).each do |black_listed_kind|
%w(controllerrevision event).each do |black_listed_kind|
assert_empty(kinds.select { |k| k.downcase.include?(black_listed_kind) })
end
end
Expand Down