Created
March 7, 2019 19:48
-
-
Save d-kuro/b1666f96a2502c17d90e53b944b4f63a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// from: https://github.com/kubernetes/kubernetes/blob/87f9429087d4e31201412548517d36e83abebc8d/pkg/controller/cronjob/utils.go#L58-L72 | |
// getParentUIDFromJob extracts UID of job's parent and whether it was found | |
func getParentUIDFromJob(j batchv1.Job) (types.UID, bool) { | |
controllerRef := metav1.GetControllerOf(&j) | |
if controllerRef == nil { | |
return types.UID(""), false | |
} | |
if controllerRef.Kind != "CronJob" { | |
klog.V(4).Infof("Job with non-CronJob parent, name %s namespace %s", j.Name, j.Namespace) | |
return types.UID(""), false | |
} | |
return controllerRef.UID, true | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment