diff --git a/CHANGELOG.md b/CHANGELOG.md index c2127dd8b..1c76bb76e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/lib/krane/cluster_resource_discovery.rb b/lib/krane/cluster_resource_discovery.rb index f23eb96ab..faf644c6b 100644 --- a/lib/krane/cluster_resource_discovery.rb +++ b/lib/krane/cluster_resource_discovery.rb @@ -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"]) diff --git a/test/unit/cluster_resource_discovery_test.rb b/test/unit/cluster_resource_discovery_test.rb index 6af906257..4e4b02124 100644 --- a/test/unit/cluster_resource_discovery_test.rb +++ b/test/unit/cluster_resource_discovery_test.rb @@ -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