Skip to content

Commit

Permalink
Ensure that job pods are deleted immediately when replacing jobs
Browse files Browse the repository at this point in the history
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
  • Loading branch information
brandond committed Sep 20, 2021
1 parent 957ec94 commit 6fe4361
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/helm/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
var (
trueVal = true
commaRE = regexp.MustCompile(`\\*,`)
deletePolicy = meta.DeletePropagationForeground
DefaultJobImage = "rancher/klipper-helm:v0.6.5-build20210915"
)

Expand Down Expand Up @@ -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")
}
Expand Down

0 comments on commit 6fe4361

Please sign in to comment.