-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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
FlushFrequency config type #107618
FlushFrequency config type #107618
Conversation
/sig instrumentation |
5838bd4
to
0246bcd
Compare
This PR may require API review. If so, when the changes are ready, complete the pre-review checklist and request an API review. Status of requested reviews is tracked in the API Review project. |
This could also be solved with metav1.Duration, albeit without support for It would be a much simpler solution. |
0246bcd
to
b8ea09c
Compare
/cc @jpbetz |
b8ea09c
to
c086919
Compare
c086919
to
1838788
Compare
I switched to that and updated the PR description. The number of users of The original code with a new |
echoing from slack:
|
flushFrequency: 5000000000 | ||
flushFrequency: 5s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the field is used in a beta API, there are beta stability expectations for this field.
// Maximum number of seconds between log flushes. Ignored if the | ||
// selected logging backend writes log messages without buffering. | ||
FlushFrequency time.Duration | ||
// The maximum delay between log flushes, specified as a string in the | ||
// format understood by time.ParseDuration ("1m", "1h30m"). Ignored if | ||
// the selected logging backend writes log messages without buffering. | ||
FlushFrequency metav1.Duration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we change the type, we will break things that expect the API to work as released in 1.23. We should consider instead adding a new field with the desired type and deprecate the old one, e.g. FlushFrequencyDuration
as @liggitt suggested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be a future improvement to make the configuration more user-friendly. I want to keep this bug fix PR simple and not spend more time on it than necessary (mine and of reviewers).
So let's make the documentation match the implementation from 1.23. I'll update the PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ehashman: update pushed, please take another look.
The intention for Kubernetes 1.23 was to support `flushFrequency: 60` and treat that as seconds. But time.Duration counts nanoseconds. Because the struct is embedded inside the beta KubeletConfiguration, we cannot switch to a type that serializes differently (like metav1.Duration) and therefore (for now) just update the documentation to match the implementation from Kubernetes 1.23.
85cec62
to
f9c8a9d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/hold cancel
/kind documentation
/lgtm
/assign @liggitt
There will never be a more convenient or less impactful time to resolve this than now. Given the other discussion about settling on a single stable serializable version of this struct, do we really want to leave this as-is? Marking this field as deprecated, setting it to |
(I don't object to fixing the documentation, but I couldn't tell if that was all that was planned here) |
I don't think that this really affects many users in practice. I understand that we must not break serialization because that might break tools even when this feature is not actively set (serialize defaults, restore later), but I doubt that there are many users who need the nicer serialization with a string instead of nanoseconds. Therefore implementing that improvement had a lower priority for me.
My intention was to tackle this in this order:
From a compatibility perspective it doesn't matter because we still need to be compatible with the same JSON fromat as in 1.23, but it would be less code that needs to be changed (only one struct). |
@liggitt: I've implemented your proposal in https://github.com/pohly/kubernetes/commits/log-flush-frequency-new-field, with commits in the order that I proposed above (first this PR, ready for backporting to 1.23, then the open single-struct API PR for 1.24, and finally the flush frequency enhancement, also for 1.24). |
/lgtm for doc fix as first in the chain of updates |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: liggitt, pohly 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 |
/retest |
What type of PR is this?
/kind bug
What this PR does / why we need it:
The intention for Kubernetes 1.23 was to support
flushFrequency: 60
and treatthat as seconds. But time.Duration counts nanoseconds. Because the struct is
embedded inside the beta KubeletConfiguration, we cannot switch to a type that
serializes differently (like metav1.Duration) and therefore (for now) just
update the documentation to match the implementation from Kubernetes 1.23.
Special notes for your reviewer:
This was found in #105797 while working on a JSON unmarshaling unit test for LoggingConfiguration.
Does this PR introduce a user-facing change?