7550 Commits
Author SHA1 Message Date
kubernetes-prow[bot] 5897b3ac79 Merge pull request #139079 from carlory/remove-fg-RecoverVolumeExpansionFailure
Remove feature gate RecoverVolumeExpansionFailure
2026-11-05 21:49:14 +00:00
kubernetes-prow[bot] f3fd37c12f Merge pull request #143790 from imusmanmalik/fix-dte-deleting-pod-metric
devicetainteviction: don't count terminating pods as evicted
2026-11-04 16:07:11 +00:00
kubernetes-prow[bot] f46443168b Merge pull request #143534 from helayoty/helayoty/5547-job-was-discovery
[WAS] KEP-5547: Update Job controller name-based Workload/PodGroup discovery and management modes
2026-11-04 15:04:56 +00:00
imusmanmalik 50d6899352 fix: skip eviction metrics for terminating pods
addConditionAndDeletePod returned nil both after deleting the pod and
when the pod already had a DeletionTimestamp, so maybeDeletePod counted
pods that someone else was deleting in the deletion metrics and in the
DeviceTaintRule evicted pod count.
2026-11-04 10:35:20 +01:00
Heba Elayoty c8c9191562 name-based for Job Workload/PodGroup discovery and management modes
Signed-off-by: Heba Elayoty <hebaelayoty@gmail.com>
2026-11-03 19:49:54 +00:00
kubernetes-prow[bot] c3493d42c2 Merge pull request #142962 from helayoty/helayoty/6089-was-api-promotion
[WAS] KEP-6089: Promote Building Blocks APIs
2026-11-03 16:18:52 +00:00
kubernetes-prow[bot] a8a44c8869 Merge pull request #142385 from LiRunGuo/fix/issue-142349-force-detach-metric-flake
attachdetach: wait for the force detach metric in reconciler tests
2026-11-03 15:26:36 +00:00
Jake NeslerandOmer Aplatony 55fa8ba271 podautoscaler: avoid serializing repeated pod labels (#143323)
* podautoscaler: avoid serializing repeated pod labels

* Update pkg/controller/podautoscaler/hpa_selector_store_test.go

Co-authored-by: Omer Aplatony <omerap12@gmail.com>

---------

Co-authored-by: Omer Aplatony <omerap12@gmail.com>
2026-11-02 17:56:01 +00:00
carlory 6b06590525 Remove feature gate RecoverVolumeExpansionFailure 2026-11-01 14:03:41 +08:00
Heba Elayoty f2dba1341b Update imports to use WAS building blocks from scheduling/v1
Signed-off-by: Heba Elayoty <hebaelayoty@gmail.com>
2026-10-31 16:47:27 +00:00
kubernetes-prow[bot] f2319f5ce5 Merge pull request #143127 from helayoty/helayoty/5547-was-api
[WAS] KEP-5547: UID-aware PodGroup names and reject spec.scheduling with template schedulingGroup
2026-10-30 23:13:53 +00:00
Guy Yankovitch 53d0414b73 Fix StatefulSet maxUnavailable budget to ignore pods below partition (#143114)
* Fix StatefulSet maxUnavailable budget to ignore pods below partition

Unavailable pods outside the update range were consuming the rolling-update
budget and could stall Parallel rolls even when maxUnavailable was unset.

* Keep UnavailableReplicas as whole-STS while budget stays partition-scoped

Split the counters so the metric still reports all unavailable replicas, and add a metrics case with unavailable pods below partition.

* Use max() to clamp expected deleted pods in STS test

Satisfies the golangci modernize/minmax hint on the OrderedReady invariant expectation.

* Scale STS maxUnavailable percent from partition range and fix API docs

Percent MaxUnavailable is computed from Replicas-Partition so it matches
the partition-scoped update budget; apps/v1 godoc now states the same.

* Use new() instead of ptr.To in STS maxUnavailable tests

Satisfy golangci modernize/newexpr on the rewritten table.

* Regenerate API docs after MaxUnavailable comment update

Sync generated openapi, swagger, proto, and applyconfiguration
comments with the apps/v1 RollingUpdateStatefulSetStrategy docs.

* Update openapi-spec for STS MaxUnavailable docs

Regenerate swagger and apps/v1 OpenAPI descriptions to match the
partition-scoped MaxUnavailable comment.
2026-10-30 02:29:31 +00:00
Heba Elayoty 290fc4ec32 make GeneratePodGroupName UID-aware for sibling Jobs
Signed-off-by: Heba Elayoty <hebaelayoty@gmail.com>
2026-10-29 19:25:49 +00:00
kubernetes-prow[bot] 4a7fc3e0fc Merge pull request #143513 from pohly/logcheck-client-go-controllers
controllers: use contextual logging APIs
2026-10-29 14:35:31 +00:00
Patrick Ohly 7bec3d14e0 update logcheck to v0.11.0, fix new findings
The updated logcheck now warns about passing a pointer as value where String
could crash if nil. The new findings are false positives, but there have been
real issues before and adding klog.SafePtr is cheap mitigation for false
positives.

The HandleError* wrappers around contextual logging are now annotated such that
the new logcheck knows that they do contextual logging. This revealed some real
issues (expecting printf-style formatting or missing keys, passing a *function*
instead of the function result).
2026-10-29 11:09:47 +01:00
kubernetes-prow[bot] 8840cef218 Merge pull request #143283 from michaelasp/controller-client-builder
controller-manager: deprecate Config and ConfigOrDie from ControllerClientBuilder
2026-10-29 07:18:44 +00:00
Michael Aspinwall 9f7be5e876 controller-manager: deprecate ControllerClientBuilder.Config and ConfigOrDie
A raw rest.Config lets a controller build a client that bypasses the
client configuration and transport wrappers the controller manager
applies to the clients it builds, such as the leader election write gate
of KEP-6361. Deprecate Config and ConfigOrDie on ControllerClientBuilder
and on the cloud-provider copy of the interface; out-of-tree cloud
providers and controller managers that call them keep working, and the
configs they get still carry the controller manager's wrappers.

Add TypedClientBuilder, implemented by both in-tree builders, with the
clients controllers were building from raw configs: metadata, dynamic
and scale clients, WithRateLimits for controllers that need more QPS and
burst than the defaults, and WithDropManagedFields for the informer
clients. The controller managers hand the builder to their controllers,
and a forbidigo rule keeps in-tree code off the deprecated methods. Unit
tests cover the derived builders on both implementations.

DiscoveryClient's discovery-tuned limits become a floor rather than an
override, so a builder configured with higher limits keeps them; the
storage version migrator relies on that for its discovery client.

The HPA metrics and apiextensions clients still need a config and are
built in one lint-exempted place in the controller context, since
k8s.io/controller-manager does not depend on those client packages.

DynamicControllerClientBuilder cached the composed WrapTransport, so the
base config's wrapper was applied twice to every client after the first
one built under a service account name. Cache only the token wrapper.
2026-10-28 14:29:22 -07:00
kubernetes-prow[bot] 69dec1465d Merge pull request #141771 from tallclair/container-iter
use podutil.ContainerIter to iterate over containers and init containers
2026-10-28 16:51:27 +00:00
Patrick Ohly a2095779c0 controllers: use contextual logging APIs
Pass loggers and contexts to client-go instead of relying on the global
logger, and replace calls to APIs without context support.
2026-10-28 13:47:11 +01:00
Antoni Zawodny cdde6a1e25 Update CPG API consumers in code to use the beta API 2026-10-28 08:27:44 +01:00
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
Guy Yankovitch c705e82833 Fix PDB controller to enqueue all affected budgets on pod changes (#143111)
* Fix PDB controller to enqueue all affected budgets on pod changes

Wake previously matching PDBs when pod labels change, and enqueue every
overlapping PDB so status stays correct instead of picking one arbitrarily.

* PDB: warn on multiple budgets only for the current pod

Skip the MultiplePodDisruptionBudgets warning for old labels on update,
and list matching PDB names in the event message.

* PDB: extract multi-budget warning from getPdbsForPod

Move the MultiplePodDisruptionBudgets event out of the lookup helper,
compare pod labels with reflect.DeepEqual, and quote matching PDB names
in the warning message.

* PDB: use controller.KeyFunc for updatePod sync map keys

Match enqueuePdb and use namespace/name keys when deduping PDBs to sync
on pod label updates.
2026-10-27 19:41:46 +00:00
kubernetes-prow[bot] 78fe20a84c Merge pull request #137396 from atiratree/imperative-eviction-interceptor
Add imperative eviction responder for EvictionRequest API
2026-10-27 14:35:16 +00:00
yogeshbendre 7dacc57ce2 dra: honor empty effect in DeviceToleration for NoExecute eviction
DeviceToleration.effect documents that an empty value matches all taint
effects, and resourceclaim.ToleratesTaint implements that. The eviction
controller however skipped every toleration whose effect was not exactly
NoExecute before calling it, so a toleration without effect did not
protect the pod from a NoExecute taint.

Accept an empty effect as well, and add a test case.

Signed-off-by: yogeshbendre <07.yogesh@gmail.com>
2026-10-24 19:38:59 +05:30
Jordan Liggitt fbc5386508 Cleanup inactive approvers 2026-10-22 13:34:00 -04:00
Tim Allclair a69f033c38 use podutil.ContainerIter to iterate over containers
Iterating over containers using `append(pod.Spec.Containers, pod.Spec.InitContainers...)`
allocates a new backing slice and copies large Container structs by value, which
adds unnecessary heap allocations and GC overhead.

Switch callers across kubelet, scheduler plugins, and controllers to iterate
in-place via podutil.ContainerIter.
2026-10-22 16:50:34 +00:00
Filip Křepinský d3d91e6189 imperative-eviction-responder-controller unit and integration tests 2026-10-22 14:56:43 +02:00
Filip Křepinský b2eb09f252 imperative-eviction-responder-controller implementation 2026-10-22 14:56:43 +02:00
Filip Křepinský e00acabe5b add imperative-eviction-responder-controller controller 2026-10-22 14:56:43 +02:00
kubernetes-prow[bot] c6867241a2 Merge pull request #142856 from kannon92/fixed-job-length-was
use fixed name for templates for podgroups to avoid overflow issues
2026-10-22 11:11:32 +00:00
DoramarothyandAdrian Moisey 959c3efa1a hpa: eliminate implicit float64 divide-by-zero in per-pod metric functions (#143148)
* hpa: eliminate implicit float64 divide-by-zero in per-pod metric functions

GetObjectPerPodMetricReplicas and GetExternalPerPodMetricReplicas both
compute:

  usageRatio := float64(usage) / (float64(target) * float64(replicaCount))

where replicaCount = statusReplicas. When statusReplicas == 0 this
produces +Inf or NaN. The code accidentally works today because
isWithin(+Inf) and isWithin(NaN) both return false, falling through to
the ceilToInt32 path. However this is fragile:

  - a future int conversion of usageRatio before comparison would panic
    or produce a wrong result
  - a change to the isWithin implementation could silently break
    scale-from-zero for these metric types

Replace the implicit +Inf/NaN path with an explicit statusReplicas == 0
guard that skips the ratio check and goes directly to the desired count,
matching the intent of the existing comment in getUsageRatioReplicaCount
which already handles currentReplicas == 0 for other metric types.

Existing test cases for statusReplicas == 0 continue to pass unchanged.

Signed-off-by: Samiksha Agarwal <agarwalsamiksha88@gmail.com>

* Update pkg/controller/podautoscaler/replica_calculator.go

Co-authored-by: Adrian Moisey <adrian@changeover.za.net>

* hpa: trim verbose comment in GetExternalPerPodMetricReplicas

Keep the comment concise, matching the simpler style of neighboring
functions.

Signed-off-by: Samiksha Agarwal <agarwalsamiksha88@gmail.com>

* Removed trailing spaces in comments

Signed-off-by: Samiksha Agarwal <agarwalsamiksha88@gmail.com>

* Extract calcPerPodReplicas and guard ratio check with statusReplicas != 0

Move the duplicated per-pod replica calculation from GetObjectPerPodMetricReplicas and GetExternalPerPodMetricReplicas into a shared calcPerPodReplicas helper.

Replace the early return for statusReplicas == 0 with a guard around the usageRatio and tolerance check only, so the desired-count calculation appears once as the fall-through. No behavior change.

Signed-off-by: Samiksha Agarwal <agarwalsamiksha88@gmail.com>

* Rename helper to getPerPodReplicas and add explanatory comments

Explain the return value and why the tolerance check is skipped when no pods are running.

Signed-off-by: Samiksha Agarwal <agarwalsamiksha88@gmail.com>

---------

Signed-off-by: Samiksha Agarwal <agarwalsamiksha88@gmail.com>
Co-authored-by: Adrian Moisey <adrian@changeover.za.net>
2026-10-22 10:23:46 +00:00
Kevin Hannon ad13605eea avoid overflow issues for pod group templates 2026-10-21 10:58:21 -04:00
Filip KřepinskýandJohan K. Jensen 06e1262749 evictionrequest-controller unit and integration tests
Co-authored-by: Johan K. Jensen <jj@johanjensen.dk>
2026-10-21 10:25:25 +02:00
Filip KřepinskýandJohan K. Jensen 33932de927 evictionrequest-controller implementation
Co-authored-by: Johan K. Jensen <jj@johanjensen.dk>
2026-10-21 10:25:25 +02:00
Filip KřepinskýandJohan K. Jensen feef70d7df add evictionrequest-controller controller
Co-authored-by: Johan K. Jensen <jj@johanjensen.dk>
2026-10-21 10:25:25 +02:00
kubernetes-prow[bot] ff0f61dbfe Merge pull request #143103 from SEPURI-SAI-KRISHNA/fix-svm-failed-migration-storedversions
svm: keep CRD stored versions when a migration fails
2026-10-21 01:21:35 +00:00
kubernetes-prow[bot] 658c6691fa Merge pull request #136029 from huww98/detach-on-node-delete
ad-controller: allow immediate detach when node deleted
2026-10-16 14:40:11 +00:00
SEPURI-SAI-KRISHNA 684ffad96d svm: keep CRD stored versions when a migration fails
The migration runner trimmed a CRD's status.storedVersions to the
storage version whenever the CRD generation was unchanged, including
after a failed migration. A failed migration can leave objects in an
old version, and once that version is gone from storedVersions it can
be removed from the CRD, leaving those objects undecodable.

Only update storedVersions after a successful migration.
2026-10-16 13:36:01 +05:30
weizhoublue 4e42fc8f88 Deployment rollouts fail to report timeouts after old ReplicaSet scale-down errors (#142902)
* Deployment rollouts fail to report timeouts after old ReplicaSet scale-down errors

Signed-off-by: weizhou blue <weizhou.lan@daocloud.io>

* Consolidate deployment rollout status and error handling

Signed-off-by: weizhou blue <weizhou.lan@daocloud.io>

---------

Signed-off-by: weizhou blue <weizhou.lan@daocloud.io>
2026-10-15 14:26:12 +00:00
Xudong Sun a148db0feb Fix StatefulSet bug of matching leading-zero pod name (#141094)
* Fix StatefulSet bug of matching leading-zero pod name

* Fix CI error: return value of  is not checked

* Avoid duplicated code by making identityMatches call isMemberOf

* Add more test cases

* Simplify the test and add comment to skip lint check

* Update comments of isMemberOf
2026-10-15 13:02:09 +00:00
kubernetes-prow[bot] 21ed0975e2 Merge pull request #142922 from yankovitchg/fix/job-deleted-ready-on-failed-delete
Job: do not decrement Ready when pod delete fails
2026-10-12 19:48:17 +00:00
Guy Yankovitch d9d338d018 Fix job_pods_creation_total double-counting failed creates
Only increment creationsSucceeded when pod creation returns nil so a
failed attempt is not recorded as both failed and succeeded.
2026-10-11 23:04:17 +03:00
Guy Yankovitch a71b5d2483 Job: do not decrement Ready when pod delete fails
deleteActivePods and deleteJobPods counted ready pods as deleted even when
DeletePod returned an error, undercounting Job status.ready until the next
successful sync.
2026-10-11 16:34:44 +03:00
Guy Yankovitch 9582547bfc Deployment: surface old RS scale-down errors for workqueue retry (#142650)
* Deployment: surface old RS scale-down errors for workqueue retry

reconcileOldReplicaSets was returning nil when cleanupUnhealthyReplicas
or scaleDownOldReplicaSetsForRollingUpdate failed, so sync looked
successful and did not AddRateLimited. Propagate the error like the
new-RS path, and add a unit test that injects an RS update failure.

* Deployment: fold old-RS scale error cases into table tests

Address review: inject RS update failures in reconcileOldReplicaSets
table (ready and unavailable old replicas) and assert with errors.Is.
2026-10-09 20:31:33 +00:00
kubernetes-prow[bot] 35304f575c Merge pull request #142506 from matteopulcini6/master
fix: create copy of spec to prevent data race
2026-10-09 14:38:29 +00:00
Parth Kumar Singh 0c4ed5ebc9 podgroupprotection: forget keys on success and requeue on error
processNextWorkItem had its error check inverted when it was
generalised to serve both the PodGroup and CompositePodGroup queues.
Successful syncs were requeued with backoff forever and logged as
failures, while failed syncs (for example a conflict while removing
the finalizer) were dropped and never retried.

Restore the err == nil check and add a test for processNextWorkItem,
which the existing tests did not exercise.
2026-10-08 14:11:51 +05:30
kubernetes-prow[bot] a05f352745 Merge pull request #142146 from pohly/ktesting-publishing
ktesting: publishing via staging
2026-10-07 14:20:47 +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
Patrick Ohly 09a3e27741 DRA consumable capacity: fix allocation result lookup
Two in-tree places looked for entries with a literal string lookup.  This
compared a QualifiedName from a current slice against a QualifiedName from an
allocation result, which is based on some older slice. The literal lookup
breaks if the slices changed from fully-qualified to un-qualified or vice
versa.

The correct approach is to do what lookupAttribute for constraints does: check
both forms. Following the example set by lookupAttribute, fully-qualified is
given precedence in case of a conflict.
2026-10-07 08:29:37 +02:00
Omer Aplatony 1ccc00b919 fixed metric name for object metric
Signed-off-by: Omer Aplatony <omerap12@gmail.com>
2026-10-06 13:40:55 +03:00