Commit graph

275 commits

Author SHA1 Message Date
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
Kubernetes Prow Robot
568aee16e8
Merge pull request #120731 from Nordix/sts_issue/adil
Fixing CurrentReplicas and CurrentRevision in completeRollingUpdate
2023-10-20 14:42:08 +02:00
adil ghaffar
00c21ced3a
Fixing CurrentReplicas and CurrentRevision in completeRollingUpdate 2023-10-19 14:17:42 +03:00
Aleksandra Malinowska
7989400bef Fix concurrent write when filling PVC labels 2023-10-11 15:07:55 +02:00
Aleksandra Malinowska
54714686bc Modify test PVC to detect concurrent map write bug 2023-10-11 15:07:50 +02:00
Abhishek Srivastav
5f8fc30b2c
Added locks on request tracker before accessing fields (#120599)
* Added locks on request tracker before accessing fields

Unit test StatefulSetAutoDeletePVCEnabled has been
flaking with DATARACE. Added lock on request tracker
before accessing err field.

* Addressed review comments for PR : Added locks on request tracker before accessing fields
2023-10-03 16:38:08 +02:00
Aleksandra Malinowska
5ed60a72f6
Revert "Make StatefulSet restart pods with phase Succeeded" 2023-09-19 15:49:36 +02:00
Kubernetes Prow Robot
3eca0a5f78
Merge pull request #120398 from aleksandra-malinowska/sts-restart-always
Make StatefulSet restart pods with phase Succeeded
2023-09-13 12:40:12 -07:00
Aleksandra Malinowska
d7264d0af0 Make StatefulSet restart pods with phase Succeeded 2023-09-08 17:47:17 +02:00
Stephen Kitt
aa89e6dc97
Use ptr.To to retrieve intstr addresses
This uses the generic ptr.To in k8s.io/utils to replace functions and
code constructs which only serve to return pointers to intstr
values. Other uses of the deprecated pointer package are updated in
modified files.

Signed-off-by: Stephen Kitt <skitt@redhat.com>
2023-09-08 11:10:50 +02:00