-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
⚠️ Do not deduplicate warnings by default #2953
⚠️ Do not deduplicate warnings by default #2953
Conversation
Skipping CI for Draft Pull Request. |
Absolutely in favor of this change. The current default is a memory leak and I think the behavior is also questionable /lgtm /assign @alvaroaleman @vincepri |
LGTM label has been added. Git tree hash: 9bc8e9a4c90d0b860976c2fffeff13e19c7e9c43
|
It takes some memory but how is it a leak? The number of unique warnings should be pretty finite or not? |
Good point. Is the number of unique warnings finite? (i.e. is there a guarantee that they never contain variable parts like object names?) (IIRC every webhook is able to return warnings, so we have more than just the warnings built into the kube-apiserver to consider) But independent of that part, I think it's surprising behavior that we log every unique warning only once. I mean I wonder in general who notices these warnings in controller logs, but only logging them once doesn't make it better :) |
Yeah I am a bit thorn on this. On the one hand if this was net new I would keep them on because as you said, its easy to miss them if they are only logged once. On the other you can make the argument that this is a silently breaking change and ppl might complain about now getting too many warnings that they don't care about logged. |
Yup. We can also consider defaulting to no warning handler. Then people can add it if they want |
This came out a discussion in a cluster-api PR: kubernetes-sigs/cluster-api#11179 (comment) I think deduplication can make it harder to spot warnings. This is what I said there:
|
(The above was incorrect) |
From what I can see there it only includes the fieldpath and the value but not object name or am I missing it? |
My mistake! You're right, the object name is not part of the message. |
To recap, a warning looks like this:
In this warning, the field-path is Currently, warnings are de-duplicated by default, so only onewarning per field-path/group-kind combination shows up in the log for the lifetime of the manager process. Reasons to stop de-duplicating by default:
Reasons to continue de-duplication by default:
If there's no clear winner, then we can keep the existing behavior, and I'll close the PR. |
I don't like the deduplication per default because one webhook in your cluster which returns non-deterministic warnings on the wrong resource is enough to ensure (probably) all CR-based comtrollers in the cluster go OOM. As the benefit of deduplication is not that great, I don't think we should do it per default. |
Sounds good. We can try to decrease the impact of the change. Some ideas:
|
I would be fine with only 1. I think it's not a problematic change to disable the deduplication. I would be really surprised if a significant number of CR users a) know that we log warnings and that we de-duplicate them b) depend on this behavior in any way. But let's see what @vincepri and @alvaroaleman think. |
Yeah, I am ok with changing it, too. Lets maybe mark this change as breaking since it changes behavior so that it shows up more prominently on the release notes, but other than that, I am fine with this. |
Controllers are long-running processes, and deduplication, as implemented, increases memory use. With this change, duplicate warnings will appear in the log by default. However, this is safe, because Kubernetes rotates container logs by default. If a specific controller sees many duplicate warnings, it can configure the handler to deduplicate them.
8632463
to
1eb0c53
Compare
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alvaroaleman, dlipovetsky 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 |
Controllers are long-running processes, and deduplication, as implemented, increases memory use.
With this change, duplicate warnings will appear in the log by default. However, this is safe, because Kubernetes rotates container logs by default.
If a specific controller sees many duplicate warnings, it can configure the handler to deduplicate them.