Commit Graph

5508 Commits

Author SHA1 Message Date
Patrick Ohly
0ff074ca35 restmapper + discovery: add context-aware APIs
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
2024-12-06 17:38:06 +01:00
Brian Pursley
48ec1022ee Migrate: use source file permission when writing destination file (#138142)
* 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
2026-06-29 12:05:05 +00:00
Kubernetes Publisher
ab0d3bd81d Merge pull request #140021 from dims/conntrack-cpuset
kube-proxy: detect host CPU count via cpuset.NumCPU instead of cadvisor

Kubernetes-commit: 04d5d2647dc7fd1e8f0cd6a61244d18642af9522
2026-06-26 17:37:53 +00:00
Kubernetes Publisher
17fd58d111 Merge pull request #139956 from jsafrane/selinuxmount-ga
Graduate SELinuxMount to GA

Kubernetes-commit: d23b43180872faf7ceefd0e57effe44ce90f058b
2026-06-25 21:07:14 +00:00
Davanum Srinivas
5dcb5a1682 kube-proxy: detect host CPU count via cpuset.NumCPU instead of cadvisor
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
2026-06-25 14:04:01 -04:00
Kubernetes Publisher
c6c26a06ef Merge pull request #138914 from richabanker/metrics-constructor-pattern
Defer client-go metrics registration to runtime entry point via constructors

Kubernetes-commit: 402799de26580c612ea46951a74c72e9f0e1b310
2026-06-25 05:06:19 +00:00
Jan Safranek
fa1fbb56d8 Graduate SELinuxMount to GA
Kubernetes-commit: 8ad339756cdb0a130ff9b60427785d6b09906ccd
2026-06-23 16:10:19 +02:00
Richa Banker
1d2651da7d defer metric registration to runtime entry point via constructors
Signed-off-by: Richa Banker <richabanker@google.com>

Kubernetes-commit: 8721c830cf013a92a805b46eb163736f97aba2aa
2026-05-08 13:37:32 -07:00
Kubernetes Publisher
68262a1cf9 Merge pull request #139907 from ania-borowiec/remove_misleading_comments
Remove mentions about admission controllers from doc comments for  PodGroupTemplate.Priority and  PodGroupTemplate.PriorityClassName

Kubernetes-commit: 2a419be78ae256ef719071c6ae3bd46cb39b5b81
2026-06-23 17:05:47 +00:00
Ania Borowiec
fc42561c17 Remove mentions about admission controllers in PodGroupTemplate doc comments for Priority and PriorityClassName fields
Kubernetes-commit: f6fabaeb1e4c8607846402b52b6f6f4ba60c074b
2026-06-22 12:19:27 +00:00
Kubernetes Publisher
d04ac3067f Merge pull request #139867 from liggitt/json-v2-kube-openapi
Update kube-openapi to isolate from stdlib json/v2 prerelease

Kubernetes-commit: 2a799b273281aa952f457553e865050aba08bfe3
2026-06-19 01:04:47 +00:00
Jordan Liggitt
f04563ced1 Update kube-openapi to isolate from stdlib json/v2 prerelease
Kubernetes-commit: f45bf7803fa2fa86ea924a5cfe3503cb224fcbd1
2026-06-18 18:54:52 -04:00
Kubernetes Publisher
848305dfba Merge pull request #139825 from michaelasp/fixMutationTest
Fix dangling goroutine in mutation detector edge case

Kubernetes-commit: 55ac7c75fc03e69cff68075da901540c0f22b90e
2026-06-19 01:04:43 +00:00
Kubernetes Publisher
c18a3de8a3 Merge pull request #139755 from michaelasp/shutdownWait
Expose a way to wait for a controller listener to be fully shutdown

Kubernetes-commit: 7bdae3ff06a86acdf2b3cf9407b75b93c505e51f
2026-06-18 01:04:04 +00:00
Michael Aspinwall
29ceea8774 Fix timeout with dangling goroutine in mutation detector test
Kubernetes-commit: a332504c1abb8bedc564df94df424b8e6f11bc55
2026-06-17 17:49:48 +00:00
Kubernetes Publisher
f226f2f6e6 Merge pull request #139743 from antekjb/renamePodGroupScheduled
Rename PodGroupScheduled condition to PodGroupInitiallyScheduled

Kubernetes-commit: 47d52eabda121e12b5bedc59c8f3efef820f96c6
2026-06-17 15:34:44 +00:00
Kubernetes Publisher
cba7557c26 Merge pull request #139279 from antekjb/AllowForMinCountMutability
Make minCount mutable in Workload and PodGroup APIs

Kubernetes-commit: 176451642a3c25f18eaacba03417610aaa69a84b
2026-06-17 15:34:41 +00:00
Antoni Basista
f4285d806d Rename PodGroupScheduled condition to PodGroupInitiallyScheduled
Kubernetes-commit: 0d59683459ab25f1430b0740989ca63935bdaa47
2026-06-17 12:49:22 +00:00
Antoni Basista
c949b958f1 Make minCount mutable in Workload and PodGroup APIs
Kubernetes-commit: 61dc7df681ff4ad36809c10e5233ac97806a7780
2026-06-17 12:44:49 +00:00
Kubernetes Publisher
1e5bbe8452 Merge pull request #139520 from macsko/merge_featuregates
Merge GangScheduling and WorkloadAwarePreemption feature gates into GenericWorkload

Kubernetes-commit: 05f19de8edd6557dbe35403f0501ac3e97f600b3
2026-06-17 07:34:34 +00:00
Kubernetes Publisher
9f2f0bbab6 Merge pull request #139779 from PatrickLaabs/133935-clientgo
Replacing deprecated sets.NewString with generic implementation

Kubernetes-commit: c7381f90594a77851d051e4e18fcfbfb6e474b97
2026-06-16 23:34:35 +00:00
Kubernetes Publisher
23b19597fe Merge pull request #139586 from ania-borowiec/update_comment
Update doc comment for PodSpec.PreemptionPolicy to reflect the actual logic

Kubernetes-commit: 1436bc703dda6414a5b595f4b51ea6846535299d
2026-06-16 23:34:34 +00:00
Kubernetes Publisher
81deda607d Merge pull request #138999 from neolit123/1.37-client-go-generate-key-field-in-config
client-go: add Config.GenerateKey in certificate_manager.go

Kubernetes-commit: 0b19f2fae00634492409cf63e3c1998e77a5480f
2026-06-16 23:34:30 +00:00
PatrickLaabs
bb74650ccf Replacing deprecated sets.NewString with generic implementation
Kubernetes-commit: f3fc35faf035e6a7ad90d68a237d43b44de82280
2026-06-16 13:44:52 +02:00
Kubernetes Publisher
9fb400dccd Merge pull request #138080 from Lidang-Jiang/feat/dv-statefulset-selector-immutable
Migrate StatefulSet immutable fields to declarative validation

Kubernetes-commit: c7699a3b4b1f09a31ca0a985eaedce6ae502652c
2026-06-15 23:34:08 +00:00
Michael Aspinwall
ebfbc6844a Expose a way to wait for a controller listener to be fully shutdown
Kubernetes-commit: 338db9dde41f09aa094b61ef128e2d11327960ca
2026-06-15 17:52:00 +00:00
Lidang-Jiang
d8fe9715b9 Migrate StatefulSet immutable fields to declarative validation
Kubernetes-commit: 91341fc879394357dd24a7aaca3331cae1c2d6f6
2026-06-10 09:04:35 +08:00
Kubernetes Publisher
394ed525a6 Merge pull request #139101 from lalitc375/conditions
Setup metav1.Condition for declarative valdiations.

Kubernetes-commit: 8f8aa9aae157b88db6ba02836c57596496d3f684
2026-06-11 04:14:23 +00:00
Kubernetes Publisher
cfe83ef28c Merge pull request #139435 from xigang/rename_informer_metrics
client-go: Rename FIFO metrics file to informer metrics

Kubernetes-commit: 2f2ec717505fc9f75ddb91e6a2a14cadf2b0d95c
2026-06-10 00:12:34 +00:00
Kubernetes Publisher
2fb3fa6ff2 Merge pull request #129331 from pohly/log-client-go-portforward
client-go portforward + apiserver proxy: structured, contextual logging

Kubernetes-commit: 42a9d604c239d13a76bb5a3c3beb1c01c4779c59
2026-06-09 16:12:45 +00:00
Ania Borowiec
6a08ddec11 update doc comment for PreemptionPolicy to reflect the actual logic
Kubernetes-commit: 312919c2278f0d419b15f688578ae721966aa607
2026-06-09 11:11:54 +00:00
Kubernetes Publisher
c53b2772ec Merge pull request #137694 from Jefftree/client-go-throttle-err
client-go: return context error directly instead of wrapping as rate limiter error

Kubernetes-commit: 1fd96eb4bb023453099100f446393cab3f92c218
2026-06-08 20:09:17 +00:00
Kubernetes Publisher
0deb0beab3 Merge pull request #137988 from Jefftree/flake-fix
leaderelection: retry release on conflict from inflight renew

Kubernetes-commit: 6b364b1811ab7e9b3bc03a253b94fe6e18841d54
2026-06-06 03:35:59 +00:00
Maciej Skoczeń
c3667cb92d Merge GangScheduling and WorkloadAwarePreemption feature gates into GenericWorkload
Kubernetes-commit: 54ca619d4b3c31665d92868439118a4740c994a6
2026-06-05 12:48:52 +00:00
Kubernetes Publisher
6b1bbb2a13 Merge pull request #138488 from yliaog/master
DRA Extended Resource: promote to GA in 1.37

Kubernetes-commit: e0c1c5bd3d1896f9bb12b7881d84bcdc4bf0cf2b
2026-06-03 19:35:53 +00:00
Kubernetes Publisher
274207396a Merge pull request #139420 from dims/update-x-net-deps
Bump golang.org/x/net to HEAD for http2 configureServer ALPN fix

Kubernetes-commit: 5ffa4a018b34d0c0a438891cfe71834b10be4e0a
2026-06-02 19:35:09 +00:00
Davanum Srinivas
c637a8ce7e Bump golang.org/x/net to HEAD for http2 go1.27 wrap fixes
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
2026-06-02 12:21:42 -04:00
xigang
0c1c0f1e14 client-go: Rename FIFO metrics file to informer metrics
Signed-off-by: xigang <wangxigang2014@gmail.com>

Kubernetes-commit: fe0cc1d829e10077f11895674e3ce021884a85bb
2026-06-02 17:37:52 +08:00
Kubernetes Publisher
5d252d37f7 Merge pull request #135925 from jianzhangbjz/painc
Docs: event cache key generation functions require non-nil inputs

Kubernetes-commit: 451b50df783cc381f15c9c2a35d2948a699c249a
2026-05-28 21:01:30 +00:00
Kubernetes Publisher
3f75409d2a Merge pull request #139190 from Kartavyasonar/doc-configmap-binarydata-env-limitation
doc: clarify ConfigMap BinaryData not propagated to container env vars

Kubernetes-commit: 0be5dabcdf90e7d997b3de06144d8959d0eab7cd
2026-05-28 01:01:26 +00:00
Kartavya Sonar
778155c88d doc: clarify ConfigMap BinaryData not propagated to container env vars
Kubernetes-commit: be38e73900fdb0a1128e83d41ed11d483284b538
2026-05-27 12:34:32 +00:00
Kubernetes Publisher
87f45e924f Merge pull request #138653 from adrianmoisey/hpa-generation-conditions
HPA: Set ObservedGeneration in HPA conditions

Kubernetes-commit: b094736530bf98e7d3d1c766c6c67064f1d56029
2026-05-26 17:51:49 +00:00
Kubernetes Publisher
a35c5f8f96 Merge pull request #139258 from dims/update-x-net-deps
Bump golang.org/x/net from v0.54.0 to v0.55.0

Kubernetes-commit: 6790dcf1f60d0528576a8665ef3a807c7951bb8f
2026-05-23 13:52:13 +00:00
Davanum Srinivas
3952f1d02a Bump golang.org/x/net from v0.54.0 to v0.55.0
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
2026-05-23 08:06:24 -04:00
Kubernetes Publisher
7b85db3954 Merge pull request #139248 from dims/bump-golang.org/x/crypto-to-v0.52.0
Bump golang.org/x/crypto to v0.52.0

Kubernetes-commit: f6442409ad90cdd4b4826571f409e59a07ceb070
2026-05-22 21:51:59 +00:00
Kubernetes Publisher
3772a3df68 Merge pull request #138572 from dom4ha/promote-workload-api-v1alpha3
Converts the DisruptionMode enum field to struct as v1alpha3 and drops v1alpha2

Kubernetes-commit: 901087fb35049e1a7d115fd0c9d8586399468615
2026-05-22 21:51:57 +00:00
Kubernetes Publisher
c39cf12e43 Merge pull request #138287 from adrianmoisey/fix-typo
Fix typo on WaitForCacheSync comment

Kubernetes-commit: 65c1c32a9b221ce2fc13b91295691ca7e2257587
2026-05-22 21:51:53 +00:00
Davanum Srinivas
f8dcfdcb70 Bump golang.org/x/crypto to v0.52.0
Kubernetes-commit: 17a8f4f5c041b13b7ae5bff4a40a4f37fff13d51
2026-05-22 12:13:09 -04:00
Kubernetes Publisher
0328c36dee Merge pull request #137103 from arcceus/api-linter-apps-optionalorrequired
Enables the optionalorrequired linter for the apps API group

Kubernetes-commit: e136f39334a72b7d35069a97d373ccaa0211dcae
2026-05-22 01:51:13 +00:00
Kubernetes Publisher
d584c96c7a Merge pull request #136847 from liyuerich/commentstartautoscaling
enable commentstart check on autoscaling API group

Kubernetes-commit: 323e89513a2083dcb41e55762c1c9ee666dbe73b
2026-05-21 21:53:51 +00:00