feat(hooks): set default deletion policy to before-hook-creation

Signed-off-by: Jacob LeGrone <git@jacob.work>
pull/6639/head
Jacob LeGrone 5 years ago
parent 0227ade173
commit 34d685f8bf
No known key found for this signature in database
GPG Key ID: 5FD0852F235368C1

@ -40,6 +40,15 @@ func (cfg *Configuration) execHook(rl *release.Release, hook release.HookEvent,
sort.Sort(hookByWeight(executingHooks))
for _, h := range executingHooks {
// Set default delete policy to before-hook-creation
if h.DeletePolicies == nil || len(h.DeletePolicies) == 0 {
// TODO(jlegrone): Only apply before-hook-creation delete policy to run to completion
// resources. For all other resource types update in place if a
// resource with the same name already exists and is owned by the
// current release.
h.DeletePolicies = []release.HookDeletePolicy{release.HookBeforeHookCreation}
}
if err := cfg.deleteHookByPolicy(h, release.HookBeforeHookCreation); err != nil {
return err
}

Loading…
Cancel
Save