Merge pull request #45 from Crazykev/update-k8s-vendor

Update kubernetes vendor for new CRI change
This commit is contained in:
Lantao Liu 2017-05-23 20:22:12 -07:00 committed by GitHub
commit 751f119cbc
48 changed files with 1567 additions and 533 deletions

10
Godeps/Godeps.json generated
View File

@ -428,14 +428,14 @@
"Rev": "708a7f9f3283aa2d4f6132d287d78683babe55c8" "Rev": "708a7f9f3283aa2d4f6132d287d78683babe55c8"
}, },
{ {
"ImportPath": "k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime", "ImportPath": "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1",
"Comment": "v1.7.0-alpha.1-493-g32e927f", "Comment": "v1.7.0-alpha.2-1168-g1369a26",
"Rev": "32e927f4d86cfe7d3a7ad3c231fc445fb01463f5" "Rev": "1369a263f576270c85974e69b6ad8e7a80a6f494"
}, },
{ {
"ImportPath": "k8s.io/kubernetes/pkg/util/interrupt", "ImportPath": "k8s.io/kubernetes/pkg/util/interrupt",
"Comment": "v1.7.0-alpha.1-493-g32e927f", "Comment": "v1.7.0-alpha.2-1168-g1369a26",
"Rev": "32e927f4d86cfe7d3a7ad3c231fc445fb01463f5" "Rev": "1369a263f576270c85974e69b6ad8e7a80a6f494"
} }
] ]
} }

View File

@ -21,7 +21,7 @@ import (
"github.com/kubernetes-incubator/cri-containerd/pkg/metadata/store" "github.com/kubernetes-incubator/cri-containerd/pkg/metadata/store"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime" runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1"
) )
// The code is very similar with sandbox.go, but there is no template support // The code is very similar with sandbox.go, but there is no template support

View File

@ -24,7 +24,7 @@ import (
"github.com/kubernetes-incubator/cri-containerd/pkg/metadata/store" "github.com/kubernetes-incubator/cri-containerd/pkg/metadata/store"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime" runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1"
) )
func TestContainerState(t *testing.T) { func TestContainerState(t *testing.T) {

View File

@ -21,7 +21,7 @@ import (
"github.com/kubernetes-incubator/cri-containerd/pkg/metadata/store" "github.com/kubernetes-incubator/cri-containerd/pkg/metadata/store"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime" runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1"
) )
// TODO(random-liu): Handle versioning around all marshal/unmarshal. // TODO(random-liu): Handle versioning around all marshal/unmarshal.

View File

@ -24,7 +24,7 @@ import (
"github.com/kubernetes-incubator/cri-containerd/pkg/metadata/store" "github.com/kubernetes-incubator/cri-containerd/pkg/metadata/store"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime" runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1"
) )
func TestSandboxStore(t *testing.T) { func TestSandboxStore(t *testing.T) {

View File

@ -21,7 +21,7 @@ import (
"golang.org/x/net/context" "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. // 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" "github.com/golang/glog"
"golang.org/x/net/context" "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" "github.com/kubernetes-incubator/cri-containerd/pkg/metadata"
) )

View File

@ -24,7 +24,7 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"golang.org/x/net/context" "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" "github.com/kubernetes-incubator/cri-containerd/pkg/metadata"
ostesting "github.com/kubernetes-incubator/cri-containerd/pkg/os/testing" ostesting "github.com/kubernetes-incubator/cri-containerd/pkg/os/testing"

View File

@ -21,7 +21,7 @@ import (
"golang.org/x/net/context" "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. // 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" "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. // ExecSync executes a command in the container, and returns the stdout output.

View File

@ -22,7 +22,7 @@ import (
"github.com/golang/glog" "github.com/golang/glog"
"golang.org/x/net/context" "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" "github.com/kubernetes-incubator/cri-containerd/pkg/metadata"
) )

View File

@ -24,7 +24,7 @@ import (
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"golang.org/x/net/context" "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" "github.com/kubernetes-incubator/cri-containerd/pkg/metadata"
) )

View File

@ -22,7 +22,7 @@ import (
"github.com/golang/glog" "github.com/golang/glog"
"golang.org/x/net/context" "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" "github.com/kubernetes-incubator/cri-containerd/pkg/metadata"
) )

View File

@ -24,7 +24,7 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"golang.org/x/net/context" "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" "github.com/kubernetes-incubator/cri-containerd/pkg/metadata"
ostesting "github.com/kubernetes-incubator/cri-containerd/pkg/os/testing" 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/container"
"github.com/containerd/containerd/api/types/mount" "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" "github.com/kubernetes-incubator/cri-containerd/pkg/metadata"
) )

View File

@ -30,7 +30,7 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"golang.org/x/net/context" "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" "github.com/kubernetes-incubator/cri-containerd/pkg/metadata"
ostesting "github.com/kubernetes-incubator/cri-containerd/pkg/os/testing" ostesting "github.com/kubernetes-incubator/cri-containerd/pkg/os/testing"

View File

@ -22,7 +22,7 @@ import (
"github.com/golang/glog" "github.com/golang/glog"
"golang.org/x/net/context" "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" "github.com/kubernetes-incubator/cri-containerd/pkg/metadata"
) )

View File

@ -23,7 +23,7 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"golang.org/x/net/context" "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" "github.com/kubernetes-incubator/cri-containerd/pkg/metadata"
) )

View File

@ -26,7 +26,7 @@ import (
"github.com/containerd/containerd/api/services/execution" "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" "github.com/kubernetes-incubator/cri-containerd/pkg/metadata"
) )

View File

@ -25,7 +25,7 @@ import (
"github.com/containerd/containerd/api/types/container" "github.com/containerd/containerd/api/types/container"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"golang.org/x/net/context" "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" "github.com/kubernetes-incubator/cri-containerd/pkg/metadata"
servertesting "github.com/kubernetes-incubator/cri-containerd/pkg/server/testing" 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/containerd/containerd/api/types/container"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"golang.org/x/net/context" "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" "github.com/kubernetes-incubator/cri-containerd/pkg/metadata"
servertesting "github.com/kubernetes-incubator/cri-containerd/pkg/server/testing" 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" "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 ( const (

View File

@ -20,7 +20,7 @@ import (
"fmt" "fmt"
"golang.org/x/net/context" "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. // ListImages lists existing images.

View File

@ -28,7 +28,7 @@ import (
"github.com/golang/glog" "github.com/golang/glog"
imagespec "github.com/opencontainers/image-spec/specs-go/v1" imagespec "github.com/opencontainers/image-spec/specs-go/v1"
"golang.org/x/net/context" "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" "github.com/kubernetes-incubator/cri-containerd/pkg/metadata"
) )

View File

@ -19,7 +19,7 @@ package server
import ( import (
"golang.org/x/net/context" "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. // RemoveImage removes the image.

View File

@ -19,7 +19,7 @@ package server
import ( import (
"golang.org/x/net/context" "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. // 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/services/execution"
"github.com/containerd/containerd/api/types/container" "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" "github.com/kubernetes-incubator/cri-containerd/pkg/metadata"
) )

View File

@ -25,7 +25,7 @@ import (
"github.com/containerd/containerd/api/types/container" "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" "github.com/kubernetes-incubator/cri-containerd/pkg/metadata"
servertesting "github.com/kubernetes-incubator/cri-containerd/pkg/server/testing" servertesting "github.com/kubernetes-incubator/cri-containerd/pkg/server/testing"

View File

@ -21,7 +21,7 @@ import (
"golang.org/x/net/context" "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. // 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" "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" "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" ostesting "github.com/kubernetes-incubator/cri-containerd/pkg/os/testing"
servertesting "github.com/kubernetes-incubator/cri-containerd/pkg/server/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) { func TestRemovePodSandbox(t *testing.T) {

View File

@ -32,7 +32,7 @@ import (
"github.com/containerd/containerd/api/services/execution" "github.com/containerd/containerd/api/services/execution"
"github.com/containerd/containerd/api/types/mount" "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" "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" ostesting "github.com/kubernetes-incubator/cri-containerd/pkg/os/testing"
servertesting "github.com/kubernetes-incubator/cri-containerd/pkg/server/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)) { 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/services/execution"
"github.com/containerd/containerd/api/types/container" "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" "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. // toCRISandboxStatus converts sandbox metadata into CRI pod sandbox status.
func toCRISandboxStatus(meta *metadata.SandboxMetadata, state runtime.PodSandboxState, ip string) *runtime.PodSandboxStatus { func toCRISandboxStatus(meta *metadata.SandboxMetadata, state runtime.PodSandboxState, ip string) *runtime.PodSandboxStatus {
nsOpts := meta.Config.GetLinux().GetSecurityContext().GetNamespaceOptions() 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{ return &runtime.PodSandboxStatus{
Id: meta.ID, Id: meta.ID,
Metadata: meta.Config.GetMetadata(), Metadata: meta.Config.GetMetadata(),
@ -89,9 +80,6 @@ func toCRISandboxStatus(meta *metadata.SandboxMetadata, state runtime.PodSandbox
Network: &runtime.PodSandboxNetworkStatus{Ip: ip}, Network: &runtime.PodSandboxNetworkStatus{Ip: ip},
Linux: &runtime.LinuxPodSandboxStatus{ Linux: &runtime.LinuxPodSandboxStatus{
Namespaces: &runtime.Namespace{ Namespaces: &runtime.Namespace{
// TODO(random-liu): Revendor new CRI version and get
// rid of this field.
Network: netNS,
Options: &runtime.NamespaceOption{ Options: &runtime.NamespaceOption{
HostNetwork: nsOpts.GetHostNetwork(), HostNetwork: nsOpts.GetHostNetwork(),
HostPid: nsOpts.GetHostPid(), HostPid: nsOpts.GetHostPid(),

View File

@ -27,7 +27,7 @@ import (
"github.com/containerd/containerd/api/types/container" "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" "github.com/kubernetes-incubator/cri-containerd/pkg/metadata"
servertesting "github.com/kubernetes-incubator/cri-containerd/pkg/server/testing" servertesting "github.com/kubernetes-incubator/cri-containerd/pkg/server/testing"
@ -79,7 +79,6 @@ func getSandboxStatusTestData() (*metadata.SandboxMetadata, *runtime.PodSandboxS
Network: &runtime.PodSandboxNetworkStatus{Ip: ""}, Network: &runtime.PodSandboxNetworkStatus{Ip: ""},
Linux: &runtime.LinuxPodSandboxStatus{ Linux: &runtime.LinuxPodSandboxStatus{
Namespaces: &runtime.Namespace{ Namespaces: &runtime.Namespace{
Network: sandboxStatusTestNetNS,
Options: &runtime.NamespaceOption{ Options: &runtime.NamespaceOption{
HostNetwork: true, HostNetwork: true,
HostPid: false, HostPid: false,
@ -94,29 +93,6 @@ func getSandboxStatusTestData() (*metadata.SandboxMetadata, *runtime.PodSandboxS
return metadata, expectedStatus 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) { func TestPodSandboxStatus(t *testing.T) {
for desc, test := range map[string]struct { for desc, test := range map[string]struct {
sandboxContainers []container.Container sandboxContainers []container.Container
@ -238,9 +214,6 @@ func TestPodSandboxStatus(t *testing.T) {
assert.NoError(t, err) assert.NoError(t, err)
require.NotNil(t, res) require.NotNil(t, res)
expect.State = test.expectState expect.State = test.expectState
if expect.State == runtime.PodSandboxState_SANDBOX_NOTREADY {
expect.Linux.Namespaces.Network = ""
}
assert.Equal(t, expect, res.GetStatus()) assert.Equal(t, expect, res.GetStatus())
} }
} }

View File

@ -25,7 +25,7 @@ import (
"github.com/containerd/containerd/api/services/execution" "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 // 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"
"github.com/containerd/containerd/api/types/container" "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" "github.com/kubernetes-incubator/cri-containerd/pkg/metadata"
ostesting "github.com/kubernetes-incubator/cri-containerd/pkg/os/testing" ostesting "github.com/kubernetes-incubator/cri-containerd/pkg/os/testing"

View File

@ -26,7 +26,7 @@ import (
"github.com/golang/glog" "github.com/golang/glog"
"google.golang.org/grpc" "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" "k8s.io/kubernetes/pkg/util/interrupt"
) )

View File

@ -39,7 +39,7 @@ import (
osinterface "github.com/kubernetes-incubator/cri-containerd/pkg/os" osinterface "github.com/kubernetes-incubator/cri-containerd/pkg/os"
"github.com/kubernetes-incubator/cri-containerd/pkg/registrar" "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 // TODO remove the underscores from the following imports as the services are

View File

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

View File

@ -21,7 +21,7 @@ import (
"golang.org/x/net/context" "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. // Status returns the status of the runtime.

View File

@ -21,7 +21,7 @@ import (
"golang.org/x/net/context" "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. // UpdateRuntimeConfig updates the runtime config. Currently only handles podCIDR updates.

View File

@ -21,7 +21,7 @@ import (
"golang.org/x/net/context" "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. // Version returns the runtime name, runtime version and runtime API version.

View File

@ -1,7 +1,7 @@
// To regenerate api.pb.go run hack/update-generated-runtime.sh // To regenerate api.pb.go run hack/update-generated-runtime.sh
syntax = 'proto3'; syntax = 'proto3';
package runtime; package v1alpha1;
import "github.com/gogo/protobuf/gogoproto/gogo.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto";
@ -36,7 +36,8 @@ service RuntimeService {
// This call is idempotent, and must not return an error if the sandbox has // This call is idempotent, and must not return an error if the sandbox has
// already been removed. // already been removed.
rpc RemovePodSandbox(RemovePodSandboxRequest) returns (RemovePodSandboxResponse) {} rpc RemovePodSandbox(RemovePodSandboxRequest) returns (RemovePodSandboxResponse) {}
// PodSandboxStatus returns the status of the PodSandbox. // PodSandboxStatus returns the status of the PodSandbox. If the PodSandbox is not
// present, returns an error.
rpc PodSandboxStatus(PodSandboxStatusRequest) returns (PodSandboxStatusResponse) {} rpc PodSandboxStatus(PodSandboxStatusRequest) returns (PodSandboxStatusResponse) {}
// ListPodSandbox returns a list of PodSandboxes. // ListPodSandbox returns a list of PodSandboxes.
rpc ListPodSandbox(ListPodSandboxRequest) returns (ListPodSandboxResponse) {} rpc ListPodSandbox(ListPodSandboxRequest) returns (ListPodSandboxResponse) {}
@ -57,7 +58,8 @@ service RuntimeService {
rpc RemoveContainer(RemoveContainerRequest) returns (RemoveContainerResponse) {} rpc RemoveContainer(RemoveContainerRequest) returns (RemoveContainerResponse) {}
// ListContainers lists all containers by filters. // ListContainers lists all containers by filters.
rpc ListContainers(ListContainersRequest) returns (ListContainersResponse) {} rpc ListContainers(ListContainersRequest) returns (ListContainersResponse) {}
// ContainerStatus returns status of the container. // ContainerStatus returns status of the container. If the container is not
// present, returns an error.
rpc ContainerStatus(ContainerStatusRequest) returns (ContainerStatusResponse) {} rpc ContainerStatus(ContainerStatusRequest) returns (ContainerStatusResponse) {}
// ExecSync runs a command in a container synchronously. // ExecSync runs a command in a container synchronously.
@ -90,6 +92,8 @@ service ImageService {
// This call is idempotent, and must not return an error if the image has // This call is idempotent, and must not return an error if the image has
// already been removed. // already been removed.
rpc RemoveImage(RemoveImageRequest) returns (RemoveImageResponse) {} rpc RemoveImage(RemoveImageRequest) returns (RemoveImageResponse) {}
// ImageFSInfo returns information of the filesystem that is used to store images.
rpc ImageFsInfo(ImageFsInfoRequest) returns (ImageFsInfoResponse) {}
} }
message VersionRequest { message VersionRequest {
@ -269,17 +273,7 @@ message PodSandboxConfig {
// and the CRI). Whenever possible, however, runtime authors SHOULD // and the CRI). Whenever possible, however, runtime authors SHOULD
// consider proposing new typed fields for any new features instead. // consider proposing new typed fields for any new features instead.
// //
// 1. AppArmor // 1. Seccomp
//
// key: container.apparmor.security.beta.kubernetes.io/<container_name>
// description: apparmor profile for a container in this pod.
// value:
// * runtime/default: equivalent to not specifying a profile.
// * localhost/<profile_name>: profile loaded on the node
// (localhost) by name. The possible profile names are detailed at
// http://wiki.apparmor.net/index.php/AppArmor_Core_Policy_Reference
//
// 2. Seccomp
// //
// key: security.alpha.kubernetes.io/seccomp/pod // key: security.alpha.kubernetes.io/seccomp/pod
// description: the seccomp profile for the containers of an entire pod. // description: the seccomp profile for the containers of an entire pod.
@ -296,7 +290,7 @@ message PodSandboxConfig {
// local seccomp profile root. Note that profile root is set in // local seccomp profile root. Note that profile root is set in
// kubelet, and it is not passed in CRI yet, see https://issues.k8s.io/36997. // kubelet, and it is not passed in CRI yet, see https://issues.k8s.io/36997.
// //
// 3. Sysctls // 2. Sysctls
// //
// key: security.alpha.kubernetes.io/sysctls // key: security.alpha.kubernetes.io/sysctls
// description: list of safe sysctls which are set for the sandbox. // description: list of safe sysctls which are set for the sandbox.
@ -348,8 +342,6 @@ message PodSandboxNetworkStatus {
// Namespace contains paths to the namespaces. // Namespace contains paths to the namespaces.
message Namespace { message Namespace {
// Path to the network namespace.
string network = 1;
// Namespace options for Linux namespaces. // Namespace options for Linux namespaces.
NamespaceOption options = 2; NamespaceOption options = 2;
} }
@ -526,6 +518,12 @@ message LinuxContainerSecurityContext {
// List of groups applied to the first process run in the container, in // List of groups applied to the first process run in the container, in
// addition to the container's primary GID. // addition to the container's primary GID.
repeated int64 supplemental_groups = 8; repeated int64 supplemental_groups = 8;
// AppArmor profile for the container, candidate values are:
// * runtime/default: equivalent to not specifying a profile.
// * localhost/<profile_name>: profile loaded on the node
// (localhost) by name. The possible profile names are detailed at
// http://wiki.apparmor.net/index.php/AppArmor_Core_Policy_Reference
string apparmor_profile = 9;
} }
// LinuxContainerConfig contains platform-specific configuration for // LinuxContainerConfig contains platform-specific configuration for
@ -772,6 +770,8 @@ message ContainerStatus {
map<string,string> annotations = 13; map<string,string> annotations = 13;
// Mounts for the container. // Mounts for the container.
repeated Mount mounts = 14; repeated Mount mounts = 14;
// Log path of container.
string log_path = 15;
} }
message ContainerStatusResponse { message ContainerStatusResponse {
@ -970,3 +970,42 @@ message StatusResponse {
// Status of the Runtime. // Status of the Runtime.
RuntimeStatus status = 1; RuntimeStatus status = 1;
} }
message ImageFsInfoRequest {}
// UInt64Value is the wrapper of uint64.
message UInt64Value {
// The value.
uint64 value = 1;
}
// FsInfo contains data about filesystem usage.
message FsInfo {
// The block device name associated with the filesystem.
string device = 1;
// The root directory for the images.
string path = 2;
// CapacityBytes represents the total capacity (bytes) of the filesystems
// underlying storage.
UInt64Value capacity_bytes = 3;
// AvailableBytes represents the storage space available (bytes) for the
// filesystem.
UInt64Value available_bytes = 4;
// UsedBytes represents the bytes used for images on the filesystem.
// This may differ from the total bytes used on the filesystem and may not
// equal CapacityBytes - AvailableBytes.
UInt64Value used_bytes = 5;
// InodesCapacity represents the total inodes in the filesystem.
UInt64Value inodes_capacity = 6;
// InodesAvailable represents the free inodes in the filesystem.
UInt64Value inodes_available = 7;
// InodesUsed represents the inodes used by the images.
// This may not equal InodesCapacity - InodesAvailable because the underlying
// filesystem may also be used for purposes other than storing images.
UInt64Value inodes_used = 8;
}
message ImageFsInfoResponse {
// filesystem information of images.
FsInfo fs_info = 1;
}

View File

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package runtime package v1alpha1
// This file contains all constants defined in CRI. // This file contains all constants defined in CRI.