Commit graph

1106 commits

Author SHA1 Message Date
Kubernetes Prow Robot
6d92449054
Merge pull request #134290 from huww98/kcm-no-get-pv
Do not get PV for externally deleting volume
2026-03-12 05:13:35 +05:30
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
Jordan Liggitt
45900a1deb
Fix vet error 2026-03-05 18:11:02 -05:00
Kubernetes Prow Robot
c6f70e3a38
Merge pull request #136399 from tico88612/feat/storage-metric-beta
Rename metric `volume_operation_total_errors` to `volume_operation_errors_total`
2026-03-06 00:46:18 +05:30
Kubernetes Prow Robot
8275484dcf
Merge pull request #137297 from atombrella/feature/pkg_forvar_modernize
Remove redundant variable re-assignment in for-loops under pkg
2026-03-05 00:28:20 +05:30
xigang
9d10b1f799 refactor: remove unused desiredStateOfWorld parameter from DetermineVolumeAction
Signed-off-by: xigang <wangxigang2014@gmail.com>
2026-03-04 22:01:43 +08: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
Kubernetes Prow Robot
5941fed3d6
Merge pull request #136912 from dfajmon/selinux-ga
Promote SELinuxChangePolicy & SELinuxMountReadWriteOncePod to GA
2026-03-03 22:07:29 +05:30
Mads Jensen
f11bb48738 Remove redundant re-assignment in for-loops under pkg
This the forvar rule from modernize. The semantics of the for-loop
changed from Go 1.22 to make this pattern obsolete.
2026-03-02 08:47:43 +01:00
ChengHao Yang
5c88906dca
Rename volume_operation_total_errors to volume_operation_errors_total
Raname this because facing lint error, counter metrics should have
"_total" suffix. Add the test `volume_operation_errors_total`
Marked `volume_operation_total_errors` as deprecated

Signed-off-by: ChengHao Yang <17496418+tico88612@users.noreply.github.com>
2026-02-28 20:08:07 +08:00
Daniel Fajmon
b0919d81a0 Promote SELinuxChangePolicy & SELinuxMountReadWriteOncePod to GA 2026-02-27 14:58:14 +01:00
Mads Jensen
d11d54dc50 Update pkg/controller to use slices.Contains 2026-02-26 10:17:13 +01:00
Karthik Bhat
43bfd8615d Refactor NewTestContext to return Context instead of TContext 2026-02-26 11:27:26 +05:30
Kubernetes Prow Robot
c6d1649721
Merge pull request #137226 from tchap/selinuxwarning-reverse-index
controller/selinuxwarning/cache: Add reverse index to speed up DeletePod
2026-02-25 21:16:34 +05:30
Ondra Kupka
911a61d050 controller/selinuxwarning/cache: Add reverse index
Added podToVolumes reverse index to optimize DeletePod.
Currently we simply iterate through all the volumes and remove the pod
being deleted from there. This is inefficient and takes longer the
longer the volume list becomes.

Keeping a map pod -> volumes makes removing a pod fast. We can just jump
to the relevant volumes directly and remove the pod from there.
2026-02-25 11:38:50 +01:00
Ondra Kupka
a34456319d controller/selinuxwarning: Pre-parse SELinux label
When calling ControllerSELinuxTranslator.Conflicts(), the SELinux label
is repeatedly split into []string to detect conflicts. This causes a huge
number of allocations when there are many comparisons.

This is now made more efficient by pre-parsing the SELinux label and
storing it in podInfo as [4]string for fast comparison when needed.
2026-02-24 18:08:36 +01:00
Stephen Kitt
d42d1e3d1f
Deprecate obsolete slice utility functions
... and update users to use standard library functions.

Signed-off-by: Stephen Kitt <skitt@redhat.com>
2026-02-16 10:04:33 +01:00
胡玮文
6b4a37194a Do not get PV for externally deleting volume
Currently, we get each released PV every 15s, and in parallel. If there are a lot of released PV and we cannot finish all the get in 15s, it will starve other request by making the queue waiting for client-side throttling very long.

Even in a normal cluster, these requests are taking majority of all get requests from KCM (58% or 470 qps) in our stress test.
2026-02-16 08:51:08 +08:00
Kubernetes Prow Robot
5b63a8c68e
Merge pull request #136921 from dims/dump-from-utils
Move dump package from apimachinery to k8s.io/utils
2026-02-12 22:28:10 +05:30
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
1956f4e90d
Merge pull request #136701 from Jefftree/fix-tombstone
Add tombstone handling for serviceaccount and attachdetach controllers
2026-02-12 08:24:09 +05:30
Jefftree
334fa1cef8 Add tombstone handling for serviceaccount and attachdetach controllers 2026-02-11 16:06:29 -05:00
Kubernetes Prow Robot
f693c45c4e
Merge pull request #136775 from atombrella/feature/activate_modernize_slicessort
Enable modernize/slicessort rule
2026-02-10 05:43:57 +05:30
Mads Jensen
af5741da5f Fix cases of nilness under pkg/controller. 2026-02-07 21:16:00 +01:00
Mads Jensen
95616cecda Use slices.Sort instead of sort.Slice.
There were only two instances of this in the entire code-base. Hence,
I have enabled the modernize rule/linter in golangci-lint.
2026-02-06 22:46:08 +01:00
carlory
4bc5464553
Remove feature gate HonorPVReclaimPolicy
Signed-off-by: carlory <baofa.fan@daocloud.io>
2026-02-06 13:31:16 +08:00
Kubernetes Prow Robot
250e18904e
Merge pull request #136050 from ShaanveerS/fix-selinuxwarning-verbosity
fix(controller/volume): convert V().Error() to V().Info()
2026-01-29 21:11:58 +05:30
carlory
be0e68ba84 remove featureGate from PluginManager
Signed-off-by: carlory <baofa.fan@daocloud.io>
2026-01-19 11:35:30 +08:00
carlory
6d1afce678 remove GetHostName func from the VolumeHost interface
Signed-off-by: carlory <baofa.fan@daocloud.io>
2026-01-19 11:35:30 +08:00
Kubernetes Prow Robot
df9a0bda18
Merge pull request #133797 from tico88612/cleanup/new-fake-with-options
Replace apimachinery/pkg/watch.NewFake with NewFakeWithOptions in pkg/controller
2026-01-08 03:01:38 +05:30
ShaanveerS
977abfa047 fix(controller/volume): convert V().Error() to V().Info() for selinuxwarning 2026-01-06 08:35:26 +01:00
Kubernetes Prow Robot
7d0b8f979c
Merge pull request #135629 from jsafrane/selinux-fix-completed-pods
selinux: Fix the controller to ignore finished pods
2025-12-19 11:52:33 -08:00
Jan Safranek
80d0b0f8cc Add unit test with CSIDriver.SELinuxMount=false
Add unit test with a volume plugin that does not support SELinux. That
simulates a CSi driver whose spec.SELinuxMount is empty or false.

This requires a little refactoring, each unit test now has a flag if it
runs with a volume plugin that supports SELinux.
2025-12-19 15:01:01 +01:00
carlory
f8e8e55f1d
locked the feature-gate VolumeAttributesClass to default (true) and switch storage version from v1beta1 to v1
Signed-off-by: carlory <baofa.fan@daocloud.io>
2025-12-18 15:59:33 +08:00
Jan Safranek
e701a37a1e Use only enqueuePod to add pods to the controller queue
enqueuePod already creates the right key for a pod, it's better to reuse it
than copy the code around.
2025-12-12 11:19:13 +01:00
Jan Safranek
cfa65ceed2 Fix policy of Pods with unknown SELinux label
Reset SELinuxChangePolicy of Pods that have no SELinux label set to
Recursive. Kubelet cannot mount with `-o context=<label>`, if the label is
not known.

This fixes the e2e test error revealed by the previous commit - it changed the
e2e test to check for events when no events are expected and it found a
warning about a Pod with no label, but MountOption policy.
2025-12-12 11:17:54 +01:00
Jan Safranek
cbcf845810 Add new unit tests 2025-12-12 11:17:54 +01:00
Jan Safranek
7609325a9a Rework unit tests to builder pattern 2025-12-12 11:17:54 +01:00
Jan Safranek
fa1847ac40 selinux: Do not report conflits with finished pods
When a Pod reaches its final state (Succeeded or Failed), its volumes are
getting unmounted and therefore their SELinux mount option will not
conflict with any other pod.

Let the SELinux controller monitor "pod updated" events to see the pod is
finished
2025-12-12 11:17:51 +01:00
Jan Safranek
6666bd52b8 refactoring: use a common function to enqueue Pod
addPod and deletePod have the same implementation, merge them into
enqueuePod
2025-12-08 12:36:56 +01:00
xigang
8f1ff1d8ce Refactor PV controller to use rate-limiting queues and improve error handling
Signed-off-by: xigang <wangxigang2014@gmail.com>
2025-12-01 19:11:52 +08:00
Ondra Kupka
024382658b controller/volume/vacprotection: Improve goroutine mgmt
Make sure all threads are terminated when Run returns.
2025-11-04 23:58:15 +01:00
Ondra Kupka
e08d03b1b5 controller/volume/selinuxwarning: Improve goroutine mgmt
Make sure all threads are terminated when Run returns.
2025-11-04 23:58:15 +01:00
Ondra Kupka
1e6ad423bf controller/volume/pvprotection: Improve goroutine mgmt
Make sure all threads are terminated when Run returns.
2025-11-04 23:58:15 +01:00
Ondra Kupka
0caae6f704 controller/volume/pvcprotection: Improve goroutine mgmt
Make sure all threads are terminated when Run returns.
2025-11-04 23:58:15 +01:00
Ondra Kupka
ed74779a0f controller/volume/persistentvolume: Improve goroutine mgmt
Make sure all threads are terminated when Run returns.
2025-11-04 23:58:15 +01:00
Ondra Kupka
8eab454e38 controller/volume/expand: Improve goroutine mgmt
Make sure all threads are terminated when Run returns.
2025-11-04 23:58:15 +01:00
Ondra Kupka
27774052ab controller/volume/ephemeral: Improve goroutine mgmt
Make sure all threads are terminated when Run returns.
2025-11-04 23:58:15 +01:00
Ondra Kupka
12205df76d controller/volume/attachdetach: Improve goroutine mgmt
Make sure all threads are terminated when Run returns.
2025-11-04 23:58:15 +01:00
Aditi Gupta
af231d2153 Replace WaitForNamedCacheSync with WaitForNamedCacheSyncWithContext in pkg/controller/ 2025-09-16 14:51:34 -07:00