The main purpose is to replace context.TODO with a context provided by the
caller. A secondary purpose is to enable contextual logging.
Modifying the existing interfaces and APIs would have a big impact on the
ecosystem. This is a no-go. Instead, the following approach was taken:
- All interfaces get duplicated in a *WithContext variant where the methods
also have a *WithContext suffix and the ctx parameter. All methods are
treated this way except for obvious local get methods (like RESTClient)
because it cannot be ruled out entirely that some implementation may
need a context.
- Implementations of these interfaces implement both method variants
which is possible because the method names are different.
The old methods are implemented as thin wrappers around the updated
code which is now the body of the new methods or shared helpers.
In some cases there is additional overhead (type checks, potentially
additional allocations) when using the old methods.
- To*WithContext helpers bridge from the old to the new interfaces. They
try a type cast first. Because the in-tree implementations implement
both, they can be used directly. For other implementations wrappers
are used.
- None of old APIs and interfaces are marked as deprecated. Instead
doc comments inform consumers about the new and better alternatives.
This approach avoids causing turmoil in the ecosystem when linters
pick up on a formal deprecation and developers act on those linter
warnings without properly thinking about the implications.
"// Contextual logging: " is used as placeholder for "//logcheck:context".
Once all relevant consumers have been updated to the new API,
a search/replace can enable the logcheck linter to warn about
usage of the old API.
Implementations also get marked this way even if probably nothing
ever calls them directly because it shows which code, at least
theoretically, could get removed.
- Existing unit tests do not get updated to the new APIs. This gives
us unit test coverage of the old and new API because the old
APIs call the new ones.
- In-tree consumers will be updated in follow-up PRs. This is likely
to be a longer process. Because of the deprecation comment,
`hack/golangci-lint.sh -n` can be used to find code which needs
to be updated.
Kubernetes-commit: ab9f9f2a0e2f06d29464beb1f131190c91b6655e
* Migrate: use source file permission when writing destination file
* Mask migrated config file with 0666 to ensure the created file is never executable.
Kubernetes-commit: d7091ac255734d59a494ed8c93209a467156f238
detectNumCPU sized nf_conntrack_max using github.com/google/cadvisor/lib
machine topology. nf_conntrack_max is host-wide, so it must be sized from the
node's CPU count, not runtime.NumCPU(): the latter honors the process cpuset
and undercounts when kube-proxy runs under a static CPU policy, which is the
behavior cadvisor worked around (kubernetes/kubernetes#99225).
Use cpuset.NumCPU() from k8s.io/utils, which reads the node's online CPU count
from /sys/devices/system/cpu/online, with a runtime.NumCPU() fallback. This
drops the cadvisor dependency from pkg/proxy/conntrack and bumps k8s.io/utils
to pick up cpuset.NumCPU.
Kubernetes-commit: 92ce184653f03c312915993d7fde93d8e65602c1
Remove mentions about admission controllers from doc comments for PodGroupTemplate.Priority and PodGroupTemplate.PriorityClassName
Kubernetes-commit: 2a419be78ae256ef719071c6ae3bd46cb39b5b81
Updates golang.org/x/net to v0.55.1-0.20260602153038-42abb857022c to pick up
the go1.27 http2 "wrap" fixes:
- CL 782940 (golang/go#79642): configureServer registers the h2 and http/1.1
ALPN protocols on s.TLSConfig.
- CL 785900 (golang/go#79778): ConfigureTransport/ConfigureTransports enable
HTTP/2 on the transport and keep TLSClientConfig non-nil.
With both, the kube-apiserver secure-serving path and the client-go / apiserver
HTTP/2 clients negotiate HTTP/2 under go1.27 with no Kubernetes-side changes;
no workaround is needed.
Gerrit: https://go-review.googlesource.com/c/net/+/782940
Gerrit: https://go-review.googlesource.com/c/net/+/785900
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
Kubernetes-commit: 544a4612cd73250f69e6a95f4b3de8b94112e594
Fixes ci-kubernetes-e2e-kind-golang-tip and ci-kubernetes-unit-golang-tip,
which started failing under Go tip identifying as go1.27 with:
vendor/google.golang.org/grpc/internal/transport/handler_server.go:271:18:
undefined: http2.TrailerPrefix
In x/net v0.54.0, TrailerPrefix was defined only in http2/server.go, which
carries `//go:build !(go1.27 && !http2legacy)` and is therefore excluded
under go1.27. Upstream golang/net commit 1efab4271a moved TrailerPrefix
(and other symbols accidentally dropped by the go1.27 server wrapper) into
common files. That fix is released in v0.55.0.
Tracked in https://github.com/kubernetes/kubernetes/issues/139257
Kubernetes-commit: d7c6b52ac4b6387d740af2fea7f1dd007d71c64c