98 Commits
Author SHA1 Message Date
Yongrui Lin 9c1235e9d5 Use k8s.io/apiextensions-api for CRD types and clients
Code that needs the conversions to the internal version still imports
them from k8s.io/apiextensions-apiserver.
2026-10-27 23:16:06 +00:00
Patrick Ohly c13f052503 ktesting: move to staging
This moves the existing code unchanged, updates package and module name, and
updates all import statements.
2026-10-07 11:08:22 +02:00
Ondra Kupka b1e46a68ec apiserver: Ensure controllers block in OnStartedLeading
The coordinated leader election runner was launching controller
goroutines and returning immediately. This caused OnStartedLeading
to return right after starting the controllers, which will soon be
incorrect when ReleaseOnCancel is set — the LeaderElector would stop
renewing and release the lock.
2026-07-01 14:50:40 +02:00
Kubernetes Prow Robot 2d4c2c90b2 Merge pull request #137377 from atombrella/feature/pkg_controlplane
pkg/controlplane: use modernize/slicescontains and modernize/rangeint
2026-04-23 03:20:25 +05:30
Abhijit Hoskeri c07f3ebbde Fix logspam in leaderelection controller.
If the reconcileElectionStep function returns `noRequeue, nil`, it causes log
spam from apiserver.  This is because HandleErrorWithContext regardless of
error value.  Skip logging if error is nil.

Also, tag the log message with the involved lease object name.

```
...
{"ts":1773796037662.8264,"logger":"UnhandledError","caller":"leaderelection/leaderelection_controller.go:169","msg":"Failed to reconcile election step"}
{"ts":1773796038472.465,"logger":"UnhandledError","caller":"leaderelection/leaderelection_controller.go:169","msg":"Failed to reconcile election step"}
...
```
2026-03-17 18:05:20 -07:00
Kubernetes Prow Robot 76f0bd54b8 Merge pull request #137533 from tico88612/feat/contextual-logging-servicecidr
Use contextual logging in service cidr controller
2026-03-17 12:11:39 +05:30
ChengHao Yang 90912e6e10 Plumb ctx down to sync() and syncStatus() methods
Use contextual logging in sync() and syncStatus() by passing ctx
from the caller instead of context.Background(). Replace klog.Infof
calls with logger.Info/Error from klog.FromContext(ctx).

Update tests to use ktesting.NewTestContext.

Signed-off-by: ChengHao Yang <17496418+tico88612@users.noreply.github.com>
2026-03-13 14:06:23 +08:00
Kubernetes Prow Robot a3374ab464 Merge pull request #137492 from tico88612/feat/contextual-logging-leaderrelection
Use contextual logging in leaderelection controller
2026-03-12 00:45:50 +05:30
ChengHao Yang 92a8387751 Use contextual logging in service cidr controller
Signed-off-by: ChengHao Yang <17496418+tico88612@users.noreply.github.com>
2026-03-07 22:47:09 +08:00
ChengHao Yang 1360b939cf Use contextual logging in leaderelection controller
Replace deprecated logging and wait APIs with their context-aware
alternatives in pkg/controlplane/controller/leaderelection/:

- utilruntime.HandleCrash -> HandleCrashWithContext
- utilruntime.HandleError -> HandleErrorWithContext
- cache.WaitForCacheSync -> WaitForNamedCacheSyncWithContext
- wait.Until -> wait.UntilWithContext

Signed-off-by: ChengHao Yang <17496418+tico88612@users.noreply.github.com>
2026-03-07 00:26:53 +08:00
Jordan Liggitt 45900a1deb Fix vet error 2026-03-05 18:11:02 -05:00
Mads Jensen e9e2bc964a pkg/controller: use modernize/slicescontains and modernize/rangeint 2026-03-03 19:12:38 +01:00
Davanum Srinivas 550cc8645b Move dump package from apimachinery to k8s.io/utils
Replace all imports of k8s.io/apimachinery/pkg/util/dump with
k8s.io/utils/dump across the repo. The apimachinery dump package
now contains deprecated wrapper functions that delegate to
k8s.io/utils/dump for backwards compatibility.

Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2026-02-12 07:34:19 -05:00
Kubernetes Prow Robot bded66365e Merge pull request #134258 from mayank-agrwl/apiserver-lease-gc
Make APIServerLeaseGC controller context-aware
2025-10-01 03:34:17 -07:00
Mayank Agrawal b0460eedba Make legacytokentracking controller context aware 2025-09-29 21:41:47 -07:00
Mayank Agrawal 2ffc06e09a Make APIServerLeaseGC controller context-aware 2025-09-24 23:11:26 -07:00
Aditi Gupta f44279647b refactor: Use WaitForNamedCacheSyncWithContext in core components
Signed-off-by: Aditi Gupta <aditigpta@google.com>
2025-09-18 11:34:28 -07:00
Kubernetes Prow Robot 26b246ae66 Merge pull request #133191 from Jefftree/rev
Add jefftree to OWNERS
2025-09-11 07:06:11 -07:00
Jefftree 70794c4568 Add newline to fix owners fmt 2025-08-04 19:12:56 +00:00
Jefftree 7242ddd937 Add jefftree to OWNERS 2025-08-04 19:12:13 +00:00
Antonio Ojea 81e680e6d9 defaultservicecidr controller no shutdown eventbroadcaster on start
The defaultservicecidr controller runs as an apiserver PostStartHook
hence can not block the startup.
The logic of the controller was copied from the common boilerplate and
was assuming the controller blocked on start, hence defering the
shutdown of the eventbroadcaster.

Only shutdown the eventbroadcaster when the context is done.

Change-Id: I70426d5550afe3b12ab5ea68746238dd96f7db52
2025-07-31 10:58:40 +00:00
PatrickLaabs baf71997f5 chore: depr. pointer pkg replacement for pkg/controller 2025-07-07 13:22:36 +02:00
Michael Aspinwall 1a59c250ea feat: make CLE timers configurable 2025-06-25 16:38:50 +00:00
Antonio Ojea 699ec0a538 Remove wrong comment 2025-05-10 13:15:12 +02:00
Antonio Ojea 7fedcc34e4 refactor default service cidr sync status logic
Change-Id: I39a87f81715e227b1107bac3238fc50abb828f0a
2025-05-02 08:25:16 +00:00
Antonio Ojea 0266d3bcb3 Allow single-to-dual-stack reconfiguration for ServiceCIDR
This change modifies the validation logic for ServiceCIDR updates
(`ValidateServiceCIDRUpdate`) to specifically permit upgrading a
single-stack ServiceCIDR (either IPv4 or IPv6) to a dual-stack
configuration.

This reconfiguration path is considered safe because it only involves adding
a new CIDR range without altering the existing primary CIDR. This
ensures that existing Service IP allocations are not disrupted.

Other modifications, such as:
- Downgrading from dual-stack to single-stack
- Reordering CIDRs in a dual-stack configuration
- Changing the primary CIDR during a single-to-dual-stack
  reconfiguration

remain disallowed by the validation. These operations carry a higher
risk of breaking existing Services or cluster networking
configurations. Preventing these updates automatically encourages
administrators to perform such changes manually after carefully
assessing the potential impact on their specific cluster environment.
The validation errors and controller logs provide guidance when such
disallowed changes are attempted.

Change-Id: I41dc09dfddb05f277925da2262f8114d6accbd1d
2025-04-14 17:05:44 +00:00
Jefftree 5ba4a90fda Add LeaseCandidate v1beta1 2025-03-12 17:52:10 +00:00
Kubernetes Prow Robot f13237a34e Merge pull request #130735 from Jefftree/cle-lexo-check
CLE: Remove invalid emulated version and add lexographical order test
2025-03-11 19:47:59 -07:00
Jefftree 775b118a6d Remove invalid emulated version and add lexographical order test 2025-03-11 21:00:48 +00:00
Kubernetes Prow Robot ac05e1a48e Merge pull request #130533 from Henrywu573/parall
Parallelize lease candidate ping
2025-03-11 12:47:53 -07:00
Stanislav Láznička dbf780a48a authn-trust: don't react to target CM updates
If kube-apiservers run at a different version (during upgrades) and
each has different opinion on what the `extension-apiserver-authentication`
config map should look like, they would start dueling with config map
writes.

This commit removes handling of the update events of the target CM
in order to reduce the amount of such dueling to once a minute, as
the controller is guaranteed to run at least once a minute anyway.

The idea is that a cluster state with two different versions of
kube-apiserver should never be permanent, and so a reduced amount of
dueling for that period is tolerable.
2025-03-10 11:28:02 +01:00
Henry Wu 5917343e45 Parallelize lease candidate ping 2025-03-06 01:02:45 -08:00
Henry Wu ca9734afaa Add third party strategy to the coordinate leader election integration test 2025-03-03 14:00:16 -08:00
Jefftree 1a1b566d61 Revert "LeaseCandidate alpha -> beta,"
This reverts commit ac7a95efb0.
2025-03-01 14:14:19 +00:00
Jefftree ac7a95efb0 LeaseCandidate alpha -> beta, 2025-02-27 17:50:36 +00:00
Antonio Ojea 33ba585534 update kube-apiserver 2025-01-20 13:01:53 +00:00
Monis Khan 779d76176a Update tests to handle RemoteRequestHeaderUID
Signed-off-by: Monis Khan <mok@microsoft.com>
2024-12-04 16:04:36 -05:00
Stanislav Láznička a051b067cd featuregate UID in RequestHeader authenticator 2024-12-04 16:26:28 +01:00
Jefftree 0ce7b688a6 v1alpha2 LeaseCandidate API 2024-11-08 02:27:19 +00:00
Kubernetes Prow Robot a50b4e52a9 Merge pull request #128553 from thockin/master
Validation: merge TooLong and TooLongMaxLen
2024-11-06 04:19:43 +00:00
Tim Hockin c8eeb486f4 Call-site comments: the "" arg to TooLong is unused 2024-11-05 15:10:24 -08:00
Tim Hockin 8a7af90300 Clarify that value arg to field.TooLong is unused 2024-11-05 15:10:23 -08:00
Tim Hockin 4d0e1c8fd4 Kill TooLongMaxLength() in favor of TooLong() 2024-11-05 15:10:22 -08:00
Jefftree 1ede4d8f15 Allow cle mutual exclusion lock to be reacquired 2024-11-05 21:01:03 +00:00
googs1025 b60cef2609 fix(leaderelection): nil check in OnStoppedLeading func 2024-10-04 00:26:06 +08:00
Stanislav Láznička 0409ba7ff1 cluster trust CM: wire in the new RequestHeader UID config 2024-09-05 14:28:31 +02:00
Dr. Stefan Schimanski 634c9cd135 Address comments
Signed-off-by: Dr. Stefan Schimanski <stefan.schimanski@gmail.com>
2024-07-30 09:45:52 +02:00
Jefftree d092513685 Use fake clock for controller/leaderelection:TestController 2024-07-29 19:36:53 +00:00
Dr. Stefan Schimanski 3987d850a4 kube-apiserver/leaderelection/test: clean up controller test
Signed-off-by: Dr. Stefan Schimanski <stefan.schimanski@gmail.com>
2024-07-29 09:56:39 +02:00
Dr. Stefan Schimanski b13aab9cf1 kube-apiserver/leaderelection: remove klog noise
Signed-off-by: Dr. Stefan Schimanski <stefan.schimanski@gmail.com>
2024-07-29 09:56:05 +02:00