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

@ -9,14 +9,43 @@ go_library(
"defaults.go",
"doc.go",
"file.go",
"file_unsupported.go",
"flags.go",
"http.go",
"sources.go",
] + select({
"@io_bazel_rules_go//go/platform:linux_amd64": [
"@io_bazel_rules_go//go/platform:android": [
"file_unsupported.go",
],
"@io_bazel_rules_go//go/platform:darwin": [
"file_unsupported.go",
],
"@io_bazel_rules_go//go/platform:dragonfly": [
"file_unsupported.go",
],
"@io_bazel_rules_go//go/platform:freebsd": [
"file_unsupported.go",
],
"@io_bazel_rules_go//go/platform:linux": [
"file_linux.go",
],
"@io_bazel_rules_go//go/platform:nacl": [
"file_unsupported.go",
],
"@io_bazel_rules_go//go/platform:netbsd": [
"file_unsupported.go",
],
"@io_bazel_rules_go//go/platform:openbsd": [
"file_unsupported.go",
],
"@io_bazel_rules_go//go/platform:plan9": [
"file_unsupported.go",
],
"@io_bazel_rules_go//go/platform:solaris": [
"file_unsupported.go",
],
"@io_bazel_rules_go//go/platform:windows": [
"file_unsupported.go",
],
"//conditions:default": [],
}),
importpath = "k8s.io/kubernetes/pkg/kubelet/config",
@ -49,7 +78,7 @@ go_library(
"//vendor/k8s.io/client-go/tools/cache:go_default_library",
"//vendor/k8s.io/client-go/tools/record:go_default_library",
] + select({
"@io_bazel_rules_go//go/platform:linux_amd64": [
"@io_bazel_rules_go//go/platform:linux": [
"//vendor/golang.org/x/exp/inotify:go_default_library",
],
"//conditions:default": [],
@ -64,13 +93,12 @@ go_test(
"config_test.go",
"http_test.go",
] + select({
"@io_bazel_rules_go//go/platform:linux_amd64": [
"@io_bazel_rules_go//go/platform:linux": [
"file_linux_test.go",
],
"//conditions:default": [],
}),
importpath = "k8s.io/kubernetes/pkg/kubelet/config",
library = ":go_default_library",
embed = [":go_default_library"],
deps = [
"//pkg/api/legacyscheme:go_default_library",
"//pkg/api/testapi:go_default_library",
@ -79,6 +107,7 @@ go_test(
"//pkg/apis/core/validation:go_default_library",
"//pkg/kubelet/types:go_default_library",
"//pkg/securitycontext:go_default_library",
"//vendor/github.com/stretchr/testify/assert:go_default_library",
"//vendor/k8s.io/api/core/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/api/equality:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
@ -90,7 +119,7 @@ go_test(
"//vendor/k8s.io/client-go/tools/record:go_default_library",
"//vendor/k8s.io/client-go/util/testing:go_default_library",
] + select({
"@io_bazel_rules_go//go/platform:linux_amd64": [
"@io_bazel_rules_go//go/platform:linux": [
"//vendor/k8s.io/apimachinery/pkg/util/wait:go_default_library",
],
"//conditions:default": [],

View File

@ -21,6 +21,7 @@ import (
"crypto/md5"
"encoding/hex"
"fmt"
"strings"
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@ -44,7 +45,7 @@ import (
// Generate a pod name that is unique among nodes by appending the nodeName.
func generatePodName(name string, nodeName types.NodeName) string {
return fmt.Sprintf("%s-%s", name, nodeName)
return fmt.Sprintf("%s-%s", name, strings.ToLower(string(nodeName)))
}
func applyDefaults(pod *api.Pod, source string, isFile bool, nodeName types.NodeName) error {

View File

@ -20,12 +20,17 @@ import (
"reflect"
"testing"
"github.com/stretchr/testify/assert"
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
"k8s.io/kubernetes/pkg/api/legacyscheme"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/apis/core"
api "k8s.io/kubernetes/pkg/apis/core"
"k8s.io/kubernetes/pkg/apis/core/validation"
"k8s.io/kubernetes/pkg/securitycontext"
)
@ -189,3 +194,59 @@ func TestGetSelfLink(t *testing.T) {
}
}
}
func TestStaticPodNameGenerate(t *testing.T) {
testCases := []struct {
nodeName types.NodeName
podName string
expected string
overwrite string
shouldErr bool
}{
{
"node1",
"static-pod1",
"static-pod1-node1",
"",
false,
},
{
"Node1",
"static-pod1",
"static-pod1-node1",
"",
false,
},
{
"NODE1",
"static-pod1",
"static-pod1-node1",
"static-pod1-NODE1",
true,
},
}
for _, c := range testCases {
assert.Equal(t, c.expected, generatePodName(c.podName, c.nodeName), "wrong pod name generated")
pod := &core.Pod{}
pod.Name = c.podName
if c.overwrite != "" {
pod.Name = c.overwrite
}
errs := validation.ValidatePod(pod)
if c.shouldErr {
specNameErrored := false
for _, err := range errs {
if err.Field == "metadata.name" {
specNameErrored = true
}
}
assert.NotEmpty(t, specNameErrored, "expecting error")
} else {
for _, err := range errs {
if err.Field == "metadata.name" {
t.Fail()
}
}
}
}
}

View File

@ -96,7 +96,7 @@ func (c *PodConfig) SeenAllSources(seenSources sets.String) bool {
if c.pods == nil {
return false
}
glog.V(6).Infof("Looking for %v, have seen %v", c.sources.List(), seenSources)
glog.V(5).Infof("Looking for %v, have seen %v", c.sources.List(), seenSources)
return seenSources.HasAll(c.sources.List()...) && c.pods.seenSources(c.sources.List()...)
}

View File

@ -48,12 +48,12 @@ func NewSourceFile(path string, nodeName types.NodeName, period time.Duration, u
// "golang.org/x/exp/inotify" requires a path without trailing "/"
path = strings.TrimRight(path, string(os.PathSeparator))
config := new(path, nodeName, period, updates)
config := newSourceFile(path, nodeName, updates)
glog.V(1).Infof("Watching path %q", path)
go wait.Forever(config.run, period)
}
func new(path string, nodeName types.NodeName, period time.Duration, updates chan<- interface{}) *sourceFile {
func newSourceFile(path string, nodeName types.NodeName, updates chan<- interface{}) *sourceFile {
send := func(objs []interface{}) {
var pods []*v1.Pod
for _, o := range objs {

View File

@ -46,7 +46,7 @@ import (
func TestExtractFromNonExistentFile(t *testing.T) {
ch := make(chan interface{}, 1)
c := new("/some/fake/file", "localhost", time.Millisecond, ch)
c := newSourceFile("/some/fake/file", "localhost", ch)
err := c.watch()
if err == nil {
t.Errorf("Expected error")
@ -137,7 +137,7 @@ func TestExtractFromBadDataFile(t *testing.T) {
}
ch := make(chan interface{}, 1)
c := new(fileName, "localhost", time.Millisecond, ch)
c := newSourceFile(fileName, "localhost", ch)
err = c.resetStoreFromPath()
if err == nil {
t.Fatalf("expected error, got nil")
@ -153,7 +153,7 @@ func TestExtractFromEmptyDir(t *testing.T) {
defer os.RemoveAll(dirName)
ch := make(chan interface{}, 1)
c := new(dirName, "localhost", time.Millisecond, ch)
c := newSourceFile(dirName, "localhost", ch)
err = c.resetStoreFromPath()
if err != nil {
t.Fatalf("unexpected error: %v", err)

View File

@ -89,7 +89,8 @@ func (s *ContainerRuntimeOptions) AddFlags(fs *pflag.FlagSet) {
fs.MarkHidden("experimental-dockershim")
fs.StringVar(&s.DockershimRootDirectory, "experimental-dockershim-root-directory", s.DockershimRootDirectory, "Path to the dockershim root directory.")
fs.MarkHidden("experimental-dockershim-root-directory")
fs.BoolVar(&s.DockerDisableSharedPID, "docker-disable-shared-pid", s.DockerDisableSharedPID, "The Container Runtime Interface (CRI) defaults to using a shared PID namespace for containers in a pod when running with Docker 1.13.1 or higher. Setting this flag reverts to the previous behavior of isolated PID namespaces. This ability will be removed in a future Kubernetes release.")
fs.BoolVar(&s.DockerDisableSharedPID, "docker-disable-shared-pid", s.DockerDisableSharedPID, "Setting this to false causes Kubernetes to create pods using a shared process namespace for containers in a pod when running with Docker 1.13.1 or higher. A future Kubernetes release will make this configurable instead in the API.")
fs.MarkDeprecated("docker-disable-shared-pid", "will be removed in a future release. This option will be replaced by PID namespace sharing that is configurable per-pod using the API. See https://features.k8s.io/495")
fs.StringVar(&s.PodSandboxImage, "pod-infra-container-image", s.PodSandboxImage, "The image whose network/ipc namespaces containers in each pod will use.")
fs.StringVar(&s.DockerEndpoint, "docker-endpoint", s.DockerEndpoint, "Use this for the docker endpoint to communicate with")
fs.DurationVar(&s.ImagePullProgressDeadline.Duration, "image-pull-progress-deadline", s.ImagePullProgressDeadline.Duration, "If no pulling progress is made before this deadline, the image pulling will be cancelled.")
@ -102,8 +103,9 @@ func (s *ContainerRuntimeOptions) AddFlags(fs *pflag.FlagSet) {
// Rkt-specific settings.
fs.StringVar(&s.RktPath, "rkt-path", s.RktPath, "Path of rkt binary. Leave empty to use the first rkt in $PATH. Only used if --container-runtime='rkt'.")
fs.MarkDeprecated("rkt-path", "will be removed in a future version. Rktnetes has been deprecated in favor of rktlet (https://github.com/kubernetes-incubator/rktlet).")
fs.StringVar(&s.RktAPIEndpoint, "rkt-api-endpoint", s.RktAPIEndpoint, "The endpoint of the rkt API service to communicate with. Only used if --container-runtime='rkt'.")
fs.MarkDeprecated("rkt-api-endpoint", "will be removed in a future version. Rktnetes has been deprecated in favor of rktlet (https://github.com/kubernetes-incubator/rktlet).")
fs.StringVar(&s.RktStage1Image, "rkt-stage1-image", s.RktStage1Image, "image to use as stage1. Local paths and http/https URLs are supported. If empty, the 'stage1.aci' in the same directory as '--rkt-path' will be used.")
fs.MarkDeprecated("rkt-stage1-image", "Will be removed in a future version. The default stage1 image will be specified by the rkt configurations, see https://github.com/coreos/rkt/blob/master/Documentation/configuration.md for more details.")
fs.MarkDeprecated("rkt-stage1-image", "will be removed in a future version. Rktnetes has been deprecated in favor of rktlet (https://github.com/kubernetes-incubator/rktlet).")
}