mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 07:27:21 +00:00
Job: Add ControllerRef on all created Pods.
This commit is contained in:
@@ -17,6 +17,7 @@ limitations under the License.
|
||||
package job
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/kubernetes/pkg/api/v1"
|
||||
batch "k8s.io/kubernetes/pkg/apis/batch/v1"
|
||||
)
|
||||
@@ -29,3 +30,14 @@ func IsJobFinished(j *batch.Job) bool {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func newControllerRef(j *batch.Job) *metav1.OwnerReference {
|
||||
isController := true
|
||||
return &metav1.OwnerReference{
|
||||
APIVersion: controllerKind.GroupVersion().String(),
|
||||
Kind: controllerKind.Kind,
|
||||
Name: j.Name,
|
||||
UID: j.UID,
|
||||
Controller: &isController,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user