Commit graph

284 commits

Author SHA1 Message Date
Kubernetes Prow Robot
21b427c299
Merge pull request #136827 from atombrella/feature/fix_nilness_controller
Fix cases of nilness under pkg/controller.
2026-03-10 15:15:11 +05:30
ahmedharabi
a0dee17c1d statefulset: wrap errors with %w in StatefulPodControl
Signed-off-by: ahmedharabi <harabiahmed88@gmail.com>
2026-03-05 23:02:16 +01:00
Kubernetes Prow Robot
9d7dda7186
Merge pull request #137245 from atombrella/feature/slices_contains_pkg_controller
Update `pkg/controller` to use slices.Contains
2026-03-04 18:04:20 +05:30
Michael Aspinwall
c8e8bd5085 Add the ability for the statefulset controller to read its own writes 2026-02-27 18:21:30 +00:00
Mads Jensen
d11d54dc50 Update pkg/controller to use slices.Contains 2026-02-26 10:17:13 +01:00
Ryan Brewster
11c6f8c7c8
Clean up redundant IsNotFound checks in stateful_set_control
🏠 Remote-Dev: homespace
2026-02-12 14:35:10 +00:00
Mads Jensen
af5741da5f Fix cases of nilness under pkg/controller. 2026-02-07 21:16:00 +01:00
Ryan Brewster
efe3667b6b
Add 404 handling for the statefulset controller pod deletion codepath
The daemonset controller already has handling for NotFound errors.

Right now if the statefulset controller is attempting to scale down a
statefulset and its informer cache is stale, it can get hard-blocked on a
missing pod.

This issue will eventually self-resolve once the informer cache "catches
up", but in the process of exploring this issue I realized that
404s during pod deletions don't strictly need to abort the entire sync;
we can continue.

This is especially impactful for large statefulsets with
podManagementStrategy: Parallel, where a single "phantom" pod (actually
missing, but still present in the informer cache) can block thousands of
other pods from being cleaned up.
2026-02-06 22:45:57 +00:00
Karthik Bhat
e44e06c53f Remove usage of deprecated functions from ktesting package 2026-01-29 14:51:59 +05:30
Jefftree
2522628780 Add index for controller revision 2026-01-13 19:46:34 +00:00
Filip Křepinský
7aa186fa0a
schedule pod availability checks at the correct time in StatefulSets (#135428)
* wire now (time) to the availability checks in the StatefulSet controller

- this helps to make the controller reconcilliation consistent

* schedule pod availability checks at the correct time in StatefulSets

* replace "k8s.io/klog/v2/ktesting" with "k8s.io/kubernetes/test/utils/ktesting"

for advanced features (e.g. Eventually)

* add StatefulSetAvailabilityCheck test
2025-12-17 22:35:21 -08:00
Kubernetes Prow Robot
48c56e04e0
Merge pull request #135017 from liggitt/stateful-set-noop-rollout
Fix spurious statefulset rollout from 1.33 → 1.34
2025-11-03 19:58:11 -08:00
Jordan Liggitt
979c442774
Fix spurious workload rollout due to null creationTimestamp in controller revisions 2025-11-03 17:11:06 -05:00
Jordan Liggitt
94e085e15c
Add unit test detecting spurious statefulset rollout 2025-11-03 16:33:39 -05:00
Ondra Kupka
502186ca93 controller/statefulset: Improve goroutine mgmt
Make sure all threads are terminated when Run returns.
2025-10-29 19:04:37 +01:00
Kubernetes Prow Robot
57c243f33c
Merge pull request #134450 from mayank-agrwl/controller-contextual-logs
Replace HandleCrash and HandleError calls to use context-aware alternatives
2025-10-23 00:49:02 -07:00
Jordan Liggitt
91d135f344
Include relevant dimensions in pod controller indexing 2025-10-16 13:27:50 -04:00
Mayank Agrawal
5e216ae34d Replace HandleCrash and HandleError calls to use context-aware alternatives 2025-10-07 22:40:10 -07:00
Edwin Hernandez
fa9071302f
Adding metrics for Maxunavailable feature in StatefulSet (#130951)
* adding maxunavailable_violation metric

added metric to list of stable metrics

changed when metric gets incremented

addressed comments

fixed stable metrics list

* Update pkg/controller/statefulset/metrics/metrics.go

Co-authored-by: Filip Křepinský <fkrepins@redhat.com>

* Update the metric and log verbosity level

* Address false positives metric count

Signed-off-by: Heba Elayoty <heelayot@microsoft.com>

* Implement maxUnavailable and UnavailableReplicas metrics

Signed-off-by: Heba Elayoty <heelayot@microsoft.com>

* fix lint fmt

Signed-off-by: Heba Elayoty <heelayot@microsoft.com>

* update tests

Signed-off-by: Heba Elayoty <heelayot@microsoft.com>

* se metrics to 1 as a default

* log for true validation only and update func sig.

* Move maxUnavailable metric to the updateStatefulSetStatus

Signed-off-by: Heba Elayoty <heelayot@microsoft.com>

* change metrics stability level to Alpha

Signed-off-by: Heba Elayoty <heelayot@microsoft.com>

* fix unit test

Signed-off-by: Heba Elayoty <heelayot@microsoft.com>

* fix linting issue

Signed-off-by: Heba Elayoty <heelayot@microsoft.com>

* Address code review feedback

Signed-off-by: Heba Elayoty <heelayot@microsoft.com>

---------

Signed-off-by: Heba Elayoty <heelayot@microsoft.com>
Co-authored-by: Filip Křepinský <fkrepins@redhat.com>
Co-authored-by: Heba Elayoty <heelayot@microsoft.com>
2025-09-17 05:34:14 -07:00
Kubernetes Prow Robot
d03d25f47c
Merge pull request #133985 from aditigupta96/api-waitfornamedcachesync-with-context
Replace WaitForNamedCacheSync with WaitForNamedCacheSyncWithContext in pkg/controller/
2025-09-16 17:18:09 -07:00
Aditi Gupta
af231d2153 Replace WaitForNamedCacheSync with WaitForNamedCacheSyncWithContext in pkg/controller/ 2025-09-16 14:51:34 -07:00
Maciej Szulik
46cc610e6f
Drop PodIndexLabel after the feature GA-ed in 1.32
Signed-off-by: Maciej Szulik <soltysh@gmail.com>
2025-09-11 19:32:48 +02:00
Nour
72847ee1f7
Replace deprecated strings.Title with cases.Title 2025-08-30 18:16:59 +03:00
Maciej Szulik
09e357d31f
Drop StatefulSetAutoDeletePVC after the feature GA-ed in 1.32
Signed-off-by: Maciej Szulik <soltysh@gmail.com>
2025-08-28 13:35:16 +02:00
Kubernetes Prow Robot
66cf6286a8
Merge pull request #130909 from Edwinhr716/minreadyseconds-fix
Fix StatefulSetMinReadySeconds healthy concept
2025-07-07 12:31:26 -07:00
Heba Elayoty
977c670733
Add unit tests for minReady new behaviour
Signed-off-by: Heba Elayoty <heelayot@microsoft.com>
2025-07-01 18:05:26 -07:00
Michal Wozniak
ac86e67b7d Commonize filtering of Pods by Owner with all orphans in namespace 2025-06-30 08:07:21 +02:00
xigang
66c611125c Add namespace-aware orphan pod indexing
Signed-off-by: xigang <wangxigang2014@gmail.com>
2025-06-19 16:32:20 +08:00
Harish Kuna
c005b85d4d Reduce locking duration on cache to fetch data from Cache 2025-03-21 15:23:08 +00:00
Edwinhr716
8db5f06183 adding commits of the original PR
isHealthy -> isUnavailable, fixed comments

fixed reversed logic

changed logs from unhealthy to unavailable
2025-03-20 22:46:38 +00:00
Arda Güçlü
a88e08c397 Do not attempt to truncate revision history if revisionHistoryLimit is negative 2024-12-19 11:35:29 +03:00
Patrick Ohly
8a908e0c0b remove import doc comments
The "// import <path>" comment has been superseded by Go modules.
We don't have to remove them, but doing so has some advantages:

- They are used inconsistently, which is confusing.
- We can then also remove the (currently broken) hack/update-vanity-imports.sh.
- Last but not least, it would be a first step towards avoiding the k8s.io domain.

This commit was generated with
   sed -i -e 's;^package \(.*\) // import.*;package \1;' $(git grep -l '^package.*// import' | grep -v 'vendor/')

Everything was included, except for
   package labels // import k8s.io/kubernetes/pkg/util/labels
because that package is marked as "read-only".
2024-12-02 16:59:34 +01:00
Kubernetes Prow Robot
50362ac7d0 Promote StatefulSetAutoDeletePVC to stable for 1.32. 2024-11-07 09:43:49 -08:00
Alay Patel
3e3276e9fe
Promote PodIndexLabel for Statefulset and IndexedJob stable (#128387)
* lock feature gate for PodIndexLabel and mark it GA

Signed-off-by: Alay Patel <alayp@nvidia.com>

* add emulated version if testing disabling of PodIndexLabel FG

Signed-off-by: Alay Patel <alayp@nvidia.com>

---------

Signed-off-by: Alay Patel <alayp@nvidia.com>
2024-11-04 19:11:28 +00:00
Kubernetes Prow Robot
aa8f2878a5
Merge pull request #117943 from lowang-bh/lessFunCall
improve: reduce function calling number
2024-10-24 04:52:52 +01:00
Abhishek Kr Srivastav
95860cff1c Fix Go vet errors for master golang
Co-authored-by: Rajalakshmi-Girish <rajalakshmi.girish1@ibm.com>
Co-authored-by: Abhishek Kr Srivastav <Abhishek.kr.srivastav@ibm.com>
2024-09-20 12:36:38 +05:30
Joe Betz
2595aa1309 generate 2024-09-03 14:26:26 -04:00
Peter Schuurman
585971431b Remove StatefulSetStartOrdinal feature gate to target stable in 1.31 2024-07-16 08:05:09 -07:00
Matthew Cary
d386d6880e Respect controllers on PVCs for retention policy 2024-06-05 12:06:41 -07:00
Kubernetes Prow Robot
f75d8e97f1
Merge pull request #124624 from atiratree/fix-flake
[test] statefulset controller: fix requests tracker concurrency
2024-05-10 06:49:00 -07:00
Filip Křepinský
8ca077ab7a improve TestParallelScale test
we can test for larger number of parallel requests than 2 in
statefulsets with hundreds of replicas
2024-05-07 21:01:47 +02:00
Filip Křepinský
df276c5538 fix requests tracker concurrency 2024-05-07 20:45:18 +02:00
Alvaro Aleman
6d0ac8c561 Use the generic/typed workqueue throughout
This change makes us use the generic workqueue throughout the project in
order to improve type safety and readability of the code.
2024-05-04 14:33:12 -04:00
Marek Siarkowicz
3ee8178768 Cleanup defer from SetFeatureGateDuringTest function call 2024-04-24 20:25:29 +02:00
Filip Křepinský
85d55b6737
fix stateful set pod recreation and event spam (#123809)
* fix pods tracking and internal error checking in statefulset tests

* fix stateful set pod recreation and event spam

- do not emit events when pod reaches terminal phase
- do not try to recreate pod until the old pod has been removed from
  etcd storage

* fix conflict race in statefulset rest update

statefulset controller does less requests per sync now and thus can
reconcile status faster, thus resulting in a higher chance for conflicts
2024-04-18 01:03:46 -07:00
Mengjiao Liu
b584b87a94 kube-controller-manager: readjust log verbosity
- Increase the global level for broadcaster's logging to 3 so that users can ignore event messages by lowering the logging level. It reduces information noise.
- Making sure the context is properly injected into the broadcaster, this will allow the -v flag value to be used also in that broadcaster, rather than the above global value.
- test: use cancellation from ktesting
- golangci-hints: checked error return value
2024-02-26 14:51:56 +08:00
weilaaa
eb8f3f194f use build-in max and min func to instead of k8s.io/utils/integer funcs 2023-12-15 15:09:11 +08:00
Kubernetes Prow Robot
05765a851c
Merge pull request #121389 from aleksandra-malinowska/sts-restart-always
Resubmit "Make StatefulSet restart pods with phase Succeeded"
2023-10-30 21:11:51 +01:00
Aleksandra Malinowska
e07d898cfd Make StatefulSet restart pods with phase Succeeded 2023-10-26 15:34:01 +02:00
Kubernetes Prow Robot
ccca58aa36
Merge pull request #120075 from lowang-bh/enhancement
Call getPodRevision once
2023-10-23 19:51:40 +02:00