Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add warning about using unsupported CRON_TZ #106455

Merged
merged 1 commit into from Nov 17, 2021

Conversation

soltysh
Copy link
Contributor

@soltysh soltysh commented Nov 16, 2021

What type of PR is this?

/kind bug
/kind cleanup
/kind documentation
/kind regression

What this PR does / why we need it:

CRON_TZ variable slipped in during upgrading github.com/robfig/cron in library. It allows setting a time zone which is a long requested feature but one that is not officially supported. This adds warning event since users should not rely on unsupported features.

Special notes for your reviewer:

/assign @atiratree

Does this PR introduce a user-facing change?

Users should not rely on unsupported CRON_TZ variable when specifying schedule, both the API server and cronjob controller will emit warnings pointing to https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/ containing explanation

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. kind/bug Categorizes issue or PR as related to a bug. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. kind/documentation Categorizes issue or PR as related to documentation. kind/regression Categorizes issue or PR as related to a regression from a prior release. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. sig/apps Categorizes an issue or PR as relevant to SIG Apps. approved Indicates a PR has been approved by an approver from all required OWNERS files. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Nov 16, 2021
@soltysh
Copy link
Contributor Author

soltysh commented Nov 16, 2021

/triage accepted
/priority important-longterm

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Nov 16, 2021
@soltysh
Copy link
Contributor Author

soltysh commented Nov 16, 2021

/retest

@soltysh
Copy link
Contributor Author

soltysh commented Nov 16, 2021

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 16, 2021
@atiratree
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 16, 2021
@k8s-ci-robot k8s-ci-robot removed lgtm "Looks good to me", indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Nov 16, 2021
return cj, nil, nil
}

if strings.Contains(cj.Spec.Schedule, "CRON_TZ") {
jm.recorder.Eventf(cj, corev1.EventTypeWarning, "UnsupportedSchedule", "CRON_TZ used in schedule %q", cj.Spec.Schedule)
Copy link
Member

Choose a reason for hiding this comment

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

should this explain more about why this is bad? Or link to an explanation?

Copy link
Member

Choose a reason for hiding this comment

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

if strings.Contains(cj.Spec.Schedule, "CRON_TZ") {
jm.recorder.Eventf(cj, corev1.EventTypeWarning, "UnsupportedSchedule", "CRON_TZ used in schedule %q is not officially supported, see https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/ for more details", cj.Spec.Schedule)
}
if strings.Contains(cj.Spec.Schedule, "TZ") {
Copy link
Member

Choose a reason for hiding this comment

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

the event will hit twice if we have CRON_TZ. Same in strategy.go

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True, lemme fix that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

CRON_TZ variable slipped in during upgrading github.com/robfig/cron
library.  It allows setting a time zone which is a long requested
feature but one that is not officially supported. This adds warning
event since users should not rely on unsupported features.
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 16, 2021
@soltysh
Copy link
Contributor Author

soltysh commented Nov 16, 2021

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 16, 2021
@soltysh
Copy link
Contributor Author

soltysh commented Nov 16, 2021

/milestone v1.23

@k8s-ci-robot k8s-ci-robot added this to the v1.23 milestone Nov 16, 2021
@sftim
Copy link
Contributor

sftim commented Nov 16, 2021

For the release note, can we say which component emits the deprecation notice unsupported configuration event and explicitly call out that it will now be emitted?

Actually, the Warning: header is probably more prominent than the event, so maybe focus on that?

@liggitt
Copy link
Member

liggitt commented Nov 16, 2021

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 16, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: atiratree, cndoit18, liggitt, soltysh

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

The pull request process is described here

Needs approval from an approver in each of these files:

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 16, 2021
@k8s-ci-robot k8s-ci-robot merged commit 39c76ba into kubernetes:master Nov 17, 2021
@soltysh soltysh deleted the cronjob_warning branch November 17, 2021 09:38
@mtparet
Copy link

mtparet commented Nov 17, 2021

It's a bit sad (from user perspective) to see much effort to unsupport timezone vs support timezone.

@sftim
Copy link
Contributor

sftim commented Nov 17, 2021

There'll be even more work on the KEP to do this properly, I suspect.

@soltysh
Copy link
Contributor Author

soltysh commented Nov 17, 2021

For the release note, can we say which component emits the deprecation notice unsupported configuration event and explicitly call out that it will now be emitted?

Actually, the Warning: header is probably more prominent than the event, so maybe focus on that?

Updated

It's a bit sad (from user perspective) to see much effort to unsupport timezone vs support timezone.

It's not that we don't want to support timezones, but we can't let users rely on implementation detail which if we decided to switch the library would be gone. As Tim mentioned, we're hoping to add timezone support in the next release as alpha.

@benlangfeld
Copy link

For those who are not in the loop, this is relevant to #47202

@benlangfeld
Copy link

Also a reference to the documentation fix which also clarifies this: kubernetes/website#30509

k8s-ci-robot added a commit that referenced this pull request Dec 10, 2021
…455-upstream-release-1.22

Automated cherry pick of #106455: Add warning about using unsupported CRON_TZ
@liggitt liggitt removed the kind/regression Categorizes issue or PR as related to a regression from a prior release. label Mar 8, 2022
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. kind/documentation Categorizes issue or PR as related to documentation. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/apps Categorizes an issue or PR as relevant to SIG Apps. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants