apiserver/pkg/util
Patrick Ohly d712a4ee7e apimachinery runtime: support contextual logging
In contrast to the original HandleError and HandleCrash, the new
HandleErrorWithContext and HandleCrashWithContext functions properly do contextual
logging, so if a problem occurs while e.g. dealing with a certain request and
WithValues was used for that request, then the error log entry will also
contain information about it.

The output changes from unstructured to structured, which might be a breaking
change for users who grep for panics. Care was taken to format panics
as similar as possible to the original output.

For errors, a message string gets added. There was none before, which made it
impossible to find all error output coming from HandleError.

Keeping HandleError and HandleCrash around without deprecating while changing
the signature of callbacks is a compromise between not breaking existing code
and not adding too many special cases that need to be supported. There is some
code which uses PanicHandlers or ErrorHandlers, but less than code that uses
the Handle* calls.

In Kubernetes, we want to replace the calls. logcheck warns about them in code
which is supposed to be contextual. The steps towards that are:
- add TODO remarks as reminder (this commit)
- locally remove " TODO(pohly): " to enable the check with `//logcheck:context`,
  merge fixes for linter warnings
- once there are none, remove the TODO to enable the check permanently

Kubernetes-commit: 5a130d2b71e5d70cfff15087f4d521c6b68fb01e
2023-11-20 20:25:00 +01:00
..
apihelpers apiserver: apf controller, bootstrap, tests should use flowcontrol v1 API 2023-10-11 09:20:41 -04:00
dryrun Revert "remove unwanted values returned from dry-run" 2022-04-06 12:34:42 -04:00
feature update import of generic featuregate code from k8s.io/apiserver/pkg/util/feature -> k8s.io/component-base/featuregate 2019-03-04 12:46:52 -05:00
flowcontrol chore: adds consistent vanity import to files and provides tooling for verifying and updating them. (#120642) 2024-02-08 14:10:27 +00:00
flushwriter sync: initially remove files BUILD */BUILD BUILD.bazel */BUILD.bazel 2018-03-15 09:38:17 +00:00
notfoundhandler aggregator: pass apiServiceRegistrationControllerInitiated signal directly to apiserviceRegistration controller 2021-10-20 11:06:27 +02:00
openapi Update gnostic references 2023-06-01 18:25:39 +00:00
peerproxy Add impl for uvip 2023-03-29 17:20:25 -07:00
proxy apimachinery runtime: support contextual logging 2023-11-20 20:25:00 +01:00
shufflesharding Less demanding test cases in TestUniformDistribution 2021-01-25 01:44:08 -05:00
webhook Use http/2 for localhost webhook 2024-01-03 13:49:51 +00:00
wsstream Re-add the legacy wsstream package and deprecate it 2023-05-23 16:15:07 -07:00
x509metrics Initialize the AuditEvent with the AuditContext (#113611) 2023-07-03 18:28:13 +00:00