Skip to content

Commit ed899db

Browse files
Merge pull request #13162 from spowelljr/removeMountModeFlag
mount: Remove `--mode` flag
2 parents 77ffb8b + 54c615b commit ed899db

File tree

17 files changed

+7
-70
lines changed

17 files changed

+7
-70
lines changed

Diff for: cmd/minikube/cmd/mount.go

-6
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ const (
5151
mountGIDDescription = "Default group id used for the mount"
5252
defaultMountIP = ""
5353
mountIPDescription = "Specify the ip that the mount should be setup on"
54-
defaultMountMode = 0o755
55-
mountModeDescription = "File permissions used for the mount"
5654
defaultMountMSize = 262144
5755
mountMSizeDescription = "The number of bytes to use for 9p packet payload"
5856
mountOptionsDescription = "Additional mount options, such as cache=fscache"
@@ -79,7 +77,6 @@ var (
7977
gid string
8078
mSize int
8179
options []string
82-
mode uint
8380
)
8481

8582
// supportedFilesystems is a map of filesystem types to not warn against.
@@ -166,7 +163,6 @@ var mountCmd = &cobra.Command{
166163
Version: mountVersion,
167164
MSize: mSize,
168165
Port: port,
169-
Mode: os.FileMode(mode),
170166
Options: map[string]string{},
171167
}
172168

@@ -194,7 +190,6 @@ var mountCmd = &cobra.Command{
194190
out.Infof("Group ID: {{.groupID}}", out.V{"groupID": cfg.GID})
195191
out.Infof("Version: {{.version}}", out.V{"version": cfg.Version})
196192
out.Infof("Message Size: {{.size}}", out.V{"size": cfg.MSize})
197-
out.Infof("Permissions: {{.octalMode}} ({{.writtenMode}})", out.V{"octalMode": fmt.Sprintf("%o", cfg.Mode), "writtenMode": cfg.Mode})
198193
out.Infof("Options: {{.options}}", out.V{"options": cfg.Options})
199194
out.Infof("Bind Address: {{.Address}}", out.V{"Address": net.JoinHostPort(bindIP, fmt.Sprint(port))})
200195

@@ -245,7 +240,6 @@ func init() {
245240
mountCmd.Flags().BoolVar(&isKill, "kill", false, "Kill the mount process spawned by minikube start")
246241
mountCmd.Flags().StringVar(&uid, constants.MountUIDFlag, defaultMountUID, mountUIDDescription)
247242
mountCmd.Flags().StringVar(&gid, constants.MountGIDFlag, defaultMountGID, mountGIDDescription)
248-
mountCmd.Flags().UintVar(&mode, constants.MountModeFlag, defaultMountMode, mountModeDescription)
249243
mountCmd.Flags().StringSliceVar(&options, constants.MountOptionsFlag, defaultMountOptions(), mountOptionsDescription)
250244
mountCmd.Flags().IntVar(&mSize, constants.MountMSizeFlag, defaultMountMSize, mountMSizeDescription)
251245
}

Diff for: cmd/minikube/cmd/start_flags.go

-11
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ const (
8686
mount9PVersion = "mount-9p-version"
8787
mountGID = "mount-gid"
8888
mountIPFlag = "mount-ip"
89-
mountMode = "mount-mode"
9089
mountMSize = "mount-msize"
9190
mountOptions = "mount-options"
9291
mountPortFlag = "mount-port"
@@ -165,7 +164,6 @@ func initMinikubeFlags() {
165164
startCmd.Flags().String(mount9PVersion, defaultMount9PVersion, mount9PVersionDescription)
166165
startCmd.Flags().String(mountGID, defaultMountGID, mountGIDDescription)
167166
startCmd.Flags().String(mountIPFlag, defaultMountIP, mountIPDescription)
168-
startCmd.Flags().Uint(mountMode, defaultMountMode, mountModeDescription)
169167
startCmd.Flags().Int(mountMSize, defaultMountMSize, mountMSizeDescription)
170168
startCmd.Flags().StringSlice(mountOptions, defaultMountOptions(), mountOptionsDescription)
171169
startCmd.Flags().Uint16(mountPortFlag, defaultMountPort, mountPortDescription)
@@ -487,7 +485,6 @@ func generateNewConfigFromFlags(cmd *cobra.Command, k8sVersion string, drvName s
487485
Mount9PVersion: viper.GetString(mount9PVersion),
488486
MountGID: viper.GetString(mountGID),
489487
MountIP: viper.GetString(mountIPFlag),
490-
MountMode: viper.GetUint(mountMode),
491488
MountMSize: viper.GetInt(mountMSize),
492489
MountOptions: viper.GetStringSlice(mountOptions),
493490
MountPort: uint16(viper.GetUint(mountPortFlag)),
@@ -705,7 +702,6 @@ func updateExistingConfigFromFlags(cmd *cobra.Command, existing *config.ClusterC
705702
updateStringFromFlag(cmd, &cc.Mount9PVersion, mount9PVersion)
706703
updateStringFromFlag(cmd, &cc.MountGID, mountGID)
707704
updateStringFromFlag(cmd, &cc.MountIP, mountIPFlag)
708-
updateUintFromFlag(cmd, &cc.MountMode, mountMode)
709705
updateIntFromFlag(cmd, &cc.MountMSize, mountMSize)
710706
updateStringSliceFromFlag(cmd, &cc.MountOptions, mountOptions)
711707
updateUint16FromFlag(cmd, &cc.MountPort, mountPortFlag)
@@ -782,13 +778,6 @@ func updateDurationFromFlag(cmd *cobra.Command, v *time.Duration, key string) {
782778
}
783779
}
784780

785-
// updateUintFromFlag will update the existing uint from the flag.
786-
func updateUintFromFlag(cmd *cobra.Command, v *uint, key string) {
787-
if cmd.Flags().Changed(key) {
788-
*v = viper.GetUint(key)
789-
}
790-
}
791-
792781
// updateUint16FromFlag will update the existing uint16 from the flag.
793782
func updateUint16FromFlag(cmd *cobra.Command, v *uint16, key string) {
794783
if cmd.Flags().Changed(key) {

Diff for: pkg/minikube/cluster/mount.go

+1-12
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ package cluster
1818

1919
import (
2020
"fmt"
21-
"os"
2221
"os/exec"
23-
"runtime"
2422
"sort"
2523
"strconv"
2624
"strings"
@@ -44,8 +42,6 @@ type MountConfig struct {
4442
MSize int
4543
// Port is the port to connect to on the host
4644
Port int
47-
// Mode is the file permissions to set the mount to (octals)
48-
Mode os.FileMode
4945
// Extra mount options. See https://www.kernel.org/doc/Documentation/filesystems/9p.txt
5046
Options map[string]string
5147
}
@@ -82,7 +78,7 @@ func Mount(r mountRunner, source string, target string, c *MountConfig) error {
8278
return &MountError{ErrorType: MountErrorUnknown, UnderlyingError: errors.Wrap(err, "umount")}
8379
}
8480

85-
if _, err := r.RunCmd(exec.Command("/bin/bash", "-c", fmt.Sprintf("sudo mkdir -m %o -p %s", c.Mode, target))); err != nil {
81+
if _, err := r.RunCmd(exec.Command("/bin/bash", "-c", fmt.Sprintf("sudo mkdir -p %s", target))); err != nil {
8682
return &MountError{ErrorType: MountErrorUnknown, UnderlyingError: errors.Wrap(err, "create folder pre-mount")}
8783
}
8884

@@ -94,13 +90,6 @@ func Mount(r mountRunner, source string, target string, c *MountConfig) error {
9490
return &MountError{ErrorType: MountErrorUnknown, UnderlyingError: errors.Wrapf(err, "mount with cmd %s ", rr.Command())}
9591
}
9692

97-
// skipping macOS due to https://github.com/kubernetes/minikube/issues/13070
98-
if runtime.GOOS != "darwin" {
99-
if _, err := r.RunCmd(exec.Command("/bin/bash", "-c", fmt.Sprintf("sudo chmod %o %s", c.Mode, target))); err != nil {
100-
return &MountError{ErrorType: MountErrorChmod, UnderlyingError: errors.Wrap(err, "chmod folder")}
101-
}
102-
}
103-
10493
klog.Infof("mount successful: %q", rr.Output())
10594
return nil
10695
}

Diff for: pkg/minikube/cluster/mount_test.go

+4-5
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ limitations under the License.
1717
package cluster
1818

1919
import (
20-
"os"
2120
"testing"
2221

2322
"github.com/google/go-cmp/cmp"
@@ -35,21 +34,21 @@ func TestMntCmd(t *testing.T) {
3534
name: "simple",
3635
source: "src",
3736
target: "target",
38-
cfg: &MountConfig{Type: "9p", Mode: os.FileMode(0700)},
37+
cfg: &MountConfig{Type: "9p"},
3938
want: "sudo mount -t 9p -o dfltgid=0,dfltuid=0,trans=tcp src target",
4039
},
4140
{
4241
name: "named uid",
4342
source: "src",
4443
target: "target",
45-
cfg: &MountConfig{Type: "9p", Mode: os.FileMode(0700), UID: "docker", GID: "docker"},
44+
cfg: &MountConfig{Type: "9p", UID: "docker", GID: "docker"},
4645
want: "sudo mount -t 9p -o dfltgid=$(grep ^docker: /etc/group | cut -d: -f3),dfltuid=$(id -u docker),trans=tcp src target",
4746
},
4847
{
4948
name: "everything",
5049
source: "10.0.0.1",
5150
target: "/target",
52-
cfg: &MountConfig{Type: "9p", Mode: os.FileMode(0777), UID: "82", GID: "72", Version: "9p2000.u", Options: map[string]string{
51+
cfg: &MountConfig{Type: "9p", UID: "82", GID: "72", Version: "9p2000.u", Options: map[string]string{
5352
"noextend": "",
5453
"cache": "fscache",
5554
}},
@@ -59,7 +58,7 @@ func TestMntCmd(t *testing.T) {
5958
name: "version-conflict",
6059
source: "src",
6160
target: "tgt",
62-
cfg: &MountConfig{Type: "9p", Mode: os.FileMode(0700), Version: "9p2000.u", Options: map[string]string{
61+
cfg: &MountConfig{Type: "9p", Version: "9p2000.u", Options: map[string]string{
6362
"version": "9p2000.L",
6463
}},
6564
want: "sudo mount -t 9p -o dfltgid=0,dfltuid=0,trans=tcp,version=9p2000.L src tgt",

Diff for: pkg/minikube/config/types.go

-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ type ClusterConfig struct {
9090
Mount9PVersion string
9191
MountGID string
9292
MountIP string
93-
MountMode uint
9493
MountMSize int
9594
MountOptions []string
9695
MountPort uint16

Diff for: pkg/minikube/constants/constants.go

-2
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,6 @@ const (
133133
MountIPFlag = "ip"
134134
// MountMSizeFlag is the flag used to set the mount msize
135135
MountMSizeFlag = "msize"
136-
// MountModeFlag is the flag used to set the mount mode
137-
MountModeFlag = "mode"
138136
// MountOptionsFlag is the flag used to set the mount options
139137
MountOptionsFlag = "options"
140138
// MountPortFlag is the flag used to set the mount port

Diff for: pkg/minikube/node/config.go

-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ func generateMountArgs(profile string, cc config.ClusterConfig) []string {
9595
{constants.MountGIDFlag, cc.MountGID},
9696
{constants.MountIPFlag, cc.MountIP},
9797
{constants.MountMSizeFlag, fmt.Sprintf("%d", cc.MountMSize)},
98-
{constants.MountModeFlag, fmt.Sprintf("%d", cc.MountMode)},
9998
{constants.MountPortFlag, fmt.Sprintf("%d", cc.MountPort)},
10099
{constants.MountTypeFlag, cc.MountType},
101100
{constants.MountUIDFlag, cc.MountUID},

Diff for: site/content/en/docs/commands/mount.md

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ minikube mount [flags] <source directory>:<target directory>
2424
--gid string Default group id used for the mount (default "docker")
2525
--ip string Specify the ip that the mount should be setup on
2626
--kill Kill the mount process spawned by minikube start
27-
--mode uint File permissions used for the mount (default 493)
2827
--msize int The number of bytes to use for 9p packet payload (default 262144)
2928
--options strings Additional mount options, such as cache=fscache
3029
--port uint16 Specify the port that the mount should be setup on, where 0 means any free port.

Diff for: site/content/en/docs/commands/start.md

-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ minikube start [flags]
8080
--mount-9p-version string Specify the 9p version that the mount should use (default "9p2000.L")
8181
--mount-gid string Default group id used for the mount (default "docker")
8282
--mount-ip string Specify the ip that the mount should be setup on
83-
--mount-mode uint File permissions used for the mount (default 493)
8483
--mount-msize int The number of bytes to use for 9p packet payload (default 262144)
8584
--mount-options strings Additional mount options, such as cache=fscache
8685
--mount-port uint16 Specify the port that the mount should be setup on, where 0 means any free port.

Diff for: test/integration/mount_start_test.go

+2-23
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,13 @@ import (
2323
"context"
2424
"fmt"
2525
"os/exec"
26-
"runtime"
2726
"strings"
2827
"testing"
2928
)
3029

3130
const (
3231
mountGID = "0"
3332
mountMSize = "6543"
34-
mountMode = "0777"
3533
mountPort = "46464"
3634
mountUID = "0"
3735
)
@@ -83,7 +81,7 @@ func TestMountStart(t *testing.T) {
8381
func validateStartWithMount(ctx context.Context, t *testing.T, profile string) {
8482
defer PostMortemLogs(t, profile)
8583

86-
args := []string{"start", "-p", profile, "--memory=2048", "--mount", "--mount-gid", mountGID, "--mount-msize", mountMSize, "--mount-mode", mountMode, "--mount-port", mountPort, "--mount-uid", mountUID}
84+
args := []string{"start", "-p", profile, "--memory=2048", "--mount", "--mount-gid", mountGID, "--mount-msize", mountMSize, "--mount-port", mountPort, "--mount-uid", mountUID}
8785
args = append(args, StartArgs()...)
8886
rr, err := Run(t, exec.CommandContext(ctx, Target(), args...))
8987
if err != nil {
@@ -105,27 +103,8 @@ func validateMount(ctx context.Context, t *testing.T, profile string) {
105103
}
106104

107105
// Docker has it's own mounting method, it doesn't respect the mounting flags
108-
if DockerDriver() {
109-
return
110-
}
111-
112-
// skipping macOS due to https://github.com/kubernetes/minikube/issues/13070
113-
if runtime.GOOS != "darwin" {
114-
args = sshArgs
115-
args = append(args, "stat", "--format", "'%a'", "/minikube-host")
116-
rr, err = Run(t, exec.CommandContext(ctx, Target(), args...))
117-
if err != nil {
118-
t.Fatalf("failed to get directory mode: %v", err)
119-
}
120-
121-
const want = "777"
122-
if !strings.Contains(rr.Output(), want) {
123-
t.Errorf("wanted mode to be %q; got: %q", want, rr.Output())
124-
}
125-
}
126-
127106
// We can't get the mount details with Hyper-V
128-
if HyperVDriver() {
107+
if DockerDriver() || HyperVDriver() {
129108
return
130109
}
131110

Diff for: translations/de.json

-1
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,6 @@
444444
"Paused {{.count}} containers": "",
445445
"Paused {{.count}} containers in: {{.namespaces}}": "",
446446
"Pausing node {{.name}} ... ": "",
447-
"Permissions: {{.octalMode}} ({{.writtenMode}})": "",
448447
"Please also attach the following file to the GitHub issue:": "",
449448
"Please create a cluster with bigger disk size: `minikube start --disk SIZE_MB` ": "",
450449
"Please either authenticate to the registry or use --base-image flag to use a different registry.": "",

Diff for: translations/es.json

-1
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,6 @@
453453
"Paused {{.count}} containers": "",
454454
"Paused {{.count}} containers in: {{.namespaces}}": "",
455455
"Pausing node {{.name}} ... ": "",
456-
"Permissions: {{.octalMode}} ({{.writtenMode}})": "",
457456
"Please also attach the following file to the GitHub issue:": "",
458457
"Please create a cluster with bigger disk size: `minikube start --disk SIZE_MB` ": "",
459458
"Please either authenticate to the registry or use --base-image flag to use a different registry.": "",

Diff for: translations/ja.json

-1
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,6 @@
447447
"Paused {{.count}} containers in: {{.namespaces}}": "次のnamespaceに存在する {{.count}} 個のコンテナを停止しました: {{.namespaces}}",
448448
"Pausing node {{.name}} ...": "ノード {{.name}} を一時停止しています ...",
449449
"Pausing node {{.name}} ... ": "",
450-
"Permissions: {{.octalMode}} ({{.writtenMode}})": "",
451450
"Please also attach the following file to the GitHub issue:": "",
452451
"Please create a cluster with bigger disk size: `minikube start --disk SIZE_MB` ": "",
453452
"Please either authenticate to the registry or use --base-image flag to use a different registry.": "",

Diff for: translations/ko.json

-1
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,6 @@
468468
"Paused {{.count}} containers": "",
469469
"Paused {{.count}} containers in: {{.namespaces}}": "",
470470
"Pausing node {{.name}} ... ": "",
471-
"Permissions: {{.octalMode}} ({{.writtenMode}})": "",
472471
"Please also attach the following file to the GitHub issue:": "",
473472
"Please create a cluster with bigger disk size: `minikube start --disk SIZE_MB` ": "",
474473
"Please either authenticate to the registry or use --base-image flag to use a different registry.": "",

Diff for: translations/pl.json

-1
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,6 @@
461461
"Paused {{.count}} containers": "Zatrzymane kontenery: {{.count}}",
462462
"Paused {{.count}} containers in: {{.namespaces}}": "Zatrzymane kontenery: {{.count}} w przestrzeniach nazw: {{.namespaces}}",
463463
"Pausing node {{.name}} ... ": "Zatrzymywanie węzła {{.name}} ... ",
464-
"Permissions: {{.octalMode}} ({{.writtenMode}})": "",
465464
"Please also attach the following file to the GitHub issue:": "",
466465
"Please attach the following file to the GitHub issue:": "Dołącz następujący plik do zgłoszenia problemu na GitHubie:",
467466
"Please create a cluster with bigger disk size: `minikube start --disk SIZE_MB` ": "Utwórz klaster z większym rozmiarem dysku: `minikube start --disk SIZE_MB`",

Diff for: translations/ru.json

-1
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,6 @@
419419
"Paused {{.count}} containers": "",
420420
"Paused {{.count}} containers in: {{.namespaces}}": "",
421421
"Pausing node {{.name}} ... ": "",
422-
"Permissions: {{.octalMode}} ({{.writtenMode}})": "",
423422
"Please also attach the following file to the GitHub issue:": "",
424423
"Please create a cluster with bigger disk size: `minikube start --disk SIZE_MB` ": "",
425424
"Please either authenticate to the registry or use --base-image flag to use a different registry.": "",

Diff for: translations/strings.txt

-1
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,6 @@
419419
"Paused {{.count}} containers": "",
420420
"Paused {{.count}} containers in: {{.namespaces}}": "",
421421
"Pausing node {{.name}} ... ": "",
422-
"Permissions: {{.octalMode}} ({{.writtenMode}})": "",
423422
"Please also attach the following file to the GitHub issue:": "",
424423
"Please create a cluster with bigger disk size: `minikube start --disk SIZE_MB` ": "",
425424
"Please either authenticate to the registry or use --base-image flag to use a different registry.": "",

0 commit comments

Comments
 (0)