Skip to content

Instantly share code, notes, and snippets.

@d-kuro
Created March 8, 2019 10:22
Show Gist options
  • Save d-kuro/5f2320f6828c9225a5d4707e2737de43 to your computer and use it in GitHub Desktop.
Save d-kuro/5f2320f6828c9225a5d4707e2737de43 to your computer and use it in GitHub Desktop.
// from: https://github.com/kubernetes/kubernetes/blob/87f9429087d4e31201412548517d36e83abebc8d/pkg/controller/cronjob/cronjob_controller.go#L220-L228
// Remove any job reference from the active list if the corresponding job does not exist any more.
// Otherwise, the cronjob may be stuck in active mode forever even though there is no matching
// job running.
for _, j := range sj.Status.Active {
if found := childrenJobs[j.UID]; !found {
recorder.Eventf(sj, v1.EventTypeNormal, "MissingJob", "Active job went missing: %v", j.Name)
deleteFromActiveList(sj, j.UID)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment