Skip to content

Instantly share code, notes, and snippets.

@d-kuro
Created March 8, 2019 10:37
Show Gist options
  • Save d-kuro/d8eeeed2ae3d47c51246e6e8e7c74724 to your computer and use it in GitHub Desktop.
Save d-kuro/d8eeeed2ae3d47c51246e6e8e7c74724 to your computer and use it in GitHub Desktop.
// from: https://github.com/kubernetes/kubernetes/blob/87f9429087d4e31201412548517d36e83abebc8d/pkg/controller/cronjob/cronjob_controller.go#L248-L261
times, err := getRecentUnmetScheduleTimes(*sj, now)
if err != nil {
recorder.Eventf(sj, v1.EventTypeWarning, "FailedNeedsStart", "Cannot determine if job needs to be started: %v", err)
klog.Errorf("Cannot determine if %s needs to be started: %v", nameForLog, err)
return
}
// TODO: handle multiple unmet start times, from oldest to newest, updating status as needed.
if len(times) == 0 {
klog.V(4).Infof("No unmet start times for %s", nameForLog)
return
}
if len(times) > 1 {
klog.V(4).Infof("Multiple unmet start times for %s so only starting last one", nameForLog)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment