Commit Graph

236 Commits

Author SHA1 Message Date
Kubernetes Prow Robot
6a111bebe2
Merge pull request #116377 from kinvolk/rata/userns
KEP-127: user namespace support for stateless pods
2023-03-14 10:40:43 -07:00
杨军10092085
361e4ff0fa volume: use contextual logging 2023-03-14 08:37:30 +08:00
Rodrigo Campos
8af3cce7fe
kubelet: remove GetHostIDsForPod()
Now KEP-127 relies on idmap mounts to do the ID translation and we won't
do any chowns in the kubelet.

This patch just removes the usage of GetHostIDsForPod() in
operationexecutor to do the chown, and also removes the
GetHostIDsForPod() method from the kubelet volume interface.

Signed-off-by: Rodrigo Campos <rodrigoca@microsoft.com>
2023-03-13 22:28:03 +01:00
Sunny Song
98f944f55d Remove check for CSI driver running on node for CSI migration attach operations 2023-02-09 02:45:02 +00:00
HirazawaUi
79b799a0f3 delete unused functions in pkg/volume directory 2023-01-16 21:19:11 +08:00
Kubernetes Prow Robot
cf272cf2c6
Merge pull request #110931 from claudiubelu/adds-unittests-3
tests: Ports volume unit tests to Windows
2023-01-05 05:31:58 -08:00
weizhi
575616cc72
fix: kubelet event about unattached volumes is incorrect (#112719)
* fix kubelet event

* add ut

* fix ut
2023-01-04 01:51:59 -08:00
Claudiu Belu
96e99f564a tests: Ports volume unit tests to Windows (part 2)
Ports the metrics_du unit tests to Windows.
Ports the hostutil unit tests to Windows.
2023-01-01 00:18:31 +00:00
Jan Safranek
fc245b339b Refactor ConstructVolumeSpec
Return a struct from ConstructVolumeSpec to be able to add more fields to
it later.
2022-11-03 16:55:13 +01:00
Jan Safranek
d9f792633d Add AddPodToVolume unit tests with SELinux 2022-08-04 10:51:50 +02:00
Jan Safranek
cdb3ead5a9 Add SupportsSELinuxContextMount
Add a new call to VolumePlugin interface and change all its
implementations.

Kubelet's VolumeManager will be interested whether a volume supports
mounting with -o conext=XYZ or not to hanle SetUp() / MountDevice()
accordingly.
2022-08-04 10:51:28 +02:00
Rodrigo Campos
d07c2688fe kubelet: add GetHostIDsForPod()
In future commits we will need this to set the user/group of supported
volumes of KEP 127 - Phase 1.

Signed-off-by: Rodrigo Campos <rodrigoca@microsoft.com>
2022-08-03 19:53:22 +02:00
Kubernetes Prow Robot
369a465fae
Merge pull request #111301 from mattcary/migration-feature
Upgrade CSIMigrationGCE feature gate to GA
2022-08-02 13:58:57 -07:00
Matthew Cary
e5d387c5d6 Upgrade CSIMigrationGCE feature gate to GA
Change-Id: I620bc4913765c0d6562eb1008216a72e8b0a2970
2022-08-02 09:14:27 -07:00
Claudiu Belu
38092cb458 unittests: Fixes unit tests for Windows (part 2)
Currently, there are some unit tests that are failing on Windows due to
various reasons:

- volume mounting is a bit different on Windows: Mount will create the
  parent dirs and mklink at the volume path later (otherwise mklink will
  raise an error).
- os.Chmod is not working as intended on Windows.
- path.Dir() will always return "." on Windows, and filepath.Dir()
  should be used instead (which works correctly).
- on Windows, you can't typically run binaries without extensions. If
  the file C:\\foo.bat exists, we can still run C:\\foo because Windows
  will append one of the supported file extensions ($env:PATHEXT) to it
  and run it.
- Windows file permissions do not work the same way as the Linux ones.
- /tmp directory being used, which might not exist on Windows. Instead,
  the OS-specific Temp directory should be used.

Fixes a few other issues:

- rbd.go: Return error in a case in which an error is encountered. This
  will prevent "rbd: failed to setup" and "rbd: successfully setup" log
  messages to be logged at the same time.
2022-08-01 18:56:32 +03:00
Kubernetes Prow Robot
9ad4c5c0a0
Merge pull request #110670 from gnufied/fix-pod-deletion-terminating
Fix pod stuck in termination state when mount fails or gets skipped after kubelet restart
2022-07-27 06:31:29 -07:00
Davanum Srinivas
a9593d634c
Generate and format files
- Run hack/update-codegen.sh
- Run hack/update-generated-device-plugin.sh
- Run hack/update-generated-protobuf.sh
- Run hack/update-generated-runtime.sh
- Run hack/update-generated-swagger-docs.sh
- Run hack/update-openapi-spec.sh
- Run hack/update-gofmt.sh

Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2022-07-26 13:14:05 -04:00
Hemant Kumar
835e8ccc76 Use CheckAndMarkAsUncertainViaReconstruction for uncertain volumes
Also only remove volumes from skippedDuringReconstruction only if
volume was marked as attached.
2022-07-22 20:11:37 -04:00
Hemant Kumar
c8b85fb470 Keep track of each pod that uses a volume during reconstruction
Add tests for volume cleaning up
2022-07-22 20:04:51 -04:00
Abirdcfly
00b9ead02c cleanup: remove duplicate import
Signed-off-by: Abirdcfly <fp544037857@gmail.com>
2022-07-14 11:25:19 +08:00
Kubernetes Prow Robot
ea7c57b2ee
Merge pull request #99685 from yangjunmyfm192085/run-test24
Fix misspelling of success.
2022-05-03 17:16:47 -07:00
Hemant Kumar
dee48d3c36 Add more tests for volume recovery cases 2022-03-28 11:59:43 -04:00
Hemant Kumar
7fe33bfb7c Remove needless checks for nodestage during expansion 2022-03-10 09:55:06 -05:00
Kubernetes Prow Robot
06e107081e
Merge pull request #104732 from mengjiao-liu/remove-flag-experimental-check-node-capabilities-before-mount
kubelet: Remove the deprecated flag `--experimental-check-node-capabilities-before-mount`
2022-02-24 07:56:30 -08:00
Jan Safranek
525b8e5cd6 Rename SupportsSELinux to SELinuxRelabel
The field in fact says that the container runtime should relabel a volume
when running a container with it, it does not say that the volume supports
SELinux. For example, NFS can support SELinux, but we don't want NFS
volumes relabeled, because they can be shared among several Pods.
2022-02-16 10:54:08 +01:00
Hemant Kumar
4b589dfd7a fix flake in detach tests 2022-02-02 17:28:13 -05:00
Mengjiao Liu
beda4cafb6 kubelet: Remove the deprecated flag --experimental-check-node-capabilities-before-mount 2022-01-06 11:47:11 +08:00
Hemant Kumar
7989f27044 use node informer to check volumes attachment status before backoff
fix unit tests
2021-12-20 11:57:05 -05:00
Hemant Kumar
1ddd598d31 Implement controller and kubelet changes for recovery from resize
failures
2021-11-16 11:06:46 -05:00
Kubernetes Prow Robot
debd6c1e9e
Merge pull request #104526 from jingxu97/aug/volumeattach
Fix issue in node status updating VolumeAttached list
2021-10-05 17:30:32 -07:00
Jing Xu
69b9f9b1f0 Fix issue in node status updating VolumeAttached list
During volume detach, the following might happen in reconciler

1. Pod is deleting
2. remove volume from reportedAsAttached, so node status updater will
update volumeAttached list
3. detach failed due to some issue
4. volume is added back in reportedAsAttached
5. reconciler loops again the volume, remove volume from
reportedAsAttached
6. detach will not be trigged because exponential back off, detach call
will fail with exponential backoff error
7. another pod is added which using the same volume on the same node
8. reconciler loops and it will NOT try to tigger detach anymore

At this point, volume is still attached and in actual state, but
volumeAttached list in node status does not has this volume anymore, and
will block volume mount from kubelet.

The fix in first round is to add volume back into the volume list that
need to reported as attached at step 6 when detach call failed with
error (exponentical backoff). However this might has some performance
issue if detach fail for a while. During this time, volume will be keep
removing/adding back to node status which will cause a surge of API
calls.

So we changed to logic to check first whether operation is safe to retry which
means no pending operation or it is not in exponentical backoff time
period before calling detach. This way we can avoid keep removing/adding
volume from node status.

Change-Id: I5d4e760c880d72937d34b9d3e904ecad125f802e
2021-10-05 09:44:35 -07:00
Kubernetes Prow Robot
7d76d519ca
Merge pull request #105374 from xing-yang/update_volume_csi_owners
Bubble up to pkg/volume/OWNERS file
2021-09-30 21:17:21 -07:00
xing-yang
2833aee8ff Bubble up to pkg/volume/OWNERS file 2021-09-30 14:01:28 +00:00
vikram Jadhav
0de4397490 mockery to mockgen conversion 2021-09-25 16:15:08 +00:00
Kubernetes Prow Robot
2da4d48e6d
Merge pull request #100567 from jingxu97/mar/mark
Mark volume mount as uncertain in case of volume expansion fails
2021-07-13 22:20:26 -07:00
Jing Xu
0fa01c371c Mark volume mount as uncertain in case of volume expansion fails
should mark volume mount in actual state even if volume expansion fails so that
reconciler can tear down the volume when needed. To avoid pods start
using it, mark volume as uncertain instead of mounted.

Will add unit test after the logic is reviewed.

Change-Id: I5aebfa11ec93235a87af8f17bea7f7b1570b603d
2021-07-08 16:00:34 -07:00
Cheng Xing
0e315355df Pass FsGroup to MountDevice 2021-07-03 16:29:42 -07:00
Kubernetes Prow Robot
4ad08fa5b6
Merge pull request #101115 from wangyx1992/capital-log
cleanup: fix log capitalization in volume package
2021-05-06 03:51:16 -07:00
wangyx1992
7fe934a72d cleanup: fix log capitalization in volume package
Signed-off-by: wangyx1992 <wang.yixiang@zte.com.cn>
2021-04-14 21:58:56 +08:00
卢振兴10069964
a36c5f08f4 code cleanup: Omit redundant nil check on slices 2021-04-12 09:00:36 +08:00
JunYang
2d9b27047f Fix misspelling of success.
Signed-off-by: JunYang <yang.jun22@zte.com.cn>
2021-03-05 20:19:00 +08:00
Benjamin Elder
56e092e382 hack/update-bazel.sh 2021-02-28 15:17:29 -08:00
Chris Henzie
12e85e0e1c Extend test CSI plugin constructor to support multiple volume host types 2021-02-23 16:54:18 -08:00
Chris Henzie
1db6c30947 Interfaces for fake volume host types 2021-02-23 16:54:18 -08:00
Kubernetes Prow Robot
125a5f10a6
Merge pull request #96599 from tanjing2020/master
fix staticcheck:pkg/volume/testing
2021-01-28 18:43:40 -08:00
Chris Henzie
9d8f994d4e Separate test Kubelet and AttachDetach VolumeHost types
fakeVolumeHost previously implemented both the KubeletVolumeHost and
AttachDetachVolumeHost interfaces. This design makes it difficult to test the
CSIAttacher since it behaves differently depending on what type of
VolumeHost is supplied.
2020-12-17 15:17:04 -08:00
Chris Henzie
53cae84aea Move fakeVolumeHost logic into a separate file 2020-12-17 15:17:04 -08:00
Kubernetes Prow Robot
ce7ac8442e
Merge pull request #94599 from verult/adc-op-asw-race
Fixes Attach Detach Controller reconciler race reading ActualStateOfWorld and operation pending states
2020-12-08 16:28:53 -08:00
tanjing2020
3398401c06 fix staticcheck:pkg/volume/testing
pkg/volume/testing/testing.go:417:16: possible nil pointer derefence (SA5011)
2020-11-17 14:45:13 +08:00
Shihang Zhang
d2859cd89b plumb service account token down to csi driver 2020-11-12 09:26:43 -08:00