mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-01 02:38:12 +00:00
The context is used for cancellation and to support contextual logging. In most cases, alternative *WithContext APIs get added, except for NewIntegerResourceVersionMutationCache where code searches indicate that the API is not used downstream. An API break around SharedInformer couldn't be avoided because the alternative (keeping the interface unchanged and adding a second one with the new method) would have been worse. controller-runtime needs to be updated because it implements that interface in a test package. Downstream consumers of controller-runtime will work unless they use those test package. Converting Kubernetes to use the other new alternatives will follow. In the meantime, usage of the new alternatives cannot be enforced via logcheck yet (see https://github.com/kubernetes/kubernetes/issues/126379 for the process). Passing context through and checking it for cancellation is tricky for event handlers. A better approach is to map the context cancellation to the normal removal of an event handler via a helper goroutine. Thanks to the new HandleErrorWithLogr and HandleCrashWithLogr, remembering the logger is sufficient for handling problems at runtime.
Kubernetes hack GuideLines
This document describes how you can use the scripts from hack directory
and gives a brief introduction and explanation of these scripts.
Overview
The hack directory contains many scripts that ensure continuous development of kubernetes,
enhance the robustness of the code, improve development efficiency, etc.
The explanations and descriptions of these scripts are helpful for contributors.
For details, refer to the following guidelines.
Key scripts
verify-all.sh: This script is a vestigial redirection, Please do not add "real" logic. It is equivalent tomake verify.update-all.sh: This script is a vestigial redirection, Please do not add "real" logic. Thetruetarget of this makerule ishack/make-rules/update.sh.It is equivalent tomake update.
Attention
Note that all scripts must be run from the Kubernetes root directory.
We should run hack/verify-all.sh before submitting a PR and if anything fails run hack/update-all.sh.