Commit Graph

479 Commits

Author SHA1 Message Date
Kubernetes Prow Robot
6d0aab2e38 Merge pull request #125014 from carlory/fix-120287
Remove volumesNeedReportedInUse for reconstructed volumes
2024-05-31 05:32:24 -07:00
carlory
2491560ae5 Remove volumesNeedReportedInUse for reconstructed volumes 2024-05-21 18:23:12 +08:00
bells17
8cf18d1b5c [pkg/volume] Changed to use sets.Set[string] instead of sets.String 2024-05-11 18:02:45 +09:00
Marek Siarkowicz
3ee8178768 Cleanup defer from SetFeatureGateDuringTest function call 2024-04-24 20:25:29 +02:00
Kubernetes Prow Robot
9c9a9b7c48 Merge pull request #124242 from carlory/cleanup-after-NewVolumeManagerReconstruction-ga
remove unneeded func SyncReconstructedVolume from ActualStateOfWorld
2024-04-18 03:24:50 -07:00
Kubernetes Prow Robot
da6be3b718 Merge pull request #123548 from Songjoy/fix-code
Delete a stale code comment
2024-04-18 00:01:10 -07:00
Kubernetes Prow Robot
ef2c682635 Merge pull request #122082 from carlory/remove-keep-terminated-pod-volumes
keep-terminated-pod-volumes flag on kubelet is removed
2024-04-17 23:59:54 -07:00
carlory
a6b2619274 remove unneeded func SyncReconstructedVolume from ActualStateOfWorld 2024-04-09 15:34:33 +08:00
Fabio Bertinatto
c893c48432 Use the right feature gate when updating uncertain volumes 2024-03-25 16:47:08 -03:00
Jan Safranek
c4163a9cb8 Add label with access mode to SELinux metrics
In the KEP 1710 we promised to have all SELinux metrics with access mode
label, so cluster admin is able to distinguish when RWOP volumes are
failing to mount (-> SELinuxMountReadWriteOncePod feature gate must be
disabled) or volumes with any other access modes are failing (->
SELinuxMount feature gate must be disabled).

Adding the label to kubelet is quite straightforward, there were some
changes needed in the e2e test. Now grabMetrics() collects values of all
SELinux related metrics with all labels. It only skips unrelated volume
plugins. And waitForMetricIncrease gets metric with all labels on input, so
it can check that say RWOP metric increased and RWX one did not.
2024-03-04 13:16:56 +01:00
carlory
b47c73ee26 keep-terminated-pod-volumes flag on kubelet is removed 2024-03-01 18:42:15 +08:00
宋文杰
420db6e82b delete 'TODO: move to reconstruct.go and remove old code there.' 2024-02-28 11:26:12 +08:00
Kubernetes Prow Robot
c53ac4cee4 Merge pull request #123157 from jsafrane/selinux-rwx
Add SELinuxMount feature gate
2024-02-26 12:06:39 -08:00
Jan Safranek
2e92036576 Rename "new" reconstruction just to reconstruction
There is no "old" reconstruction, so remove "_new" from the file names and
function names.
2024-02-22 13:20:38 +01:00
Jan Safranek
2a2542289f Remove usage of NewVolumeManagerReconstruction feature gate
This removes lot of code related to "old" VolumeManage reconstruction.
2024-02-22 10:21:13 +01:00
Jan Safranek
d7028a8ed5 Add SELinuxMount feature gate
The feature gate enables mounting with -o context=XYZ mount option for all
volume types, not only ReadWriteOncePod.

All SELinux label tracking & error reporting infrastructure is already in
place from SELinuxMountReadWriteOncePod feature gate. This is just a
trivial extension to all access modes.
2024-02-20 15:40:21 +01:00
Hemant Kumar
d190fa3e7d Fix race condition between external-resizer and kubelet
This fixes the race condition that could happen because
resize controller just finished volume expansiona and has only
finished marking PV and yet to mark PVC.

The workaround proposed here should not be necessary once
RecoverVolumeExpansionFailure goes GA/beta.
2024-01-31 12:23:56 -05:00
Kubernetes Prow Robot
c633ea71ed Merge pull request #122211 from gnufied/fix-uncertain-raw-block-devices
Fix device uncertain errors on reboot
2023-12-15 15:42:40 +01:00
Hemant Kumar
e706b6ba14 Use a separate function for checking if device was reconstructed 2023-12-14 11:37:47 -05:00
Kubernetes Prow Robot
8cc47b64b2 Merge pull request #121795 from carlory/cleanup-after-blockvolume-featuregate-removed
cleanup todo after feature.BlockVolume gate was removed
2023-12-13 23:54:43 +01:00
Kubernetes Prow Robot
26e2cc5299 Merge pull request #119923 from cvvz/fix-119921
fix: Mount point may become local without calling `NodePublishVolume` after node rebooting
2023-12-13 21:25:51 +01:00
Hemant Kumar
56dd5ab10f Add tests for checking of uncertain device paths 2023-12-11 17:15:16 -05:00
Hemant Kumar
ed0facacfa Fix device uncertain errors on reboot 2023-12-06 22:19:14 -05:00
carlory
1c0044594d cleanup todo after feature.BlockVolume gate was removed 2023-11-09 10:01:24 +08:00
weizhichen
b91f07008c add ut 2023-11-06 08:20:42 +00:00
Jan Safranek
e511edf11f Fix SELinux unit tests
Use device mountable volume, to make it impossible to share the same global
mount with different SELinux contexts.

And fix pod2Name to actually refer to pod2.
2023-10-25 10:43:29 +02:00
Jan Safranek
2f5903b4cf Move SELinux warning metric to be counted once per pod
volume_manager_selinux_volume_context_mismatch_warnings_total should be
counted only once per volume + pod. The previous location is evaluated
periodically, so bump the metric only when a new pod is added to volume.
2023-10-25 10:43:29 +02:00
Kubernetes Prow Robot
8453eb0c24 Merge pull request #121069 from jsafrane/ocp-add-plugin-label
Add volume plugin label to SELinux metrics
2023-10-25 08:13:20 +02:00
Chris Henzie
2dbd405583 Graduate ReadWriteOncePod to GA 2023-10-20 10:40:39 -07:00
Jan Safranek
0be5fdb5ce Add volume plugin label to SELinux metrics
Record volume plugin name when a volume in a Pod needs a different
"mount -o context" value than the actually mounted one.

We expect that NFS, CIFS and CephFS volumes would be able to mount such
volumes just fine with multiple "-o context" values.

We know that the block-volume based ones (ext4, xfs, btrfs, ...) cannot do
that.

Therefore want to distinguish the volume plugin in metrics, anything
block-volume based could break an existing application.
2023-10-09 11:18:39 +02:00
cvvz
03126c5465 add comment 2023-08-29 10:46:31 +08:00
cvvz
94d03ccc83 Squashed commit of the following:
commit d623614de31fe411f1dcb1e784472135f3ca0c5e
Merge: 8054af3b303 91344b4008
Author: cvvz <ftdchenwz@gmail.com>
Date:   Mon Aug 28 18:43:49 2023 +0800

    Merge branch 'master' of https://github.com/kubernetes/kubernetes into fix-volumemanager-logs

commit 8054af3b303e10e7b74b1ba4d3c4035f488cbdad
Author: cvvz <ftdchenwz@gmail.com>
Date:   Fri Aug 25 22:03:08 2023 +0800

    fix

commit b414972831c4e4030162ee385d8f600e1e0257ac
Author: cvvz <ftdchenwz@gmail.com>
Date:   Fri Aug 25 21:41:36 2023 +0800

    fix

commit ebea00a8dd50eb3d8859a912b464bbda5548b1d4
Author: cvvz <ftdchenwz@gmail.com>
Date:   Fri Aug 25 20:54:40 2023 +0800

    123

commit 9f6f1dbbe717fa34e1c13fec645f4c474cbf99a0
Author: cvvz <ftdchenwz@gmail.com>
Date:   Fri Aug 25 20:53:16 2023 +0800

    add MarshalLog

commit d7d2878409343df937c770d6796f8c125e18ce7a
Author: cvvz <ftdchenwz@gmail.com>
Date:   Tue Aug 8 23:57:47 2023 +0800

    fix volumemanager logs
2023-08-28 18:44:40 +08:00
cvvz
56c241783e fix 2023-08-25 19:56:54 +08:00
cvvz
ab1f97bd6e fix 2023-08-25 19:55:56 +08:00
Patrick Ohly
2472291790 api: introduce separate VolumeResourceRequirements struct
PVC and containers shared the same ResourceRequirements struct to define their
API. When resource claims were added, that struct got extended, which
accidentally also changed the PVC API. To avoid such a mistake from happening
again, PVC now uses its own VolumeResourceRequirements struct.

The `Claims` field gets removed because risk of breaking someone is low:
theoretically, YAML files which have a claims field for volumes now
get rejected when validating against the OpenAPI. Such files
have never made sense and should be fixed.

Code that uses the struct definitions needs to be updated.
2023-08-21 15:31:28 +02:00
cvvz
e40d00cf53 fix: 119921 2023-08-13 15:52:25 +08:00
Hemant Kumar
e011187114 Update code to use new generic allocatedResourceStatus field 2023-07-17 15:30:35 -04:00
Jan Safranek
354b6c409f Rename updateReconstructedFromAPIServer
to be in sync with volumesNeedUpdateFromNodeStatus.
2023-07-11 11:25:43 +02:00
Jan Safranek
1903f5aa2a Rename volumesNeedDevicePath
To volumesNeedUpdateFromNodeStatus - because both devicePath and uncertain
attach-ability needs to be fixed from node status.
2023-07-11 11:15:24 +02:00
Jan Safranek
7cd60df4aa Update volumesInUse after attachability is confirmed
node.status.volumesInUse should report only attachable volumes, therefore
it needs to wait for the reconciler to update uncertain attachability of
volumes from the API server.
2023-07-11 10:32:22 +02:00
Jan Safranek
0a2272dc68 Add uncertain state of volume attach-ability
During CSI volume reconstruction it's not possible to tell, if the volume
is attachable or not - CSIDriver instance may not be available, because
kubelet may not have connection to the API server at that time.

Adding uncertain state during reconstruction + adding a correct state when
the API server is available.
2023-07-11 10:32:22 +02:00
Jan Safranek
45aa59946a Refactor FindAttachablePluginBySpec out of CSI code path
reconstructVolume() is called when kubelet may not have connection to the
API server yet, therefore it cannot get CSIDriver instances to figure out
if a CSI volume is attachable or not.

Refactor reconstructVolume(), so it does not need
FindAttachablePluginBySpec for CSI volumes, because all of them are
deviceMountable (i.e. FindDeviceMountablePluginBySpec always returns the
CSI volume plugin).
2023-06-23 12:28:15 +02:00
Kubernetes Prow Robot
89bfdf0276 Merge pull request #117079 from qingwave/sort-volumes
kubelet/volumemanager: sort unmounted volumes in error message
2023-06-07 18:52:12 -07:00
Clayton Coleman
1f16d71185 kubelet: Rename PodManager DeletePod to RemovePod
RemovePod is more consistent within the kubelet to be the opposite
of AddPod, and the pod is not being deleted just "removed" from
tracking.
2023-05-12 12:57:27 -04:00
Clayton Coleman
166256f73e kubelet: Reduce the interface pod.Manager consumers accept
Every component that uses a pod.Manager should use a stub interface
(like we do for podWorker) that explicitly describes what methods
they use. This will allow podWorker to implement the minimum set
of manager interfaces.
2023-05-12 12:57:27 -04:00
Clayton Coleman
bb568844b6 kubelet: Separate the MirrorClient from the PodManager
The two are not coupled except accidentally. Separate them and
update callsites. This will reduce the scope of PodManager interface
to make exposing the pod worker cleaner.
2023-05-12 12:57:26 -04:00
Todd Neal
453f81d1ca kubelet: pass context to VolumeManager.WaitFor*
This allows us to return with a timeout error as soon as the
context is canceled.  Previously in cases where the mount will
never succeed pods can get stuck deleting for 2 minutes.

In the Sync*Pod methods that call VolumeManager.WaitFor*, we
must filter out wait.Interrupted errors from being logged as
they are part of control flow, not runtime problems. Any
early interruption should result in exiting the Sync*Pod method
as quickly as possible without logging intermediate errors.
2023-04-17 11:53:28 -05:00
Kubernetes Prow Robot
f46626364f Merge pull request #116833 from mpatlasov/fix-memleak-in-kubelet-volumemanager
Fix memory leak in kubelet volume_manager populator processedPods
2023-04-11 18:19:58 -07:00
Kubernetes Prow Robot
4893c66a48 Merge pull request #116134 from cvvz/fix-111933
fix: After a Node is down and take some time to get back to up again, the mount point of the evicted Pods cannot be cleaned up successfully.
2023-04-11 15:35:41 -07:00
qingwave
e1bcfd47da Sort unmounted volumes message in volume manager 2023-04-04 06:44:17 +00:00