From e92dc8d9be385346534221fa67c7132a2a284a15 Mon Sep 17 00:00:00 2001 From: Jonathan Dobson Date: Fri, 23 Apr 2021 16:14:10 -0600 Subject: [PATCH 1/3] Deprecate removal of CSI nodepublish path by kubelet (#101332) --- pkg/volume/csi/csi_mounter.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/volume/csi/csi_mounter.go b/pkg/volume/csi/csi_mounter.go index f96e93ce512..eff955877bb 100644 --- a/pkg/volume/csi/csi_mounter.go +++ b/pkg/volume/csi/csi_mounter.go @@ -426,6 +426,9 @@ func removeMountDir(plug *csiPlugin, mountPath string) error { } if !mnt { klog.V(4).Info(log("dir not mounted, deleting it [%s]", mountPath)) + // Deprecation: Removal of this mountPath directory MUST be done by + // the CSI plugin according to the spec. This will no longer be done + // directly as part of TearDown by the kubelet in the future. if err := os.Remove(mountPath); err != nil && !os.IsNotExist(err) { return errors.New(log("failed to remove dir [%s]: %v", mountPath, err)) } From 75a796641480cd89133b80798e91fe9e4dcc6568 Mon Sep 17 00:00:00 2001 From: Jonathan Dobson Date: Tue, 27 Apr 2021 11:40:12 -0600 Subject: [PATCH 2/3] move deprecation comment to TearDownAt function --- pkg/volume/csi/csi_mounter.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pkg/volume/csi/csi_mounter.go b/pkg/volume/csi/csi_mounter.go index eff955877bb..4c131695d4b 100644 --- a/pkg/volume/csi/csi_mounter.go +++ b/pkg/volume/csi/csi_mounter.go @@ -365,7 +365,9 @@ func (c *csiMountMgr) TearDownAt(dir string) error { return errors.New(log("mounter.TearDownAt failed: %v", err)) } - // clean mount point dir + // Deprecation: Removal of this mount directory MUST be done by + // the CSI plugin according to the spec. This will no longer be done + // directly as part of TearDown by the kubelet in the future. if err := removeMountDir(c.plugin, dir); err != nil { return errors.New(log("mounter.TearDownAt failed to clean mount dir [%s]: %v", dir, err)) } @@ -426,9 +428,6 @@ func removeMountDir(plug *csiPlugin, mountPath string) error { } if !mnt { klog.V(4).Info(log("dir not mounted, deleting it [%s]", mountPath)) - // Deprecation: Removal of this mountPath directory MUST be done by - // the CSI plugin according to the spec. This will no longer be done - // directly as part of TearDown by the kubelet in the future. if err := os.Remove(mountPath); err != nil && !os.IsNotExist(err) { return errors.New(log("failed to remove dir [%s]: %v", mountPath, err)) } From 260426bf445935d760cc09679637c19b1017e544 Mon Sep 17 00:00:00 2001 From: Jonathan Dobson Date: Tue, 27 Apr 2021 17:52:40 -0600 Subject: [PATCH 3/3] clarify deprecation comment --- pkg/volume/csi/csi_mounter.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/volume/csi/csi_mounter.go b/pkg/volume/csi/csi_mounter.go index 4c131695d4b..7e98dea45ca 100644 --- a/pkg/volume/csi/csi_mounter.go +++ b/pkg/volume/csi/csi_mounter.go @@ -365,9 +365,11 @@ func (c *csiMountMgr) TearDownAt(dir string) error { return errors.New(log("mounter.TearDownAt failed: %v", err)) } - // Deprecation: Removal of this mount directory MUST be done by - // the CSI plugin according to the spec. This will no longer be done - // directly as part of TearDown by the kubelet in the future. + // Deprecation: Removal of target_path provided in the NodePublish RPC call + // (in this case location `dir`) MUST be done by the CSI plugin according + // to the spec. This will no longer be done directly as part of TearDown + // by the kubelet in the future. Kubelet will only be responsible for + // removal of json data files it creates and parent directories. if err := removeMountDir(c.plugin, dir); err != nil { return errors.New(log("mounter.TearDownAt failed to clean mount dir [%s]: %v", dir, err)) }