From 6fe436181266052377a6abac65c7e481ecfef813 Mon Sep 17 00:00:00 2001 From: Brad Davidson Date: Thu, 16 Sep 2021 15:03:51 -0700 Subject: [PATCH] Ensure that job pods are deleted immediately when replacing jobs Signed-off-by: Brad Davidson --- pkg/helm/controller.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/helm/controller.go b/pkg/helm/controller.go index 0c7a3914..c281e37e 100644 --- a/pkg/helm/controller.go +++ b/pkg/helm/controller.go @@ -30,6 +30,7 @@ import ( var ( trueVal = true commaRE = regexp.MustCompile(`\\*,`) + deletePolicy = meta.DeletePropagationForeground DefaultJobImage = "rancher/klipper-helm:v0.6.5-build20210915" ) @@ -64,7 +65,7 @@ func Register(ctx context.Context, apply apply.Apply, apply = apply.WithSetID(Name). WithCacheTypes(helms, confs, jobs, crbs, sas, cm). WithStrictCaching().WithPatcher(batch.SchemeGroupVersion.WithKind("Job"), func(namespace, name string, pt types.PatchType, data []byte) (runtime.Object, error) { - err := jobs.Delete(namespace, name, &meta.DeleteOptions{}) + err := jobs.Delete(namespace, name, &meta.DeleteOptions{PropagationPolicy: &deletePolicy}) if err == nil { return nil, fmt.Errorf("replace job") }