Skip to content

Commit 565566f

Browse files
authored
Merge pull request kubernetes#85153 from codenrhoden/mount-no-exec-int
Retire mount.Exec for k8s.io/utils/exec
2 parents 072cf5b + 367f879 commit 565566f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+450
-325
lines changed

pkg/controller/volume/attachdetach/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ go_library(
4646
"//staging/src/k8s.io/client-go/util/workqueue:go_default_library",
4747
"//staging/src/k8s.io/cloud-provider:go_default_library",
4848
"//vendor/k8s.io/klog:go_default_library",
49+
"//vendor/k8s.io/utils/exec:go_default_library",
4950
],
5051
)
5152

pkg/controller/volume/attachdetach/attach_detach_controller.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ import (
4545
"k8s.io/client-go/util/workqueue"
4646
cloudprovider "k8s.io/cloud-provider"
4747
"k8s.io/klog"
48+
utilexec "k8s.io/utils/exec"
49+
4850
"k8s.io/kubernetes/pkg/controller/volume/attachdetach/cache"
4951
"k8s.io/kubernetes/pkg/controller/volume/attachdetach/metrics"
5052
"k8s.io/kubernetes/pkg/controller/volume/attachdetach/populator"
@@ -768,8 +770,8 @@ func (adc *attachDetachController) DeleteServiceAccountTokenFunc() func(types.UI
768770
}
769771
}
770772

771-
func (adc *attachDetachController) GetExec(pluginName string) mount.Exec {
772-
return mount.NewOSExec()
773+
func (adc *attachDetachController) GetExec(pluginName string) utilexec.Interface {
774+
return utilexec.New()
773775
}
774776

775777
func (adc *attachDetachController) addNodeToDswp(node *v1.Node, nodeName types.NodeName) {

pkg/controller/volume/expand/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ go_library(
3333
"//staging/src/k8s.io/client-go/util/workqueue:go_default_library",
3434
"//staging/src/k8s.io/cloud-provider:go_default_library",
3535
"//vendor/k8s.io/klog:go_default_library",
36+
"//vendor/k8s.io/utils/exec:go_default_library",
3637
],
3738
)
3839

pkg/controller/volume/expand/expand_controller.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ import (
4141
"k8s.io/client-go/tools/record"
4242
"k8s.io/client-go/util/workqueue"
4343
cloudprovider "k8s.io/cloud-provider"
44+
utilexec "k8s.io/utils/exec"
45+
4446
v1helper "k8s.io/kubernetes/pkg/apis/core/v1/helper"
4547
"k8s.io/kubernetes/pkg/controller/volume/events"
4648
"k8s.io/kubernetes/pkg/util/mount"
@@ -380,8 +382,8 @@ func (expc *expandController) GetMounter(pluginName string) mount.Interface {
380382
return nil
381383
}
382384

383-
func (expc *expandController) GetExec(pluginName string) mount.Exec {
384-
return mount.NewOSExec()
385+
func (expc *expandController) GetExec(pluginName string) utilexec.Interface {
386+
return utilexec.New()
385387
}
386388

387389
func (expc *expandController) GetHostName() string {

pkg/controller/volume/persistentvolume/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ go_library(
5656
"//staging/src/k8s.io/cloud-provider/volume/errors:go_default_library",
5757
"//staging/src/k8s.io/csi-translation-lib:go_default_library",
5858
"//vendor/k8s.io/klog:go_default_library",
59+
"//vendor/k8s.io/utils/exec:go_default_library",
5960
],
6061
)
6162

pkg/controller/volume/persistentvolume/volume_host.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ import (
2727
"k8s.io/client-go/tools/record"
2828
cloudprovider "k8s.io/cloud-provider"
2929
"k8s.io/klog"
30+
utilexec "k8s.io/utils/exec"
31+
3032
"k8s.io/kubernetes/pkg/util/mount"
3133
vol "k8s.io/kubernetes/pkg/volume"
3234
"k8s.io/kubernetes/pkg/volume/util/subpath"
@@ -116,8 +118,8 @@ func (ctrl *PersistentVolumeController) DeleteServiceAccountTokenFunc() func(typ
116118
}
117119
}
118120

119-
func (adc *PersistentVolumeController) GetExec(pluginName string) mount.Exec {
120-
return mount.NewOSExec()
121+
func (adc *PersistentVolumeController) GetExec(pluginName string) utilexec.Interface {
122+
return utilexec.New()
121123
}
122124

123125
func (ctrl *PersistentVolumeController) GetNodeLabels() (map[string]string, error) {

pkg/kubelet/volume_host.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ import (
3434
"k8s.io/client-go/tools/cache"
3535
"k8s.io/client-go/tools/record"
3636
cloudprovider "k8s.io/cloud-provider"
37+
utilexec "k8s.io/utils/exec"
38+
3739
"k8s.io/kubernetes/pkg/features"
3840
"k8s.io/kubernetes/pkg/kubelet/configmap"
3941
"k8s.io/kubernetes/pkg/kubelet/secret"
@@ -86,7 +88,7 @@ func NewInitializedVolumePluginMgr(
8688
informerFactory: informerFactory,
8789
csiDriverLister: csiDriverLister,
8890
csiDriversSynced: csiDriversSynced,
89-
exec: mount.NewOSExec(),
91+
exec: utilexec.New(),
9092
}
9193

9294
if err := kvh.volumePluginMgr.InitPlugins(plugins, prober, kvh); err != nil {
@@ -115,7 +117,7 @@ type kubeletVolumeHost struct {
115117
informerFactory informers.SharedInformerFactory
116118
csiDriverLister storagelisters.CSIDriverLister
117119
csiDriversSynced cache.InformerSynced
118-
exec mount.Exec
120+
exec utilexec.Interface
119121
}
120122

121123
func (kvh *kubeletVolumeHost) SetKubeletError(err error) {
@@ -271,6 +273,6 @@ func (kvh *kubeletVolumeHost) GetEventRecorder() record.EventRecorder {
271273
return kvh.kubelet.recorder
272274
}
273275

274-
func (kvh *kubeletVolumeHost) GetExec(pluginName string) mount.Exec {
276+
func (kvh *kubeletVolumeHost) GetExec(pluginName string) utilexec.Interface {
275277
return kvh.exec
276278
}

pkg/util/mount/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ go_library(
44
name = "go_default_library",
55
srcs = [
66
"doc.go",
7-
"exec.go",
87
"fake_exec.go",
98
"fake_mounter.go",
109
"mount.go",
@@ -75,6 +74,7 @@ go_test(
7574
],
7675
embed = [":go_default_library"],
7776
deps = [
77+
"//vendor/k8s.io/utils/exec:go_default_library",
7878
"//vendor/k8s.io/utils/exec/testing:go_default_library",
7979
] + select({
8080
"@io_bazel_rules_go//go/platform:windows": [

pkg/util/mount/exec.go

Lines changed: 0 additions & 36 deletions
This file was deleted.

pkg/util/mount/mount.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ import (
2323
"os"
2424
"path/filepath"
2525
"strings"
26+
27+
utilexec "k8s.io/utils/exec"
2628
)
2729

2830
const (
@@ -53,13 +55,6 @@ type Interface interface {
5355
GetMountRefs(pathname string) ([]string, error)
5456
}
5557

56-
// Exec is an interface for executing commands on systems.
57-
type Exec interface {
58-
// Run executes a command and returns its stdout + stderr combined in one
59-
// stream.
60-
Run(cmd string, args ...string) ([]byte, error)
61-
}
62-
6358
// Compile-time check to ensure all Mounter implementations satisfy
6459
// the mount interface.
6560
var _ Interface = &Mounter{}
@@ -79,7 +74,7 @@ type MountPoint struct {
7974
// mounts it otherwise the device is formatted first then mounted.
8075
type SafeFormatAndMount struct {
8176
Interface
82-
Exec
77+
Exec utilexec.Interface
8378
}
8479

8580
// FormatAndMount formats the given disk, if needed, and mounts it.

0 commit comments

Comments
 (0)