Vendor: Update k8s version

Signed-off-by: Michał Żyłowski <michal.zylowski@intel.com>
This commit is contained in:
Michał Żyłowski 2017-02-03 14:41:32 +01:00
parent dfa93414c5
commit 52baf68d50
3756 changed files with 113013 additions and 92675 deletions

View file

@ -44,8 +44,8 @@ go_library(
"//vendor:k8s.io/apiserver/pkg/authentication/authenticator",
"//vendor:k8s.io/apiserver/pkg/authentication/user",
"//vendor:k8s.io/apiserver/pkg/authorization/authorizer",
"//vendor:k8s.io/apiserver/pkg/healthz",
"//vendor:k8s.io/apiserver/pkg/httplog",
"//vendor:k8s.io/apiserver/pkg/server/healthz",
"//vendor:k8s.io/apiserver/pkg/server/httplog",
"//vendor:k8s.io/apiserver/pkg/util/flushwriter",
],
)
@ -66,21 +66,21 @@ go_test(
"//pkg/kubelet/container/testing:go_default_library",
"//pkg/kubelet/server/remotecommand:go_default_library",
"//pkg/kubelet/server/stats:go_default_library",
"//pkg/kubelet/types:go_default_library",
"//pkg/util/httpstream:go_default_library",
"//pkg/util/httpstream/spdy:go_default_library",
"//pkg/util/term:go_default_library",
"//pkg/util/testing:go_default_library",
"//pkg/volume:go_default_library",
"//vendor:github.com/google/cadvisor/info/v1",
"//vendor:github.com/google/cadvisor/info/v2",
"//vendor:github.com/stretchr/testify/assert",
"//vendor:github.com/stretchr/testify/require",
"//vendor:k8s.io/apimachinery/pkg/api/errors",
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
"//vendor:k8s.io/apimachinery/pkg/types",
"//vendor:k8s.io/apimachinery/pkg/util/sets",
"//vendor:k8s.io/apiserver/pkg/authentication/user",
"//vendor:k8s.io/apiserver/pkg/authorization/authorizer",
"//vendor:k8s.io/client-go/util/testing",
],
)

View file

@ -29,7 +29,7 @@ go_library(
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
"//vendor:k8s.io/apimachinery/pkg/types",
"//vendor:k8s.io/apimachinery/pkg/util/runtime",
"//vendor:k8s.io/apiserver/pkg/httplog",
"//vendor:k8s.io/apiserver/pkg/server/httplog",
"//vendor:k8s.io/apiserver/pkg/util/wsstream",
],
)

View file

@ -22,7 +22,7 @@ import (
"time"
"k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/apiserver/pkg/httplog"
"k8s.io/apiserver/pkg/server/httplog"
"k8s.io/apiserver/pkg/util/wsstream"
)

View file

@ -43,8 +43,8 @@ import (
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/apiserver/pkg/authentication/authenticator"
"k8s.io/apiserver/pkg/authorization/authorizer"
"k8s.io/apiserver/pkg/healthz"
"k8s.io/apiserver/pkg/httplog"
"k8s.io/apiserver/pkg/server/healthz"
"k8s.io/apiserver/pkg/server/httplog"
"k8s.io/apiserver/pkg/util/flushwriter"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/v1"

View file

@ -39,10 +39,12 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
apierrs "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apiserver/pkg/authentication/user"
"k8s.io/apiserver/pkg/authorization/authorizer"
utiltesting "k8s.io/client-go/util/testing"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/kubelet/cm"
@ -50,11 +52,9 @@ import (
kubecontainertesting "k8s.io/kubernetes/pkg/kubelet/container/testing"
"k8s.io/kubernetes/pkg/kubelet/server/remotecommand"
"k8s.io/kubernetes/pkg/kubelet/server/stats"
kubetypes "k8s.io/kubernetes/pkg/kubelet/types"
"k8s.io/kubernetes/pkg/util/httpstream"
"k8s.io/kubernetes/pkg/util/httpstream/spdy"
"k8s.io/kubernetes/pkg/util/term"
utiltesting "k8s.io/kubernetes/pkg/util/testing"
"k8s.io/kubernetes/pkg/volume"
)
@ -211,7 +211,7 @@ func newServerTest() *serverTestFramework {
},
podByNameFunc: func(namespace, name string) (*v1.Pod, bool) {
return &v1.Pod{
ObjectMeta: v1.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Namespace: namespace,
Name: name,
UID: testUID,
@ -264,7 +264,7 @@ func readResp(resp *http.Response) (string, error) {
// A helper function to return the correct pod name.
func getPodName(name, namespace string) string {
if namespace == "" {
namespace = kubetypes.NamespaceDefault
namespace = metav1.NamespaceDefault
}
return name + "_" + namespace
}
@ -891,7 +891,7 @@ func assertHealthIsOk(t *testing.T, httpURL string) {
func setPodByNameFunc(fw *serverTestFramework, namespace, pod, container string) {
fw.fakeKubelet.podByNameFunc = func(namespace, name string) (*v1.Pod, bool) {
return &v1.Pod{
ObjectMeta: v1.ObjectMeta{
ObjectMeta: metav1.ObjectMeta{
Namespace: namespace,
Name: pod,
},

View file

@ -29,6 +29,7 @@ import (
cadvisorapiv2 "github.com/google/cadvisor/info/v2"
"github.com/emicklei/go-restful"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/kubelet/cm"
@ -197,7 +198,7 @@ func (h *handler) handlePodContainer(request *restful.Request, response *restful
// Default parameters.
params := map[string]string{
"namespace": v1.NamespaceDefault,
"namespace": metav1.NamespaceDefault,
"uid": "",
}
for k, v := range request.PathParameters() {

View file

@ -20,12 +20,12 @@ go_library(
"//pkg/kubelet/api/v1alpha1/runtime:go_default_library",
"//pkg/kubelet/server/portforward:go_default_library",
"//pkg/kubelet/server/remotecommand:go_default_library",
"//pkg/util/clock:go_default_library",
"//pkg/util/term:go_default_library",
"//vendor:github.com/emicklei/go-restful",
"//vendor:google.golang.org/grpc",
"//vendor:google.golang.org/grpc/codes",
"//vendor:k8s.io/apimachinery/pkg/types",
"//vendor:k8s.io/client-go/util/clock",
],
)
@ -38,7 +38,6 @@ go_test(
library = ":go_default_library",
tags = ["automanaged"],
deps = [
"//pkg/client/restclient:go_default_library",
"//pkg/client/unversioned/remotecommand:go_default_library",
"//pkg/kubelet/api/v1alpha1/runtime:go_default_library",
"//pkg/kubelet/server/portforward:go_default_library",
@ -47,7 +46,8 @@ go_test(
"//vendor:github.com/stretchr/testify/assert",
"//vendor:github.com/stretchr/testify/require",
"//vendor:k8s.io/client-go/pkg/api",
"//vendor:k8s.io/client-go/pkg/util/clock",
"//vendor:k8s.io/client-go/rest",
"//vendor:k8s.io/client-go/util/clock",
],
)

View file

@ -25,7 +25,7 @@ import (
"sync"
"time"
"k8s.io/kubernetes/pkg/util/clock"
"k8s.io/client-go/util/clock"
)
var (

View file

@ -26,7 +26,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"k8s.io/client-go/pkg/util/clock"
"k8s.io/client-go/util/clock"
)
func TestInsert(t *testing.T) {

View file

@ -146,7 +146,7 @@ type server struct {
}
func (s *server) GetExec(req *runtimeapi.ExecRequest) (*runtimeapi.ExecResponse, error) {
if req.GetContainerId() == "" {
if req.ContainerId == "" {
return nil, grpc.Errorf(codes.InvalidArgument, "missing required container_id")
}
token, err := s.cache.Insert(req)
@ -159,7 +159,7 @@ func (s *server) GetExec(req *runtimeapi.ExecRequest) (*runtimeapi.ExecResponse,
}
func (s *server) GetAttach(req *runtimeapi.AttachRequest) (*runtimeapi.AttachResponse, error) {
if req.GetContainerId() == "" {
if req.ContainerId == "" {
return nil, grpc.Errorf(codes.InvalidArgument, "missing required container_id")
}
token, err := s.cache.Insert(req)
@ -172,7 +172,7 @@ func (s *server) GetAttach(req *runtimeapi.AttachRequest) (*runtimeapi.AttachRes
}
func (s *server) GetPortForward(req *runtimeapi.PortForwardRequest) (*runtimeapi.PortForwardResponse, error) {
if req.GetPodSandboxId() == "" {
if req.PodSandboxId == "" {
return nil, grpc.Errorf(codes.InvalidArgument, "missing required pod_sandbox_id")
}
token, err := s.cache.Insert(req)
@ -211,11 +211,10 @@ func (s *server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
s.handler.ServeHTTP(w, r)
}
func (s *server) buildURL(method, token string) *string {
loc := s.config.BaseURL.ResolveReference(&url.URL{
func (s *server) buildURL(method, token string) string {
return s.config.BaseURL.ResolveReference(&url.URL{
Path: path.Join(method, token),
}).String()
return &loc
}
func (s *server) serveExec(req *restful.Request, resp *restful.Response) {
@ -232,10 +231,10 @@ func (s *server) serveExec(req *restful.Request, resp *restful.Response) {
}
streamOpts := &remotecommand.Options{
Stdin: exec.GetStdin(),
Stdin: exec.Stdin,
Stdout: true,
Stderr: !exec.GetTty(),
TTY: exec.GetTty(),
Stderr: !exec.Tty,
TTY: exec.Tty,
}
remotecommand.ServeExec(
@ -244,8 +243,8 @@ func (s *server) serveExec(req *restful.Request, resp *restful.Response) {
s.runtime,
"", // unused: podName
"", // unusued: podUID
exec.GetContainerId(),
exec.GetCmd(),
exec.ContainerId,
exec.Cmd,
streamOpts,
s.config.StreamIdleTimeout,
s.config.StreamCreationTimeout,
@ -266,10 +265,10 @@ func (s *server) serveAttach(req *restful.Request, resp *restful.Response) {
}
streamOpts := &remotecommand.Options{
Stdin: attach.GetStdin(),
Stdin: attach.Stdin,
Stdout: true,
Stderr: !attach.GetTty(),
TTY: attach.GetTty(),
Stderr: !attach.Tty,
TTY: attach.Tty,
}
remotecommand.ServeAttach(
resp.ResponseWriter,
@ -277,7 +276,7 @@ func (s *server) serveAttach(req *restful.Request, resp *restful.Response) {
s.runtime,
"", // unused: podName
"", // unusued: podUID
attach.GetContainerId(),
attach.ContainerId,
streamOpts,
s.config.StreamIdleTimeout,
s.config.StreamCreationTimeout,
@ -301,7 +300,7 @@ func (s *server) servePortForward(req *restful.Request, resp *restful.Response)
resp.ResponseWriter,
req.Request,
s.runtime,
pf.GetPodSandboxId(),
pf.PodSandboxId,
"", // unused: podUID
s.config.StreamIdleTimeout,
s.config.StreamCreationTimeout)

View file

@ -31,7 +31,7 @@ import (
"github.com/stretchr/testify/require"
"k8s.io/client-go/pkg/api"
"k8s.io/kubernetes/pkg/client/restclient"
restclient "k8s.io/client-go/rest"
"k8s.io/kubernetes/pkg/client/unversioned/remotecommand"
runtimeapi "k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
kubeletportforward "k8s.io/kubernetes/pkg/kubelet/server/portforward"
@ -82,25 +82,25 @@ func TestGetExec(t *testing.T) {
assertRequestToken := func(test testcase, cache *requestCache, token string) {
req, ok := cache.Consume(token)
require.True(t, ok, "token %s not found! testcase=%+v", token, test)
assert.Equal(t, testContainerID, req.(*runtimeapi.ExecRequest).GetContainerId(), "testcase=%+v", test)
assert.Equal(t, test.cmd, req.(*runtimeapi.ExecRequest).GetCmd(), "testcase=%+v", test)
assert.Equal(t, test.tty, req.(*runtimeapi.ExecRequest).GetTty(), "testcase=%+v", test)
assert.Equal(t, test.stdin, req.(*runtimeapi.ExecRequest).GetStdin(), "testcase=%+v", test)
assert.Equal(t, testContainerID, req.(*runtimeapi.ExecRequest).ContainerId, "testcase=%+v", test)
assert.Equal(t, test.cmd, req.(*runtimeapi.ExecRequest).Cmd, "testcase=%+v", test)
assert.Equal(t, test.tty, req.(*runtimeapi.ExecRequest).Tty, "testcase=%+v", test)
assert.Equal(t, test.stdin, req.(*runtimeapi.ExecRequest).Stdin, "testcase=%+v", test)
}
containerID := testContainerID
for _, test := range testcases {
request := &runtimeapi.ExecRequest{
ContainerId: &containerID,
ContainerId: containerID,
Cmd: test.cmd,
Tty: &test.tty,
Stdin: &test.stdin,
Tty: test.tty,
Stdin: test.stdin,
}
{ // Non-TLS
resp, err := serv.GetExec(request)
assert.NoError(t, err, "testcase=%+v", test)
expectedURL := "http://" + testAddr + "/exec/"
assert.Contains(t, resp.GetUrl(), expectedURL, "testcase=%+v", test)
token := strings.TrimPrefix(resp.GetUrl(), expectedURL)
assert.Contains(t, resp.Url, expectedURL, "testcase=%+v", test)
token := strings.TrimPrefix(resp.Url, expectedURL)
assertRequestToken(test, serv.(*server).cache, token)
}
@ -108,8 +108,8 @@ func TestGetExec(t *testing.T) {
resp, err := tlsServer.GetExec(request)
assert.NoError(t, err, "testcase=%+v", test)
expectedURL := "https://" + testAddr + "/exec/"
assert.Contains(t, resp.GetUrl(), expectedURL, "testcase=%+v", test)
token := strings.TrimPrefix(resp.GetUrl(), expectedURL)
assert.Contains(t, resp.Url, expectedURL, "testcase=%+v", test)
token := strings.TrimPrefix(resp.Url, expectedURL)
assertRequestToken(test, tlsServer.(*server).cache, token)
}
@ -117,8 +117,8 @@ func TestGetExec(t *testing.T) {
resp, err := prefixServer.GetExec(request)
assert.NoError(t, err, "testcase=%+v", test)
expectedURL := "http://" + testAddr + "/" + pathPrefix + "/exec/"
assert.Contains(t, resp.GetUrl(), expectedURL, "testcase=%+v", test)
token := strings.TrimPrefix(resp.GetUrl(), expectedURL)
assert.Contains(t, resp.Url, expectedURL, "testcase=%+v", test)
token := strings.TrimPrefix(resp.Url, expectedURL)
assertRequestToken(test, prefixServer.(*server).cache, token)
}
}
@ -149,23 +149,23 @@ func TestGetAttach(t *testing.T) {
assertRequestToken := func(test testcase, cache *requestCache, token string) {
req, ok := cache.Consume(token)
require.True(t, ok, "token %s not found! testcase=%+v", token, test)
assert.Equal(t, testContainerID, req.(*runtimeapi.AttachRequest).GetContainerId(), "testcase=%+v", test)
assert.Equal(t, test.tty, req.(*runtimeapi.AttachRequest).GetTty(), "testcase=%+v", test)
assert.Equal(t, test.stdin, req.(*runtimeapi.AttachRequest).GetStdin(), "testcase=%+v", test)
assert.Equal(t, testContainerID, req.(*runtimeapi.AttachRequest).ContainerId, "testcase=%+v", test)
assert.Equal(t, test.tty, req.(*runtimeapi.AttachRequest).Tty, "testcase=%+v", test)
assert.Equal(t, test.stdin, req.(*runtimeapi.AttachRequest).Stdin, "testcase=%+v", test)
}
containerID := testContainerID
for _, test := range testcases {
request := &runtimeapi.AttachRequest{
ContainerId: &containerID,
Stdin: &test.stdin,
Tty: &test.tty,
ContainerId: containerID,
Stdin: test.stdin,
Tty: test.tty,
}
{ // Non-TLS
resp, err := serv.GetAttach(request)
assert.NoError(t, err, "testcase=%+v", test)
expectedURL := "http://" + testAddr + "/attach/"
assert.Contains(t, resp.GetUrl(), expectedURL, "testcase=%+v", test)
token := strings.TrimPrefix(resp.GetUrl(), expectedURL)
assert.Contains(t, resp.Url, expectedURL, "testcase=%+v", test)
token := strings.TrimPrefix(resp.Url, expectedURL)
assertRequestToken(test, serv.(*server).cache, token)
}
@ -173,8 +173,8 @@ func TestGetAttach(t *testing.T) {
resp, err := tlsServer.GetAttach(request)
assert.NoError(t, err, "testcase=%+v", test)
expectedURL := "https://" + testAddr + "/attach/"
assert.Contains(t, resp.GetUrl(), expectedURL, "testcase=%+v", test)
token := strings.TrimPrefix(resp.GetUrl(), expectedURL)
assert.Contains(t, resp.Url, expectedURL, "testcase=%+v", test)
token := strings.TrimPrefix(resp.Url, expectedURL)
assertRequestToken(test, tlsServer.(*server).cache, token)
}
}
@ -183,7 +183,7 @@ func TestGetAttach(t *testing.T) {
func TestGetPortForward(t *testing.T) {
podSandboxID := testPodSandboxID
request := &runtimeapi.PortForwardRequest{
PodSandboxId: &podSandboxID,
PodSandboxId: podSandboxID,
Port: []int32{1, 2, 3, 4},
}
@ -195,11 +195,11 @@ func TestGetPortForward(t *testing.T) {
resp, err := serv.GetPortForward(request)
assert.NoError(t, err)
expectedURL := "http://" + testAddr + "/portforward/"
assert.True(t, strings.HasPrefix(resp.GetUrl(), expectedURL))
token := strings.TrimPrefix(resp.GetUrl(), expectedURL)
assert.True(t, strings.HasPrefix(resp.Url, expectedURL))
token := strings.TrimPrefix(resp.Url, expectedURL)
req, ok := serv.(*server).cache.Consume(token)
require.True(t, ok, "token %s not found!", token)
assert.Equal(t, testPodSandboxID, req.(*runtimeapi.PortForwardRequest).GetPodSandboxId())
assert.Equal(t, testPodSandboxID, req.(*runtimeapi.PortForwardRequest).PodSandboxId)
}
{ // TLS
@ -211,11 +211,11 @@ func TestGetPortForward(t *testing.T) {
resp, err := tlsServer.GetPortForward(request)
assert.NoError(t, err)
expectedURL := "https://" + testAddr + "/portforward/"
assert.True(t, strings.HasPrefix(resp.GetUrl(), expectedURL))
token := strings.TrimPrefix(resp.GetUrl(), expectedURL)
assert.True(t, strings.HasPrefix(resp.Url, expectedURL))
token := strings.TrimPrefix(resp.Url, expectedURL)
req, ok := tlsServer.(*server).cache.Consume(token)
require.True(t, ok, "token %s not found!", token)
assert.Equal(t, testPodSandboxID, req.(*runtimeapi.PortForwardRequest).GetPodSandboxId())
assert.Equal(t, testPodSandboxID, req.(*runtimeapi.PortForwardRequest).PodSandboxId)
}
}
@ -231,12 +231,11 @@ func TestServePortForward(t *testing.T) {
s, testServer := startTestServer(t)
defer testServer.Close()
podSandboxID := testPodSandboxID
resp, err := s.GetPortForward(&runtimeapi.PortForwardRequest{
PodSandboxId: &podSandboxID,
PodSandboxId: testPodSandboxID,
})
require.NoError(t, err)
reqURL, err := url.Parse(resp.GetUrl())
reqURL, err := url.Parse(resp.Url)
require.NoError(t, err)
exec, err := remotecommand.NewExecutor(&restclient.Config{}, "POST", reqURL)
@ -273,20 +272,20 @@ func runRemoteCommandTest(t *testing.T, commandType string) {
switch commandType {
case "exec":
resp, err := s.GetExec(&runtimeapi.ExecRequest{
ContainerId: &containerID,
ContainerId: containerID,
Cmd: []string{"echo"},
Stdin: &stdin,
Stdin: stdin,
})
require.NoError(t, err)
reqURL, err = url.Parse(resp.GetUrl())
reqURL, err = url.Parse(resp.Url)
require.NoError(t, err)
case "attach":
resp, err := s.GetAttach(&runtimeapi.AttachRequest{
ContainerId: &containerID,
Stdin: &stdin,
ContainerId: containerID,
Stdin: stdin,
})
require.NoError(t, err)
reqURL, err = url.Parse(resp.GetUrl())
reqURL, err = url.Parse(resp.Url)
require.NoError(t, err)
}