Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
1ecc12f7
Commit
1ecc12f7
authored
Oct 28, 2016
by
Vishnu Kannan
Committed by
Vishnu kannan
Nov 02, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Kubelet] Do not use custom mounter script for bind mounts, ext* and tmpfs mounts
Signed-off-by:
Vishnu Kannan
<
vishnuk@google.com
>
parent
d28f7031
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
8 deletions
+15
-8
BUILD
pkg/util/mount/BUILD
+1
-0
mount.go
pkg/util/mount/mount.go
+2
-2
mount_linux.go
pkg/util/mount/mount_linux.go
+12
-6
No files found.
pkg/util/mount/BUILD
View file @
1ecc12f7
...
@@ -22,6 +22,7 @@ go_library(
...
@@ -22,6 +22,7 @@ go_library(
tags = ["automanaged"],
tags = ["automanaged"],
deps = [
deps = [
"//pkg/util/exec:go_default_library",
"//pkg/util/exec:go_default_library",
"//pkg/util/sets:go_default_library",
"//vendor:github.com/golang/glog",
"//vendor:github.com/golang/glog",
],
],
)
)
...
...
pkg/util/mount/mount.go
View file @
1ecc12f7
...
@@ -30,7 +30,7 @@ import (
...
@@ -30,7 +30,7 @@ import (
const
(
const
(
// Default mount command if mounter path is not specified
// Default mount command if mounter path is not specified
mount
=
"mount"
defaultMountCommand
=
"mount"
)
)
type
Interface
interface
{
type
Interface
interface
{
...
@@ -105,7 +105,7 @@ func New() Interface {
...
@@ -105,7 +105,7 @@ func New() Interface {
func
NewCustomMounter
(
mounterPath
,
mounterRootfsPath
string
)
Interface
{
func
NewCustomMounter
(
mounterPath
,
mounterRootfsPath
string
)
Interface
{
// If mounter-path flag is not set, use default mount path
// If mounter-path flag is not set, use default mount path
if
mounterPath
==
""
{
if
mounterPath
==
""
{
mounterPath
=
mount
mounterPath
=
defaultMountCommand
}
}
if
mounterRootfsPath
==
""
{
if
mounterRootfsPath
==
""
{
mounterRootfsPath
=
"/"
mounterRootfsPath
=
"/"
...
...
pkg/util/mount/mount_linux.go
View file @
1ecc12f7
...
@@ -25,13 +25,13 @@ import (
...
@@ -25,13 +25,13 @@ import (
"io"
"io"
"os"
"os"
"os/exec"
"os/exec"
"path"
"strconv"
"strconv"
"strings"
"strings"
"syscall"
"syscall"
"github.com/golang/glog"
"github.com/golang/glog"
utilExec
"k8s.io/kubernetes/pkg/util/exec"
utilExec
"k8s.io/kubernetes/pkg/util/exec"
"k8s.io/kubernetes/pkg/util/sets"
)
)
const
(
const
(
...
@@ -63,18 +63,24 @@ type Mounter struct {
...
@@ -63,18 +63,24 @@ type Mounter struct {
// type, where kernel handles fs type for you. The mount 'options' is a list of options,
// type, where kernel handles fs type for you. The mount 'options' is a list of options,
// currently come from mount(8), e.g. "ro", "remount", "bind", etc. If no more option is
// currently come from mount(8), e.g. "ro", "remount", "bind", etc. If no more option is
// required, call Mount with an empty string list or nil.
// required, call Mount with an empty string list or nil.
// Update source path to include a root filesystem override to make a containerized mounter (specified via `mounterPath`) work.
func
(
mounter
*
Mounter
)
Mount
(
source
string
,
target
string
,
fstype
string
,
options
[]
string
)
error
{
func
(
mounter
*
Mounter
)
Mount
(
source
string
,
target
string
,
fstype
string
,
options
[]
string
)
error
{
// Path to mounter binary. Set to mount accessible via $PATH by default.
// All Linux distros are expected to be shipped with a mount utility that an support bind mounts.
mounterPath
:=
defaultMountCommand
bind
,
bindRemountOpts
:=
isBind
(
options
)
bind
,
bindRemountOpts
:=
isBind
(
options
)
if
bind
{
if
bind
{
err
:=
doMount
(
mounter
.
mounterPath
,
path
.
Join
(
mounter
.
mounterRootfsPath
,
source
),
path
.
Join
(
mounter
.
mounterRootfsPath
,
target
)
,
fstype
,
[]
string
{
"bind"
})
err
:=
doMount
(
mounter
Path
,
source
,
target
,
fstype
,
[]
string
{
"bind"
})
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
return
doMount
(
mounter
.
mounterPath
,
path
.
Join
(
mounter
.
mounterRootfsPath
,
source
),
path
.
Join
(
mounter
.
mounterRootfsPath
,
target
),
fstype
,
bindRemountOpts
)
return
doMount
(
mounterPath
,
source
,
target
,
fstype
,
bindRemountOpts
)
}
else
{
return
doMount
(
mounter
.
mounterPath
,
source
,
path
.
Join
(
mounter
.
mounterRootfsPath
,
target
),
fstype
,
options
)
}
}
// These filesystem types are expected to be supported by the mount utility on the host across all Linux distros.
var
defaultMounterFsTypes
=
sets
.
NewString
(
"tmpfs"
,
"ext4"
,
"ext3"
,
"ext2"
)
if
!
defaultMounterFsTypes
.
Has
(
fstype
)
{
mounterPath
=
mounter
.
mounterPath
}
return
doMount
(
mounterPath
,
source
,
target
,
fstype
,
options
)
}
}
// isBind detects whether a bind mount is being requested and makes the remount options to
// isBind detects whether a bind mount is being requested and makes the remount options to
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment