From 2d983f27e7a7ae6e7f67c47ec6c9f678e86968a9 Mon Sep 17 00:00:00 2001 From: Jacob LeGrone Date: Thu, 10 Oct 2019 18:30:49 -0400 Subject: [PATCH] feat(hooks): never delete CustomResourceDefinitions Signed-off-by: Jacob LeGrone --- pkg/action/hooks.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/action/hooks.go b/pkg/action/hooks.go index 638decff8..ab576be1e 100644 --- a/pkg/action/hooks.go +++ b/pkg/action/hooks.go @@ -119,6 +119,11 @@ func (x hookByWeight) Less(i, j int) bool { // deleteHookByPolicy deletes a hook if the hook policy instructs it to func (cfg *Configuration) deleteHookByPolicy(h *release.Hook, policy release.HookDeletePolicy) error { + // Never delete CustomResourceDefinitions; this could cause lots of + // cascading garbage collection. + if h.Kind == "CustomResourceDefinition" { + return nil + } if hookHasDeletePolicy(h, policy) { resources, err := cfg.KubeClient.Build(bytes.NewBufferString(h.Manifest), false) if err != nil {