vendor updates

This commit is contained in:
Serguei Bezverkhi
2018-03-06 17:33:18 -05:00
parent 4b3ebc171b
commit e9033989a0
5854 changed files with 248382 additions and 119809 deletions

View File

@ -11,11 +11,40 @@ go_library(
srcs = [
"doc.go",
"empty_dir.go",
"empty_dir_unsupported.go",
] + select({
"@io_bazel_rules_go//go/platform:linux_amd64": [
"@io_bazel_rules_go//go/platform:android": [
"empty_dir_unsupported.go",
],
"@io_bazel_rules_go//go/platform:darwin": [
"empty_dir_unsupported.go",
],
"@io_bazel_rules_go//go/platform:dragonfly": [
"empty_dir_unsupported.go",
],
"@io_bazel_rules_go//go/platform:freebsd": [
"empty_dir_unsupported.go",
],
"@io_bazel_rules_go//go/platform:linux": [
"empty_dir_linux.go",
],
"@io_bazel_rules_go//go/platform:nacl": [
"empty_dir_unsupported.go",
],
"@io_bazel_rules_go//go/platform:netbsd": [
"empty_dir_unsupported.go",
],
"@io_bazel_rules_go//go/platform:openbsd": [
"empty_dir_unsupported.go",
],
"@io_bazel_rules_go//go/platform:plan9": [
"empty_dir_unsupported.go",
],
"@io_bazel_rules_go//go/platform:solaris": [
"empty_dir_unsupported.go",
],
"@io_bazel_rules_go//go/platform:windows": [
"empty_dir_unsupported.go",
],
"//conditions:default": [],
}),
importpath = "k8s.io/kubernetes/pkg/volume/empty_dir",
@ -31,7 +60,7 @@ go_library(
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/types:go_default_library",
] + select({
"@io_bazel_rules_go//go/platform:linux_amd64": [
"@io_bazel_rules_go//go/platform:linux": [
"//vendor/golang.org/x/sys/unix:go_default_library",
],
"//conditions:default": [],
@ -41,15 +70,14 @@ go_library(
go_test(
name = "go_default_test",
srcs = select({
"@io_bazel_rules_go//go/platform:linux_amd64": [
"@io_bazel_rules_go//go/platform:linux": [
"empty_dir_test.go",
],
"//conditions:default": [],
}),
importpath = "k8s.io/kubernetes/pkg/volume/empty_dir",
library = ":go_default_library",
embed = [":go_default_library"],
deps = select({
"@io_bazel_rules_go//go/platform:linux_amd64": [
"@io_bazel_rules_go//go/platform:linux": [
"//pkg/util/mount:go_default_library",
"//pkg/volume:go_default_library",
"//pkg/volume/testing:go_default_library",

View File

@ -155,20 +155,12 @@ func (plugin *emptyDirPlugin) ConstructVolumeSpec(volName, mountPath string) (*v
type mountDetector interface {
// GetMountMedium determines what type of medium a given path is backed
// by and whether that path is a mount point. For example, if this
// returns (mediumMemory, false, nil), the caller knows that the path is
// returns (v1.StorageMediumMemory, false, nil), the caller knows that the path is
// on a memory FS (tmpfs on Linux) but is not the root mountpoint of
// that tmpfs.
GetMountMedium(path string) (storageMedium, bool, error)
GetMountMedium(path string) (v1.StorageMedium, bool, error)
}
type storageMedium int
const (
mediumUnknown storageMedium = 0 // assume anything we don't explicitly handle is this
mediumMemory storageMedium = 1 // memory (e.g. tmpfs on linux)
mediumHugepages storageMedium = 2 // hugepages
)
// EmptyDir volumes are temporary directories exposed to the pod.
// These do not persist beyond the lifetime of a pod.
type emptyDir struct {
@ -257,7 +249,7 @@ func (ed *emptyDir) setupTmpfs(dir string) error {
}
// If the directory is a mountpoint with medium memory, there is no
// work to do since we are already in the desired state.
if isMnt && medium == mediumMemory {
if isMnt && medium == v1.StorageMediumMemory {
return nil
}
@ -280,7 +272,7 @@ func (ed *emptyDir) setupHugepages(dir string) error {
}
// If the directory is a mountpoint with medium hugepages, there is no
// work to do since we are already in the desired state.
if isMnt && medium == mediumHugepages {
if isMnt && medium == v1.StorageMediumHugePages {
return nil
}
@ -388,10 +380,10 @@ func (ed *emptyDir) TearDownAt(dir string) error {
return err
}
if isMnt {
if medium == mediumMemory {
if medium == v1.StorageMediumMemory {
ed.medium = v1.StorageMediumMemory
return ed.teardownTmpfsOrHugetlbfs(dir)
} else if medium == mediumHugepages {
} else if medium == v1.StorageMediumHugePages {
ed.medium = v1.StorageMediumHugePages
return ed.teardownTmpfsOrHugetlbfs(dir)
}

View File

@ -23,6 +23,8 @@ import (
"github.com/golang/glog"
"golang.org/x/sys/unix"
"k8s.io/api/core/v1"
"k8s.io/kubernetes/pkg/util/mount"
)
@ -37,22 +39,22 @@ type realMountDetector struct {
mounter mount.Interface
}
func (m *realMountDetector) GetMountMedium(path string) (storageMedium, bool, error) {
func (m *realMountDetector) GetMountMedium(path string) (v1.StorageMedium, bool, error) {
glog.V(5).Infof("Determining mount medium of %v", path)
notMnt, err := m.mounter.IsLikelyNotMountPoint(path)
if err != nil {
return 0, false, fmt.Errorf("IsLikelyNotMountPoint(%q): %v", path, err)
return v1.StorageMediumDefault, false, fmt.Errorf("IsLikelyNotMountPoint(%q): %v", path, err)
}
buf := unix.Statfs_t{}
if err := unix.Statfs(path, &buf); err != nil {
return 0, false, fmt.Errorf("statfs(%q): %v", path, err)
return v1.StorageMediumDefault, false, fmt.Errorf("statfs(%q): %v", path, err)
}
glog.V(5).Infof("Statfs_t of %v: %+v", path, buf)
if buf.Type == linuxTmpfsMagic {
return mediumMemory, !notMnt, nil
return v1.StorageMediumMemory, !notMnt, nil
} else if int64(buf.Type) == linuxHugetlbfsMagic {
return mediumHugepages, !notMnt, nil
return v1.StorageMediumHugePages, !notMnt, nil
}
return mediumUnknown, !notMnt, nil
return v1.StorageMediumDefault, !notMnt, nil
}

View File

@ -66,11 +66,11 @@ func TestCanSupport(t *testing.T) {
}
type fakeMountDetector struct {
medium storageMedium
medium v1.StorageMedium
isMount bool
}
func (fake *fakeMountDetector) GetMountMedium(path string) (storageMedium, bool, error) {
func (fake *fakeMountDetector) GetMountMedium(path string) (v1.StorageMedium, bool, error) {
return fake.medium, fake.isMount, nil
}
@ -196,9 +196,9 @@ func doTestPlugin(t *testing.T, config pluginTestConfig) {
physicalMounter.ResetLog()
// Make an unmounter for the volume
teardownMedium := mediumUnknown
teardownMedium := v1.StorageMediumDefault
if config.medium == v1.StorageMediumMemory {
teardownMedium = mediumMemory
teardownMedium = v1.StorageMediumMemory
}
unmounterMountDetector := &fakeMountDetector{medium: teardownMedium, isMount: config.shouldBeMountedBeforeTeardown}
unmounter, err := plug.(*emptyDirPlugin).newUnmounterInternal(volumeName, types.UID("poduid"), &physicalMounter, unmounterMountDetector)

View File

@ -19,6 +19,7 @@ limitations under the License.
package empty_dir
import (
"k8s.io/api/core/v1"
"k8s.io/kubernetes/pkg/util/mount"
)
@ -27,6 +28,6 @@ type realMountDetector struct {
mounter mount.Interface
}
func (m *realMountDetector) GetMountMedium(path string) (storageMedium, bool, error) {
return mediumUnknown, false, nil
func (m *realMountDetector) GetMountMedium(path string) (v1.StorageMedium, bool, error) {
return v1.StorageMediumDefault, false, nil
}