Skip to content

Commit

Permalink
Merge pull request #909 from Shopify/ea-stop-pruning-events-on-deploy
Browse files Browse the repository at this point in the history
stop pruning events on deploy to avoid timeouts
  • Loading branch information
Ethan Aubuchon authored Nov 18, 2022
2 parents bb3b817 + 1c28f48 commit 763b826
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
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.

## 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

0 comments on commit 763b826

Please sign in to comment.