Created
March 7, 2019 19:44
-
-
Save d-kuro/4ced00b833688ef6c5f0db78215ff67a 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#L74-L87 | |
// groupJobsByParent groups jobs into a map keyed by the job parent UID (e.g. scheduledJob). | |
// It has no receiver, to facilitate testing. | |
func groupJobsByParent(js []batchv1.Job) map[types.UID][]batchv1.Job { | |
jobsBySj := make(map[types.UID][]batchv1.Job) | |
for _, job := range js { | |
parentUID, found := getParentUIDFromJob(job) | |
if !found { | |
klog.V(4).Infof("Unable to get parent uid from job %s in namespace %s", job.Name, job.Namespace) | |
continue | |
} | |
jobsBySj[parentUID] = append(jobsBySj[parentUID], job) | |
} | |
return jobsBySj | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment