Commit Graph

489 Commits

Author SHA1 Message Date
carlory
3836d58744 fix handle terminating pvc when kubelet rebuild dsw
Signed-off-by: carlory <baofa.fan@daocloud.io>
2025-03-10 18:59:59 +08:00
carlory
04f5b20388 kubelet: Fix the volume manager did't check the device mount state in the actual state of the world before marking the volume as detached. It may cause a pod to be stuck in the Terminating state due to the above issue when it was deleted. 2024-12-03 09:47:51 +08:00
carlory
c4851c64a0 remove volumeoptions from VolumePlugin and BlockVolumePlugin 2024-07-24 14:07:02 +08:00
Kubernetes Prow Robot
107f621462 Merge pull request #126108 from gnufied/changes-volume-recovery
Reduce state changes when expansion fails and mark certain failures as infeasible
2024-07-23 13:30:56 -07:00
Kubernetes Prow Robot
d7194eb370 Merge pull request #124884 from carlory/report-event-when-kubelet-attach-failed
report an event to pod if kubelet does attach operation failed
2024-07-23 09:20:43 -07:00
Hemant Kumar
c8d9863a3e Add new type for infeasible errors 2024-07-15 10:14:57 -04:00
Hemant Kumar
cbda088905 Add functions for storing volume as failed with final error 2024-07-12 15:14:46 -04:00
Matthieu MOREL
f014b754fb fix: enable empty and len rules from testifylint on pkg package
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>

Co-authored-by: Patrick Ohly <patrick.ohly@intel.com>
2024-07-06 23:15:43 +00:00
Kubernetes Prow Robot
a8d51f4f05 Use a generic Set instead of a specified Set in kubelet
Signed-off-by: bzsuni <bingzhe.sun@daocloud.io>
2024-06-04 14:25:43 +08:00
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
carlory
02b158055d report an event if kubelet does attach operation failed when kubelet is running with --enable-controller-attach-detach=false 2024-05-15 18:40:29 +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