Commit Graph

110 Commits

Author SHA1 Message Date
Hemant Kumar
eb071c2755 Fix code to process volumes which were skipped during reconstruction 2022-07-22 20:04:51 -04:00
Jonathan Dobson
daa181d92e kubelet: fix volume reconstruction for CSI ephemeral volumes
This resolves a couple of issues for CSI volume reconstruction.
1. IsLikelyNotMountPoint is known not to work for bind mounts and was
   causing problems for subpaths and hostpath volumes.
2. Inline volumes were failing reconstruction due to calling
   GetVolumeName, which only works when there is a PV spec.
2022-06-01 14:22:57 -06:00
Davanum Srinivas
50bea1dad8
Move from k8s.gcr.io to registry.k8s.io
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2022-05-31 10:16:53 -04:00
Hemant Kumar
a99466ca86 check existing size before querying new size from api-server 2022-03-28 11:32:49 -04:00
Hemant Kumar
ed217f4140 rename SetVolumeSize to InitializeVolumeSize 2022-03-28 11:32:49 -04:00
Hemant Kumar
7a43406138 Do not update PVC if it already has updated size 2022-03-28 11:32:49 -04:00
Hemant Kumar
e4f62d6c41 Modify code to use new interface functions 2022-03-28 11:32:49 -04:00
Hemant Kumar
10f91a9951 Refactor volume attach code 2022-03-28 11:32:49 -04:00
Patrick Ohly
9eaa2dc554 avoid klog Info calls without verbosity
In the following code pattern, the log message will get logged with v=0 in JSON
output although conceptually it has a higher verbosity:

   if klog.V(5).Enabled() {
       klog.Info("hello world")
   }

Having the actual verbosity in the JSON output is relevant, for example for
filtering out only the important info messages. The solution is to use
klog.V(5).Info or something similar.

Whether the outer if is necessary at all depends on how complex the parameters
are. The return value of klog.V can be captured in a variable and be used
multiple times to avoid the overhead for that function call and to avoid
repeating the verbosity level.
2022-01-12 07:48:36 +01:00
Kubernetes Prow Robot
d1a5513cb0
Merge pull request #107006 from gnufied/add-total-mount-time-metrics
Add metric for reporting total end-to-end mount time
2022-01-07 06:19:31 -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
55b5e6dc33 Add metric for reporting total end-to-end mount time
This metric includes time spent in waiting for devices to be attached,
any RPC calls and performing recursive chown etc.
2021-12-13 16:23:01 -05: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
Chris Henzie
2b98f8edc7 Enforce ReadWriteOncePod access mode during mount 2021-06-28 21:25:37 -07:00
Kubernetes Prow Robot
71fea80155
Merge pull request #92692 from Pingan2017/verify-controller-attach
fix bug for verify attached volume loop
2020-11-04 05:22:04 -08:00
Pingan2017
a1063c924b fix loop bug for verify attached volume 2020-10-22 13:58:40 +08:00
lala123912
7594702b22 modify static check
fix format
2020-09-23 19:27:24 +08:00
Srini Brahmaroutu
fbe5daed73 Change code to use staging/k8s.io/mount-utils 2020-09-16 21:51:24 -07:00
Hemant Kumar
b8c0435bc2 Handle volume-in-use error 2020-07-11 09:02:58 -04:00
Davanum Srinivas
442a69c3bd
switch over k/k to use klog v2
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2020-05-16 07:54:27 -04:00
Cheng Xing
ef3d66b98b Parallelize attach operations across different nodes for volumes that allow multi-attach 2020-03-05 22:22:05 -08:00
Jordan Liggitt
cd1059e3c4 Revert "Merge pull request #87258 from verult/slow-rxm-attach"
This reverts commit 15c3f1b119, reversing
changes made to 52d7614a8c.
2020-01-29 14:58:32 -05:00
Cheng Xing
c6a03fa5be Parallelize attach operations across different nodes for volumes that allow multi-attach 2020-01-27 15:02:25 -08:00
Hemant Kumar
309c6f863a Handle the case of remounts correctly 2019-12-02 12:09:38 -05:00
Hemant Kumar
5feea93163 Rename MarkVolumeMountedOpts to MarkVolumeOpts
Also remove VolumeNotMounted state
2019-12-02 12:09:38 -05:00
Hemant Kumar
34a6007dfe Add code to mark volume as uncertain
Update bazel files
Add tests for volume mounts in uncertain state
2019-12-02 12:01:40 -05:00
Hemant Kumar
a795f3de88 Add code for introducing uncertain state of mounts
Add a comment about volumestate
2019-12-02 11:57:40 -05:00
Travis Rhoden
0c5c3d8bb9
Remove pkg/util/mount (moved out of tree)
This patch removes pkg/util/mount completely, and replaces it with the
mount package now located at k8s.io/utils/mount. The code found at
k8s.io/utils/mount was moved there from pkg/util/mount, so the code is
identical, just no longer in-tree to k/k.
2019-11-15 08:29:12 -07:00
Deep Debroy
129f15328b Disable in-tree plugins migrated to CSI
Signed-off-by: Deep Debroy <ddebroy@docker.com>
2019-11-14 17:28:21 -08:00
David Zhu
92cb06a2e7 Refactor CSI Translation Library into a struct that is injected into various components to simplify unit testing in future 2019-09-27 12:59:53 -07:00
Kubernetes Prow Robot
60bc301889
Merge pull request #81613 from tedyu/op-exec-vol-cont
Continue with remaining volumeAttached's in VerifyVolumesAreAttached
2019-09-10 14:31:33 -07:00
Ted Yu
8819a4b6b4 Continue with remaining volumeAttached's in VerifyVolumesAreAttached 2019-09-09 15:52:53 -07:00
Travis Rhoden
935c23f2ad
Move HostUtil to pkg/volume/util/hostutil
This patch moves the HostUtil functionality from the util/mount package
to the volume/util/hostutil package.

All `*NewHostUtil*` calls are changed to return concrete types instead
of interfaces.

All callers are changed to use the `*NewHostUtil*` methods instead of
directly instantiating the concrete types.
2019-08-30 10:14:42 -06:00
Masaki Kimura
c130b77a48 Move nil check for mapperPlugin earlier in reconstructVolume 2019-08-01 20:36:21 +00:00
Jan Safranek
bab81b809b Don't create mounter when reconstructing block volume
CSI mounter will create a new directory + json for a filesystem volume,
leading to even more orphaned files/directories.
2019-08-01 20:04:10 +00:00
David Zhu
290a7f12ce Add migration shim for VerifyVolumesAreAttached and BulkVolumeVerify 2019-07-23 12:57:47 -07:00
Travis Rhoden
be7da5052f Refactor pkg/util/mount to be more reusable
This patch refactors pkg/util/mount to be more usable outside of
Kubernetes. This is done by refactoring mount.Interface to only contain
methods that are not K8s specific. Methods that are not relevant to
basic mount activities but still have OS-specific implementations are
now found in a mount.HostUtils interface.
2019-06-14 09:35:18 -06:00
Hemant Kumar
0f62e3fbe8 Make language of error msgs and func names consistent: ExpandVolumeInUse
change feature flag
Fix the e2e test for online and offline expansion
2019-06-03 12:26:56 -04:00
Robert Krawitz
f8661d6240 Use xfs_quota command to apply quotas 2019-05-29 15:12:28 -04:00
Robert Krawitz
448e0c44c6 Apply quotas via syscalls using cgo. 2019-05-29 15:12:28 -04:00
Hemant Kumar
673773cbde check for pvc objects 2019-05-16 12:23:52 -04:00
Matthew Wong
c16a555654 Use workqueue model in expand controller
Add a test for patch creation
2019-05-14 16:42:06 -04:00
Mucahit Kurt
1c1da755dc reduce event spam for function GenerateAttachVolumeFunc
Signed-off-by: Mucahit Kurt <mucahitkurt@gmail.com>
2019-04-24 23:45:28 +03:00
Yecheng Fu
8940976602 Distinguish volume path with mount path 2019-02-27 19:31:26 +08:00
Kubernetes Prow Robot
54c4428eb4
Merge pull request #71276 from jingxu97/Oct/uncertain
Handle failed attach operation leave uncertain volume attach state
2019-01-17 22:52:57 -08:00
Jing Xu
7bac6ca73a Address comments
This commit addressed the comment and also add a unit test.
2019-01-11 10:57:37 -08:00
saad-ali
2251bf0c21 Ensure volume mount err checking done inside op
Ensure volume mount error checking is done inside the operation so that
failures get handled with exponential backoff, etc.
2018-11-29 16:52:24 -08:00
Jing Xu
47331cf0a2 WIP: Handle failed attach operation leave uncertain volume attach state
This PR fixes issue #32727.

When an attach operation fails, it is still possible that the volume
will be attached to the node later. This PR adds the logic to record the
volume to node with attached state no matter whether the operation
succedded or not. If the operation fails, mark the attached state to
false. If the operation succeeded, mark the attached state to true. The
reconciler will still issue attach operation until it returns
successfully. If the pod is removed in the mean time, the reconciler
will issue detach operations for all the volumes no matter what is the
attached state.
2018-11-19 17:19:10 -08:00
Davanum Srinivas
954996e231
Move from glog to klog
- Move from the old github.com/golang/glog to k8s.io/klog
- klog as explicit InitFlags() so we add them as necessary
- we update the other repositories that we vendor that made a similar
change from glog to klog
  * github.com/kubernetes/repo-infra
  * k8s.io/gengo/
  * k8s.io/kube-openapi/
  * github.com/google/cadvisor
- Entirely remove all references to glog
- Fix some tests by explicit InitFlags in their init() methods

Change-Id: I92db545ff36fcec83afe98f550c9e630098b3135
2018-11-10 07:50:31 -05:00
NickrenREN
c7e4466873 attacher/detacher refactor 2018-08-14 11:12:41 +08:00