Commit 71c918d9 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #40143 from peay/event-when-cronjob-cannot-start

Automatic merge from submit-queue (batch tested with PRs 40196, 40143, 40277) Emit warning event when CronJob cannot determine starting time **What this PR does / why we need it**: In #39608, we've modified the error message for when a CronJob has too many unmet starting times to enumerate to figure out the next starting time. This makes it more "actionable", and the user can now set a deadline to avoid running into this. However, the error message is still only controller level AFAIK and thus not exposed to the user. From his perspective, there is no way to tell why the CronJob is not scheduling the next instance. The PR adds a warning event in addition to the error in the controller manager's log. **Which issue this PR fixes**: This is an addition to PR #39608 regarding #36311. **Special notes for your reviewer**: cc @soltysh **Release note**: ```release-note ```
parents 0c41d538 6b5c8f1d
...@@ -174,6 +174,7 @@ func SyncOne(sj batch.CronJob, js []batch.Job, now time.Time, jc jobControlInter ...@@ -174,6 +174,7 @@ func SyncOne(sj batch.CronJob, js []batch.Job, now time.Time, jc jobControlInter
} }
times, err := getRecentUnmetScheduleTimes(sj, now) times, err := getRecentUnmetScheduleTimes(sj, now)
if err != nil { if err != nil {
recorder.Eventf(&sj, v1.EventTypeWarning, "FailedNeedsStart", "Cannot determine if job needs to be started: %v", err)
glog.Errorf("Cannot determine if %s needs to be started: %v", nameForLog, err) glog.Errorf("Cannot determine if %s needs to be started: %v", nameForLog, err)
} }
// TODO: handle multiple unmet start times, from oldest to newest, updating status as needed. // TODO: handle multiple unmet start times, from oldest to newest, updating status as needed.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment