From c82b537bee2d50b8f6c9ca79217ab65a43363a60 Mon Sep 17 00:00:00 2001 From: Anthony Yeh Date: Thu, 2 Mar 2017 11:01:05 -0800 Subject: [PATCH] Job: Always set BlockOwnerDeletion in ControllerRef. --- pkg/controller/job/utils.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pkg/controller/job/utils.go b/pkg/controller/job/utils.go index 47f1cc83d0e..6e8be3d76a4 100644 --- a/pkg/controller/job/utils.go +++ b/pkg/controller/job/utils.go @@ -32,12 +32,14 @@ func IsJobFinished(j *batch.Job) bool { } func newControllerRef(j *batch.Job) *metav1.OwnerReference { + blockOwnerDeletion := true isController := true return &metav1.OwnerReference{ - APIVersion: controllerKind.GroupVersion().String(), - Kind: controllerKind.Kind, - Name: j.Name, - UID: j.UID, - Controller: &isController, + APIVersion: controllerKind.GroupVersion().String(), + Kind: controllerKind.Kind, + Name: j.Name, + UID: j.UID, + BlockOwnerDeletion: &blockOwnerDeletion, + Controller: &isController, } }