Skip to content

fix: search 9 years in cron Next for leap-day schedules - #9170

Merged
cert-manager-prow[bot] merged 3 commits into
cert-manager:masterfrom
wieghx:fix/cron-leap-day-horizon
Aug 20, 2026
Merged

cert-manager-prow[bot] merged 3 commits into
cert-manager:masterfrom
wieghx:fix/cron-leap-day-horizon

Conversation

@wieghx

@wieghx wieghx commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

Pull Request Motivation

internal/cron Next() stopped searching after five years. Leap-day schedules such as 0 0 29 2 * can have an eight-year gap around a non-leap century year (2096-03-01 → 2104-02-29), so Next returned the zero time and renewal windows treated that as a WindowError.

Fixes #9148

Kind

/kind bug

Release Note

Fix certificate renewal windows using February 29 cron schedules across non-leap century years.

Verification

go test ./internal/cron/ -count=1 — includes a regression for 2096-03-01 → 2104-02-29, the common 4-year leap-day case, and an impossible date that still returns zero.

AI

Assisted by Grok (xAI) for locating the horizon, adding tests, and drafting this description. I reviewed the change.

Feb 29 can be eight years apart around a non-leap century year, so the
five-year horizon returned the zero time for specs such as 0 0 29 2 *.

Signed-off-by: wieghx <[email protected]>
@cert-manager-prow cert-manager-prow Bot added kind/bug Categorizes issue or PR as related to a bug. release-note Denotes a PR that will be considered when it comes time to generate release notes. dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 18, 2026
@cert-manager-prow

Copy link
Copy Markdown
Contributor

Hi @wieghx. Thanks for your PR.

I'm waiting for a cert-manager member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@cert-manager-prow cert-manager-prow Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Aug 18, 2026
Comment thread internal/cron/spec_test.go Resolved
@SgtCoDFish

Copy link
Copy Markdown
Member

/ok-to-test

@cert-manager-prow cert-manager-prow Bot added ok-to-test and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 20, 2026
wieghx added 2 commits August 20, 2026 18:20
The new spec_test.go is original, not copied from robfig/cron. The
previous skip_license_check / robfig attribution was copied from the
vendored files in this directory by mistake.

Signed-off-by: wieghx <[email protected]>
boilersuite requires Copyright YEAR; the yearless header failed
verify-boilerplate with "does not start with expected template type".

Signed-off-by: wieghx <[email protected]>
@lunarwhite

Copy link
Copy Markdown
Member

/release-note-edit

Fix certificate renewal windows using February 29 cron schedules across non-leap century years.

to be more user-facing

@lunarwhite

Copy link
Copy Markdown
Member

/label tide/merge-method-squash

@cert-manager-prow cert-manager-prow Bot added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Aug 20, 2026
@wieghx

wieghx commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @lunarwhite — the user-facing release note looks good.

@hjoshi123

Copy link
Copy Markdown
Collaborator

Looks good to me.. unless someone has objections I am ok to approve it
/approve

Since @SgtCoDFish reviewed it initially we can wait for his LGTM

@cert-manager-prow cert-manager-prow Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 20, 2026

@SgtCoDFish SgtCoDFish left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/approve

Licence is fixed, I'm happy! Thank you for raising and to everyone else who reviewed 👍

@cert-manager-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hjoshi123, SgtCoDFish

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [SgtCoDFish,hjoshi123]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@cert-manager-prow cert-manager-prow Bot added the lgtm Indicates that a PR is ready to be merged. label Aug 20, 2026
@cert-manager-prow
cert-manager-prow Bot merged commit 7473e85 into cert-manager:master Aug 20, 2026
6 checks passed
@wallrj

wallrj commented Sep 1, 2026

Copy link
Copy Markdown
Member

/cherry-pick release-1.21

with claude fable-5

@cert-manager-bot

Copy link
Copy Markdown
Contributor

@wallrj: new pull request created: #9240

Details

In response to this:

/cherry-pick release-1.21

with claude fable-5

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@wallrj

wallrj commented Sep 11, 2026

Copy link
Copy Markdown
Member

@wieghx This change has been included in v1.21.2, which is now published.

If you are able to install the release and verify that the change works as expected in your environment, that would be much appreciated. Thank you for the contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. ok-to-test release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

internal/cron returns the zero time for leap-day schedules when the next occurrence is more than 5 years away

6 participants