mirror of
https://github.com/outbackdingo/kubernetes.git
synced 2026-01-28 10:19:31 +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.
62 lines
2.6 KiB
Plaintext
62 lines
2.6 KiB
Plaintext
# hack/logcheck.conf contains regular expressions that are matched against <pkg>/<file>,
|
|
# for example k8s.io/cmd/kube-scheduler/app/config/config.go.
|
|
#
|
|
# By default, structured logging call parameters are checked, but usage of
|
|
# those calls is not required. That is changed on a per-file basis.
|
|
#
|
|
# Remember to clean the golangci-lint cache when changing the configuration and
|
|
# running the verify-golangci-lint.sh script multiple times, otherwise
|
|
# golangci-lint will report stale results:
|
|
# _output/local/bin/golangci-lint cache clean
|
|
|
|
# At this point we don't enforce the usage structured logging calls except in
|
|
# those packages that were migrated. This disables the check for other files.
|
|
-structured .*
|
|
|
|
# Now enable it again for migrated packages.
|
|
structured k8s.io/kubernetes/cmd/kubelet/.*
|
|
structured k8s.io/kubernetes/pkg/kubelet/.*
|
|
structured k8s.io/kubernetes/pkg/proxy/.*
|
|
structured k8s.io/kms/.*
|
|
structured k8s.io/apiserver/pkg/storage/value/.*
|
|
structured k8s.io/apiserver/pkg/server/options/encryptionconfig/.*
|
|
|
|
# The following packages have been migrated to contextual logging.
|
|
# Packages matched here do not have to be listed above because
|
|
# "contextual" implies "structured".
|
|
contextual k8s.io/api/.*
|
|
contextual k8s.io/apimachinery/pkg/util/runtime/.*
|
|
contextual k8s.io/client-go/metadata/.*
|
|
contextual k8s.io/client-go/tools/cache/.*
|
|
contextual k8s.io/client-go/tools/events/.*
|
|
contextual k8s.io/client-go/tools/record/.*
|
|
contextual k8s.io/component-helpers/.*
|
|
contextual k8s.io/cri-api/.*
|
|
contextual k8s.io/cri-client/.*
|
|
contextual k8s.io/csi-translation-lib/.*
|
|
contextual k8s.io/dynamic-resource-allocation/.*
|
|
contextual k8s.io/endpointslice/.*
|
|
contextual k8s.io/kms/.*
|
|
contextual k8s.io/kube-controller-manager/.*
|
|
contextual k8s.io/kube-proxy/.*
|
|
contextual k8s.io/kube-scheduler/.*
|
|
contextual k8s.io/sample-apiserver/.*
|
|
contextual k8s.io/sample-cli-plugin/.*
|
|
contextual k8s.io/sample-controller/.*
|
|
contextual k8s.io/kubernetes/cmd/kube-proxy/.*
|
|
contextual k8s.io/kubernetes/cmd/kube-scheduler/.*
|
|
contextual k8s.io/kubernetes/pkg/controller/.*
|
|
contextual k8s.io/kubernetes/pkg/scheduler/.*
|
|
contextual k8s.io/kubernetes/test/e2e/dra/.*
|
|
contextual k8s.io/kubernetes/pkg/kubelet/cm/dra/.*
|
|
contextual k8s.io/kubernetes/pkg/kubelet/pleg/.*
|
|
contextual k8s.io/kubernetes/pkg/kubelet/clustertrustbundle/.*
|
|
contextual k8s.io/kubernetes/pkg/kubelet/token/.*
|
|
contextual k8s.io/kubernetes/pkg/kubelet/cadvisor/.*
|
|
|
|
# As long as contextual logging is alpha or beta, all WithName, WithValues,
|
|
# NewContext calls have to go through klog. Once it is GA, we can lift
|
|
# this restriction. Whether we then do a global search/replace remains
|
|
# to be decided.
|
|
with-helpers .*
|