update kubernetes vendor for new CRI change

Signed-off-by: Crazykev <crazykev@zju.edu.cn>
This commit is contained in:
Crazykev
2017-05-23 19:31:47 +08:00
parent 6ce1dc0167
commit 49e7ef2153
48 changed files with 1567 additions and 533 deletions

View File

@@ -21,7 +21,7 @@ import (
"golang.org/x/net/context"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1"
)
// Attach prepares a streaming endpoint to attach to a running container, and returns the address.

View File

@@ -23,7 +23,7 @@ import (
"github.com/golang/glog"
"golang.org/x/net/context"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1"
"github.com/kubernetes-incubator/cri-containerd/pkg/metadata"
)

View File

@@ -24,7 +24,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"golang.org/x/net/context"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1"
"github.com/kubernetes-incubator/cri-containerd/pkg/metadata"
ostesting "github.com/kubernetes-incubator/cri-containerd/pkg/os/testing"

View File

@@ -21,7 +21,7 @@ import (
"golang.org/x/net/context"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1"
)
// Exec prepares a streaming endpoint to execute a command in the container, and returns the address.

View File

@@ -21,7 +21,7 @@ import (
"golang.org/x/net/context"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1"
)
// ExecSync executes a command in the container, and returns the stdout output.

View File

@@ -22,7 +22,7 @@ import (
"github.com/golang/glog"
"golang.org/x/net/context"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1"
"github.com/kubernetes-incubator/cri-containerd/pkg/metadata"
)

View File

@@ -24,7 +24,7 @@ import (
"github.com/stretchr/testify/require"
"golang.org/x/net/context"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1"
"github.com/kubernetes-incubator/cri-containerd/pkg/metadata"
)

View File

@@ -22,7 +22,7 @@ import (
"github.com/golang/glog"
"golang.org/x/net/context"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1"
"github.com/kubernetes-incubator/cri-containerd/pkg/metadata"
)

View File

@@ -24,7 +24,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"golang.org/x/net/context"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1"
"github.com/kubernetes-incubator/cri-containerd/pkg/metadata"
ostesting "github.com/kubernetes-incubator/cri-containerd/pkg/os/testing"

View File

@@ -33,7 +33,7 @@ import (
"github.com/containerd/containerd/api/types/container"
"github.com/containerd/containerd/api/types/mount"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1"
"github.com/kubernetes-incubator/cri-containerd/pkg/metadata"
)

View File

@@ -30,7 +30,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"golang.org/x/net/context"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1"
"github.com/kubernetes-incubator/cri-containerd/pkg/metadata"
ostesting "github.com/kubernetes-incubator/cri-containerd/pkg/os/testing"

View File

@@ -22,7 +22,7 @@ import (
"github.com/golang/glog"
"golang.org/x/net/context"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1"
"github.com/kubernetes-incubator/cri-containerd/pkg/metadata"
)

View File

@@ -23,7 +23,7 @@ import (
"github.com/stretchr/testify/assert"
"golang.org/x/net/context"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1"
"github.com/kubernetes-incubator/cri-containerd/pkg/metadata"
)

View File

@@ -26,7 +26,7 @@ import (
"github.com/containerd/containerd/api/services/execution"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1"
"github.com/kubernetes-incubator/cri-containerd/pkg/metadata"
)

View File

@@ -25,7 +25,7 @@ import (
"github.com/containerd/containerd/api/types/container"
"github.com/stretchr/testify/assert"
"golang.org/x/net/context"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1"
"github.com/kubernetes-incubator/cri-containerd/pkg/metadata"
servertesting "github.com/kubernetes-incubator/cri-containerd/pkg/server/testing"

View File

@@ -25,7 +25,7 @@ import (
"github.com/containerd/containerd/api/types/container"
"github.com/stretchr/testify/assert"
"golang.org/x/net/context"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1"
"github.com/kubernetes-incubator/cri-containerd/pkg/metadata"
servertesting "github.com/kubernetes-incubator/cri-containerd/pkg/server/testing"

View File

@@ -32,7 +32,7 @@ import (
"github.com/kubernetes-incubator/cri-containerd/pkg/metadata"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1"
)
const (

View File

@@ -20,7 +20,7 @@ import (
"fmt"
"golang.org/x/net/context"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1"
)
// ListImages lists existing images.

View File

@@ -28,7 +28,7 @@ import (
"github.com/golang/glog"
imagespec "github.com/opencontainers/image-spec/specs-go/v1"
"golang.org/x/net/context"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1"
"github.com/kubernetes-incubator/cri-containerd/pkg/metadata"
)

View File

@@ -19,7 +19,7 @@ package server
import (
"golang.org/x/net/context"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1"
)
// RemoveImage removes the image.

View File

@@ -19,7 +19,7 @@ package server
import (
"golang.org/x/net/context"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1"
)
// ImageStatus returns the status of the image, returns nil if the image isn't present.

View File

@@ -0,0 +1,30 @@
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package server
import (
"errors"
"golang.org/x/net/context"
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1"
)
// ImageFsInfo returns information of the filesystem that is used to store images.
func (c *criContainerdService) ImageFsInfo(ctx context.Context, r *runtime.ImageFsInfoRequest) (*runtime.ImageFsInfoResponse, error) {
return nil, errors.New("not implemented")
}

View File

@@ -25,7 +25,7 @@ import (
"github.com/containerd/containerd/api/services/execution"
"github.com/containerd/containerd/api/types/container"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1"
"github.com/kubernetes-incubator/cri-containerd/pkg/metadata"
)

View File

@@ -25,7 +25,7 @@ import (
"github.com/containerd/containerd/api/types/container"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1"
"github.com/kubernetes-incubator/cri-containerd/pkg/metadata"
servertesting "github.com/kubernetes-incubator/cri-containerd/pkg/server/testing"

View File

@@ -21,7 +21,7 @@ import (
"golang.org/x/net/context"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1"
)
// PortForward prepares a streaming endpoint to forward ports from a PodSandbox, and returns the address.

View File

@@ -24,7 +24,7 @@ import (
"github.com/containerd/containerd/api/services/execution"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1"
"github.com/kubernetes-incubator/cri-containerd/pkg/metadata"
)

View File

@@ -29,7 +29,7 @@ import (
ostesting "github.com/kubernetes-incubator/cri-containerd/pkg/os/testing"
servertesting "github.com/kubernetes-incubator/cri-containerd/pkg/server/testing"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1"
)
func TestRemovePodSandbox(t *testing.T) {

View File

@@ -32,7 +32,7 @@ import (
"github.com/containerd/containerd/api/services/execution"
"github.com/containerd/containerd/api/types/mount"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1"
"github.com/kubernetes-incubator/cri-containerd/pkg/metadata"
)

View File

@@ -33,7 +33,7 @@ import (
ostesting "github.com/kubernetes-incubator/cri-containerd/pkg/os/testing"
servertesting "github.com/kubernetes-incubator/cri-containerd/pkg/server/testing"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1"
)
func getRunPodSandboxTestData() (*runtime.PodSandboxConfig, func(*testing.T, string, *runtimespec.Spec)) {

View File

@@ -25,7 +25,7 @@ import (
"github.com/containerd/containerd/api/services/execution"
"github.com/containerd/containerd/api/types/container"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1"
"github.com/kubernetes-incubator/cri-containerd/pkg/metadata"
)
@@ -72,15 +72,6 @@ func (c *criContainerdService) PodSandboxStatus(ctx context.Context, r *runtime.
// toCRISandboxStatus converts sandbox metadata into CRI pod sandbox status.
func toCRISandboxStatus(meta *metadata.SandboxMetadata, state runtime.PodSandboxState, ip string) *runtime.PodSandboxStatus {
nsOpts := meta.Config.GetLinux().GetSecurityContext().GetNamespaceOptions()
netNS := meta.NetNS
if state == runtime.PodSandboxState_SANDBOX_NOTREADY {
// Return empty network namespace when sandbox is not ready.
// For kubenet, when sandbox is not running, both empty
// network namespace and a valid permanent network namespace
// work. Go with the first option here because it's the current
// behavior in Kubernetes.
netNS = ""
}
return &runtime.PodSandboxStatus{
Id: meta.ID,
Metadata: meta.Config.GetMetadata(),
@@ -89,9 +80,6 @@ func toCRISandboxStatus(meta *metadata.SandboxMetadata, state runtime.PodSandbox
Network: &runtime.PodSandboxNetworkStatus{Ip: ip},
Linux: &runtime.LinuxPodSandboxStatus{
Namespaces: &runtime.Namespace{
// TODO(random-liu): Revendor new CRI version and get
// rid of this field.
Network: netNS,
Options: &runtime.NamespaceOption{
HostNetwork: nsOpts.GetHostNetwork(),
HostPid: nsOpts.GetHostPid(),

View File

@@ -27,7 +27,7 @@ import (
"github.com/containerd/containerd/api/types/container"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1"
"github.com/kubernetes-incubator/cri-containerd/pkg/metadata"
servertesting "github.com/kubernetes-incubator/cri-containerd/pkg/server/testing"
@@ -79,7 +79,6 @@ func getSandboxStatusTestData() (*metadata.SandboxMetadata, *runtime.PodSandboxS
Network: &runtime.PodSandboxNetworkStatus{Ip: ""},
Linux: &runtime.LinuxPodSandboxStatus{
Namespaces: &runtime.Namespace{
Network: sandboxStatusTestNetNS,
Options: &runtime.NamespaceOption{
HostNetwork: true,
HostPid: false,
@@ -94,29 +93,6 @@ func getSandboxStatusTestData() (*metadata.SandboxMetadata, *runtime.PodSandboxS
return metadata, expectedStatus
}
func TestToCRISandboxStatus(t *testing.T) {
for desc, test := range map[string]struct {
state runtime.PodSandboxState
expectNetNS string
}{
"ready sandbox should have network namespace": {
state: runtime.PodSandboxState_SANDBOX_READY,
expectNetNS: sandboxStatusTestNetNS,
},
"not ready sandbox should not have network namespace": {
state: runtime.PodSandboxState_SANDBOX_NOTREADY,
expectNetNS: "",
},
} {
metadata, expect := getSandboxStatusTestData()
status := toCRISandboxStatus(metadata, test.state, sandboxStatusTestIP)
expect.Linux.Namespaces.Network = test.expectNetNS
expect.State = test.state
expect.Network.Ip = sandboxStatusTestIP
assert.Equal(t, expect, status, desc)
}
}
func TestPodSandboxStatus(t *testing.T) {
for desc, test := range map[string]struct {
sandboxContainers []container.Container
@@ -238,9 +214,6 @@ func TestPodSandboxStatus(t *testing.T) {
assert.NoError(t, err)
require.NotNil(t, res)
expect.State = test.expectState
if expect.State == runtime.PodSandboxState_SANDBOX_NOTREADY {
expect.Linux.Namespaces.Network = ""
}
assert.Equal(t, expect, res.GetStatus())
}
}

View File

@@ -25,7 +25,7 @@ import (
"github.com/containerd/containerd/api/services/execution"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1"
)
// StopPodSandbox stops the sandbox. If there are any running containers in the

View File

@@ -29,7 +29,7 @@ import (
"github.com/containerd/containerd"
"github.com/containerd/containerd/api/types/container"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1"
"github.com/kubernetes-incubator/cri-containerd/pkg/metadata"
ostesting "github.com/kubernetes-incubator/cri-containerd/pkg/os/testing"

View File

@@ -26,7 +26,7 @@ import (
"github.com/golang/glog"
"google.golang.org/grpc"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1"
"k8s.io/kubernetes/pkg/util/interrupt"
)

View File

@@ -39,7 +39,7 @@ import (
osinterface "github.com/kubernetes-incubator/cri-containerd/pkg/os"
"github.com/kubernetes-incubator/cri-containerd/pkg/registrar"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1"
)
// TODO remove the underscores from the following imports as the services are

View File

@@ -21,6 +21,7 @@ import (
"os"
"testing"
"github.com/containerd/containerd/api/services/execution"
"github.com/docker/docker/pkg/truncindex"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -32,9 +33,7 @@ import (
"github.com/kubernetes-incubator/cri-containerd/pkg/registrar"
servertesting "github.com/kubernetes-incubator/cri-containerd/pkg/server/testing"
"github.com/containerd/containerd/api/services/execution"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1"
)
type nopReadWriteCloser struct{}
@@ -100,7 +99,6 @@ func TestSandboxOperations(t *testing.T) {
Network: &runtime.PodSandboxNetworkStatus{},
Linux: &runtime.LinuxPodSandboxStatus{
Namespaces: &runtime.Namespace{
Network: netns,
Options: &runtime.NamespaceOption{
HostNetwork: false,
HostPid: false,

View File

@@ -21,7 +21,7 @@ import (
"golang.org/x/net/context"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1"
)
// Status returns the status of the runtime.

View File

@@ -21,7 +21,7 @@ import (
"golang.org/x/net/context"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1"
)
// UpdateRuntimeConfig updates the runtime config. Currently only handles podCIDR updates.

View File

@@ -21,7 +21,7 @@ import (
"golang.org/x/net/context"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1"
)
// Version returns the runtime name, runtime version and runtime API version.