mirror of https://github.com/k3s-io/k3s
kubelet: remove the rktshim directory
This package contains only placeholders without actual implementation. Since it is not currently under active development, remove it to avoid unnecessary change needed whenever the interface is changed.pull/6/head
parent
88abb431ae
commit
318606ca5c
|
@ -204,7 +204,6 @@ pkg/kubelet/prober/testing
|
|||
pkg/kubelet/qos
|
||||
pkg/kubelet/remote
|
||||
pkg/kubelet/rkt
|
||||
pkg/kubelet/rktshim
|
||||
pkg/kubelet/secret
|
||||
pkg/kubelet/server
|
||||
pkg/kubelet/server/portforward
|
||||
|
|
|
@ -278,7 +278,6 @@ filegroup(
|
|||
"//pkg/kubelet/qos:all-srcs",
|
||||
"//pkg/kubelet/remote:all-srcs",
|
||||
"//pkg/kubelet/rkt:all-srcs",
|
||||
"//pkg/kubelet/rktshim:all-srcs",
|
||||
"//pkg/kubelet/secret:all-srcs",
|
||||
"//pkg/kubelet/server:all-srcs",
|
||||
"//pkg/kubelet/stats:all-srcs",
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load(
|
||||
"@io_bazel_rules_go//go:def.bzl",
|
||||
"go_library",
|
||||
"go_test",
|
||||
)
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = [
|
||||
"app-interface.go",
|
||||
"doc.go",
|
||||
"fake-app-interface.go",
|
||||
"imagestore.go",
|
||||
"pod-level-interface.go",
|
||||
],
|
||||
importpath = "k8s.io/kubernetes/pkg/kubelet/rktshim",
|
||||
deps = [
|
||||
"//pkg/kubelet/apis/cri:go_default_library",
|
||||
"//pkg/kubelet/apis/cri/v1alpha1/runtime:go_default_library",
|
||||
"//pkg/kubelet/util/ioutils:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
go_test(
|
||||
name = "go_default_test",
|
||||
srcs = ["imagestore_test.go"],
|
||||
embed = [":go_default_library"],
|
||||
importpath = "k8s.io/kubernetes/pkg/kubelet/rktshim",
|
||||
deps = ["//pkg/kubelet/apis/cri/v1alpha1/runtime:go_default_library"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "package-srcs",
|
||||
srcs = glob(["**"]),
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [":package-srcs"],
|
||||
tags = ["automanaged"],
|
||||
)
|
|
@ -1,3 +0,0 @@
|
|||
approvers:
|
||||
- euank
|
||||
- yifan-gu
|
|
@ -1,87 +0,0 @@
|
|||
/*
|
||||
Copyright 2016 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 rktshim
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
kubeletapi "k8s.io/kubernetes/pkg/kubelet/apis/cri"
|
||||
runtimeapi "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
|
||||
)
|
||||
|
||||
// Runtime provides an API for lifecycle, inspection and introspection
|
||||
// operations in a blocking manner using the App level API provided by rkt.
|
||||
type Runtime struct{}
|
||||
|
||||
// TODO(tmrts): Fill out the creation configuration fields.
|
||||
type RuntimeConfig struct{}
|
||||
|
||||
// NewRuntime creates a container.Runtime instance using the Runtime.
|
||||
func NewRuntime(RuntimeConfig) (kubeletapi.ContainerManager, error) {
|
||||
return &Runtime{}, nil
|
||||
}
|
||||
|
||||
// CreateContainer creates an app inside the provided pod sandbox and returns the RawContainerID.
|
||||
func (*Runtime) CreateContainer(string, *runtimeapi.ContainerConfig, *runtimeapi.PodSandboxConfig) (string, error) {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
// StartContainer starts a created app.
|
||||
func (*Runtime) StartContainer(string) error {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
// StopContainer stops a running app with a grace period (i.e. timeout).
|
||||
func (*Runtime) StopContainer(string, int64) error {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
// RemoveContainer removes the app from a pod sandbox.
|
||||
func (*Runtime) RemoveContainer(string) error {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
// ListContainers lists out the apps residing inside the pod sandbox using the ContainerFilter.
|
||||
func (*Runtime) ListContainers(*runtimeapi.ContainerFilter) ([]*runtimeapi.Container, error) {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
// ContainerStatus returns the RawContainerStatus of an app inside the pod sandbox.
|
||||
func (*Runtime) ContainerStatus(string) (*runtimeapi.ContainerStatus, error) {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
// UpdateContainerResources updates the resource constraints for the container.
|
||||
func (*Runtime) UpdateContainerResources(string, *runtimeapi.LinuxContainerResources) error {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
// ExecSync executes a command in the container, and returns the stdout output.
|
||||
// If command exits with a non-zero exit code, an error is returned.
|
||||
func (*Runtime) ExecSync(containerID string, cmd []string, timeout time.Duration) (stdout []byte, stderr []byte, err error) {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
// Exec prepares a streaming endpoint to execute a command in the container, and returns the address.
|
||||
func (*Runtime) Exec(*runtimeapi.ExecRequest) (*runtimeapi.ExecResponse, error) {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
// Attach prepares a streaming endpoint to attach to a running container, and returns the address.
|
||||
func (*Runtime) Attach(req *runtimeapi.AttachRequest) (*runtimeapi.AttachResponse, error) {
|
||||
panic("not implemented")
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
/*
|
||||
Copyright 2016 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 rktshim is the package that contains the shim code for rkt to be used
|
||||
// as the kubelet container runtime implementation that is integrated using the
|
||||
// Container Runtime Interface.
|
||||
package rktshim
|
|
@ -1,242 +0,0 @@
|
|||
/*
|
||||
Copyright 2016 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 rktshim
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"io"
|
||||
"math/rand"
|
||||
"time"
|
||||
|
||||
kubeletapi "k8s.io/kubernetes/pkg/kubelet/apis/cri"
|
||||
runtimeapi "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
|
||||
"k8s.io/kubernetes/pkg/kubelet/util/ioutils"
|
||||
)
|
||||
|
||||
const (
|
||||
FakeStreamingHost = "localhost"
|
||||
FakeStreamingPort = "12345"
|
||||
)
|
||||
|
||||
func init() {
|
||||
// Don't randomize due to testing purposes
|
||||
// rand.Seed(time.Now().UnixNano())
|
||||
}
|
||||
|
||||
func randString(n int) string {
|
||||
runeAlphabet := []rune("abcdefghijklmnopqrstuvwxyz")
|
||||
dictLen := len(runeAlphabet)
|
||||
|
||||
buf := make([]rune, n)
|
||||
for i := range buf {
|
||||
buf[i] = runeAlphabet[rand.Intn(dictLen)]
|
||||
}
|
||||
|
||||
return string(buf)
|
||||
}
|
||||
|
||||
var (
|
||||
ErrContainerNotFound = errors.New("rktshim: container not found")
|
||||
ErrInvalidContainerStateTransition = errors.New("rktshim: wrong container operation for current state")
|
||||
)
|
||||
|
||||
type FakeRuntime struct {
|
||||
Containers containerRegistry
|
||||
}
|
||||
|
||||
type FakeRuntimeConfig struct{}
|
||||
|
||||
func NewFakeRuntime() (kubeletapi.ContainerManager, error) {
|
||||
return &FakeRuntime{Containers: make(containerRegistry)}, nil
|
||||
}
|
||||
|
||||
type characterStreams struct {
|
||||
In io.Reader
|
||||
Out io.Writer
|
||||
Err io.Writer
|
||||
}
|
||||
|
||||
func newCharacterStreams(in io.Reader, out io.Writer, err io.Writer) characterStreams {
|
||||
std := characterStreams{in, out, err}
|
||||
|
||||
return std
|
||||
}
|
||||
|
||||
type fakeContainer struct {
|
||||
Config *runtimeapi.ContainerConfig
|
||||
|
||||
Status runtimeapi.ContainerStatus
|
||||
|
||||
State runtimeapi.ContainerState
|
||||
|
||||
Streams characterStreams
|
||||
}
|
||||
|
||||
func (c *fakeContainer) Start() {
|
||||
c.State = runtimeapi.ContainerState_CONTAINER_RUNNING
|
||||
|
||||
c.Status.State = c.State
|
||||
}
|
||||
|
||||
func (c *fakeContainer) Stop() {
|
||||
c.State = runtimeapi.ContainerState_CONTAINER_EXITED
|
||||
|
||||
c.Status.State = c.State
|
||||
c.Status.ExitCode = 0
|
||||
|
||||
// c.Status.Reason
|
||||
}
|
||||
|
||||
func (c *fakeContainer) Exec(cmd []string, in io.Reader, out, err io.WriteCloser) error {
|
||||
// TODO(tmrts): incomplete command execution logic
|
||||
// c.StreamCompare(c.Streams.In, s.InputStream)
|
||||
// c.StreamFlush(c.Streams.Out, s.OutputStream)
|
||||
// c.StreamFlush(c.Streams.Err, s.ErrorStream)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type containerRegistry map[string]*fakeContainer
|
||||
|
||||
func (r *FakeRuntime) CreateContainer(pid string, cfg *runtimeapi.ContainerConfig, sandboxCfg *runtimeapi.PodSandboxConfig) (string, error) {
|
||||
// TODO(tmrts): allow customization
|
||||
containerIDLength := 8
|
||||
|
||||
cid := randString(containerIDLength)
|
||||
|
||||
r.Containers[cid] = &fakeContainer{
|
||||
Config: cfg,
|
||||
Streams: newCharacterStreams(nil, nil, nil),
|
||||
}
|
||||
|
||||
return cid, nil
|
||||
}
|
||||
|
||||
func (r *FakeRuntime) StartContainer(id string) error {
|
||||
c, ok := r.Containers[id]
|
||||
if !ok {
|
||||
return ErrContainerNotFound
|
||||
}
|
||||
switch c.State {
|
||||
case runtimeapi.ContainerState_CONTAINER_EXITED:
|
||||
fallthrough
|
||||
case runtimeapi.ContainerState_CONTAINER_CREATED:
|
||||
c.Start()
|
||||
case runtimeapi.ContainerState_CONTAINER_UNKNOWN:
|
||||
// TODO(tmrts): add timeout to Start API or generalize timeout somehow
|
||||
//<-time.After(time.Duration(timeout) * time.Second)
|
||||
fallthrough
|
||||
default:
|
||||
return ErrInvalidContainerStateTransition
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *FakeRuntime) StopContainer(id string, timeout int64) error {
|
||||
c, ok := r.Containers[id]
|
||||
if !ok {
|
||||
return ErrContainerNotFound
|
||||
}
|
||||
|
||||
switch c.State {
|
||||
case runtimeapi.ContainerState_CONTAINER_RUNNING:
|
||||
c.State = runtimeapi.ContainerState_CONTAINER_EXITED // This state might not be the best one
|
||||
case runtimeapi.ContainerState_CONTAINER_UNKNOWN:
|
||||
<-time.After(time.Duration(timeout) * time.Second)
|
||||
fallthrough
|
||||
default:
|
||||
return ErrInvalidContainerStateTransition
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *FakeRuntime) RemoveContainer(id string) error {
|
||||
_, ok := r.Containers[id]
|
||||
if !ok {
|
||||
return ErrContainerNotFound
|
||||
}
|
||||
|
||||
// Remove regardless of the container state
|
||||
delete(r.Containers, id)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *FakeRuntime) ListContainers(*runtimeapi.ContainerFilter) ([]*runtimeapi.Container, error) {
|
||||
list := []*runtimeapi.Container{}
|
||||
|
||||
// TODO(tmrts): apply the filter
|
||||
for _, c := range r.Containers {
|
||||
list = append(list, &runtimeapi.Container{
|
||||
Id: c.Status.Id,
|
||||
Metadata: c.Config.Metadata,
|
||||
Labels: c.Config.Labels,
|
||||
ImageRef: c.Status.ImageRef,
|
||||
State: c.State,
|
||||
})
|
||||
}
|
||||
|
||||
return list, nil
|
||||
}
|
||||
|
||||
func (r *FakeRuntime) ContainerStatus(id string) (*runtimeapi.ContainerStatus, error) {
|
||||
c, ok := r.Containers[id]
|
||||
if !ok {
|
||||
return &runtimeapi.ContainerStatus{}, ErrContainerNotFound
|
||||
}
|
||||
|
||||
return &c.Status, nil
|
||||
}
|
||||
|
||||
func (r *FakeRuntime) UpdateContainerResources(string, *runtimeapi.LinuxContainerResources) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *FakeRuntime) ExecSync(containerID string, cmd []string, timeout time.Duration) (stdout []byte, stderr []byte, err error) {
|
||||
c, ok := r.Containers[containerID]
|
||||
if !ok {
|
||||
return nil, nil, ErrContainerNotFound
|
||||
}
|
||||
|
||||
// TODO(tmrts): Validate the assumption that container has to be running for exec to work.
|
||||
if c.State != runtimeapi.ContainerState_CONTAINER_RUNNING {
|
||||
return nil, nil, ErrInvalidContainerStateTransition
|
||||
}
|
||||
|
||||
var stdoutBuffer, stderrBuffer bytes.Buffer
|
||||
err = c.Exec(cmd, nil,
|
||||
ioutils.WriteCloserWrapper(&stdoutBuffer),
|
||||
ioutils.WriteCloserWrapper(&stderrBuffer))
|
||||
return stdoutBuffer.Bytes(), stderrBuffer.Bytes(), err
|
||||
}
|
||||
|
||||
func (r *FakeRuntime) Exec(req *runtimeapi.ExecRequest) (*runtimeapi.ExecResponse, error) {
|
||||
url := "http://" + FakeStreamingHost + ":" + FakeStreamingPort + "/exec/" + req.ContainerId
|
||||
return &runtimeapi.ExecResponse{
|
||||
Url: url,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (r *FakeRuntime) Attach(req *runtimeapi.AttachRequest) (*runtimeapi.AttachResponse, error) {
|
||||
url := "http://" + FakeStreamingHost + ":" + FakeStreamingPort + "/attach/" + req.ContainerId
|
||||
return &runtimeapi.AttachResponse{
|
||||
Url: url,
|
||||
}, nil
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
/*
|
||||
Copyright 2016 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 rktshim
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
runtimeapi "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
|
||||
)
|
||||
|
||||
// TODO(tmrts): Move these errors to the container API for code re-use.
|
||||
var (
|
||||
ErrImageNotFound = errors.New("rktshim: image not found")
|
||||
)
|
||||
|
||||
// var _ kubeletApi.ImageManagerService = (*ImageStore)(nil)
|
||||
|
||||
// ImageStore supports CRUD operations for images.
|
||||
type ImageStore struct{}
|
||||
|
||||
// TODO(tmrts): fill the image store configuration fields.
|
||||
type ImageStoreConfig struct{}
|
||||
|
||||
// NewImageStore creates an image storage that allows CRUD operations for images.
|
||||
func NewImageStore(ImageStoreConfig) (*ImageStore, error) {
|
||||
return &ImageStore{}, nil
|
||||
}
|
||||
|
||||
// List lists the images residing in the image store.
|
||||
func (*ImageStore) List() ([]runtimeapi.Image, error) {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
// Pull pulls an image into the image store and uses the given authentication method.
|
||||
func (*ImageStore) Pull(runtimeapi.ImageSpec, runtimeapi.AuthConfig, *runtimeapi.PodSandboxConfig) error {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
// Remove removes the image from the image store.
|
||||
func (*ImageStore) Remove(runtimeapi.ImageSpec) error {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
// Status returns the status of the image.
|
||||
func (*ImageStore) Status(runtimeapi.ImageSpec) (runtimeapi.Image, error) {
|
||||
panic("not implemented")
|
||||
}
|
|
@ -1,210 +0,0 @@
|
|||
/*
|
||||
Copyright 2016 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 rktshim
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
runtimeapi "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
|
||||
)
|
||||
|
||||
var (
|
||||
emptyImgStoreConfig = ImageStoreConfig{}
|
||||
// TODO(tmrts): fill the pod configuration
|
||||
testPodConfig *runtimeapi.PodSandboxConfig = nil
|
||||
)
|
||||
|
||||
type imageTestCase struct {
|
||||
Spec *runtimeapi.ImageSpec
|
||||
ExpectedStatus *runtimeapi.Image
|
||||
}
|
||||
|
||||
func compareContainerImages(got, expected runtimeapi.Image) error {
|
||||
if got.Id != expected.Id {
|
||||
return fmt.Errorf("mismatching Ids -> expected %q, got %q", got.Id, expected.Id)
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(got.RepoTags, expected.RepoTags) {
|
||||
return fmt.Errorf("mismatching RepoTags -> expected %q, got %q", got.Id, expected.Id)
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(got.RepoDigests, expected.RepoDigests) {
|
||||
return fmt.Errorf("mismatching RepoDigests -> expected %q, got %q", got.Id, expected.Id)
|
||||
}
|
||||
|
||||
if got.Size_ != expected.Size_ {
|
||||
return fmt.Errorf("mismatching Sizes -> expected %q, got %q", got.Id, expected.Id)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
var (
|
||||
busyboxStr = "busybox"
|
||||
gibberishStr = "XXXX_GIBBERISH_XXXX"
|
||||
)
|
||||
|
||||
var testImgSpecs = map[string]imageTestCase{
|
||||
"non-existent-image": {
|
||||
&runtimeapi.ImageSpec{
|
||||
Image: gibberishStr,
|
||||
},
|
||||
nil,
|
||||
},
|
||||
"busybox": {
|
||||
&runtimeapi.ImageSpec{
|
||||
Image: busyboxStr,
|
||||
},
|
||||
&runtimeapi.Image{
|
||||
Id: "",
|
||||
RepoTags: []string{},
|
||||
RepoDigests: []string{},
|
||||
Size_: 0,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
var testAuthConfig = map[string]runtimeapi.AuthConfig{
|
||||
"no-auth": {},
|
||||
}
|
||||
|
||||
func testNewImageStore(t *testing.T, cfg ImageStoreConfig) *ImageStore {
|
||||
s, err := NewImageStore(cfg)
|
||||
if err != nil {
|
||||
// TODO(tmrts): Implement stringer for rktshim.ImageStoreConfig for test readability.
|
||||
t.Fatalf("rktshim.NewImageStore(%s) got error %q", cfg, err)
|
||||
}
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
func TestPullsImageWithoutAuthentication(t *testing.T) {
|
||||
t.SkipNow()
|
||||
|
||||
imgStore := testNewImageStore(t, emptyImgStoreConfig)
|
||||
|
||||
testImg := "busybox"
|
||||
testImgSpec := *testImgSpecs[testImg].Spec
|
||||
|
||||
if err := imgStore.Pull(testImgSpec, testAuthConfig["no-auth"], testPodConfig); err != nil {
|
||||
t.Fatalf("rktshim.ImageStore.PullImage(%q) got error %q", testImg, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestQueriesNonExistentImage(t *testing.T) {
|
||||
t.SkipNow()
|
||||
|
||||
imgStore := testNewImageStore(t, emptyImgStoreConfig)
|
||||
|
||||
// New store shouldn't contain this image
|
||||
testImg := "non-existent-image"
|
||||
testImgSpec := *testImgSpecs[testImg].Spec
|
||||
|
||||
if _, err := imgStore.Status(testImgSpec); err != ErrImageNotFound {
|
||||
t.Errorf("rktshim.ImageStore.Status(%q) expected error %q, got %q", testImg, ErrImageNotFound, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestQueriesExistentImage(t *testing.T) {
|
||||
t.SkipNow()
|
||||
|
||||
imgStore := testNewImageStore(t, emptyImgStoreConfig)
|
||||
|
||||
testImg := "busybox"
|
||||
testImgSpec := *testImgSpecs[testImg].Spec
|
||||
expectedStatus := *testImgSpecs[testImg].ExpectedStatus
|
||||
|
||||
imgStatus, err := imgStore.Status(testImgSpec)
|
||||
if err != nil {
|
||||
t.Fatalf("rktshim.ImageStore.Status(%q) got error %q", testImg, err)
|
||||
}
|
||||
|
||||
if err := compareContainerImages(imgStatus, expectedStatus); err != nil {
|
||||
t.Errorf("rktshim.ImageStore.Status(%q) %v", testImg, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRemovesImage(t *testing.T) {
|
||||
t.SkipNow()
|
||||
|
||||
imgStore := testNewImageStore(t, emptyImgStoreConfig)
|
||||
|
||||
testImg := "busybox"
|
||||
testImgSpec := *testImgSpecs[testImg].Spec
|
||||
|
||||
if err := imgStore.Pull(testImgSpec, testAuthConfig["no-auth"], testPodConfig); err != nil {
|
||||
t.Fatalf("rktshim.ImageStore.Pull(%q) got error %q", testImg, err)
|
||||
}
|
||||
|
||||
if _, err := imgStore.Status(testImgSpec); err != nil {
|
||||
t.Fatalf("rktshim.ImageStore.Status(%q) got error %q", testImg, err)
|
||||
}
|
||||
|
||||
if err := imgStore.Remove(testImgSpec); err != nil {
|
||||
t.Fatalf("rktshim.ImageStore.Remove(%q) got error %q", testImg, err)
|
||||
}
|
||||
|
||||
if _, err := imgStore.Status(testImgSpec); err != ErrImageNotFound {
|
||||
t.Fatalf("rktshim.ImageStore.Status(%q) expected error %q, got error %q", testImg, ErrImageNotFound, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRemovesNonExistentImage(t *testing.T) {
|
||||
t.SkipNow()
|
||||
|
||||
imgStore := testNewImageStore(t, emptyImgStoreConfig)
|
||||
|
||||
testImg := "non-existent-image"
|
||||
testImgSpec := *testImgSpecs[testImg].Spec
|
||||
|
||||
if err := imgStore.Remove(testImgSpec); err != ErrImageNotFound {
|
||||
t.Fatalf("rktshim.ImageStore.Remove(%q) expected error %q, got error %q", testImg, ErrImageNotFound, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestListsImages(t *testing.T) {
|
||||
t.SkipNow()
|
||||
|
||||
imgStore := testNewImageStore(t, emptyImgStoreConfig)
|
||||
|
||||
busyboxImg := "busybox"
|
||||
busyboxImgSpec := *testImgSpecs[busyboxImg].Spec
|
||||
if err := imgStore.Pull(busyboxImgSpec, testAuthConfig["no-auth"], testPodConfig); err != nil {
|
||||
t.Fatalf("rktshim.ImageStore.Pull(%q) got error %q", busyboxImg, err)
|
||||
}
|
||||
|
||||
alpineImg := "alpine"
|
||||
alpineImgSpec := *testImgSpecs[alpineImg].Spec
|
||||
if err := imgStore.Pull(alpineImgSpec, testAuthConfig["no-auth"], testPodConfig); err != nil {
|
||||
t.Fatalf("rktshim.ImageStore.Pull(%q) got error %q", alpineImg, err)
|
||||
}
|
||||
|
||||
imgs, err := imgStore.List()
|
||||
if err != nil {
|
||||
t.Fatalf("rktshim.ImageStore.List() got error %q", err)
|
||||
}
|
||||
|
||||
for _, img := range imgs {
|
||||
expectedImg := *testImgSpecs[img.Id].ExpectedStatus
|
||||
|
||||
if err := compareContainerImages(img, expectedImg); err != nil {
|
||||
t.Errorf("rktshim.ImageStore.List() for %q, %v", img.Id, err)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
/*
|
||||
Copyright 2016 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 rktshim
|
||||
|
||||
import (
|
||||
kubeletapi "k8s.io/kubernetes/pkg/kubelet/apis/cri"
|
||||
runtimeapi "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
|
||||
)
|
||||
|
||||
// PodSandboxManager provides basic operations to create/delete and examine
|
||||
// the pod sandboxes in a blocking manner.
|
||||
type PodSandboxManager struct{}
|
||||
|
||||
// TODO(tmrts): Fill the configuration struct fields.
|
||||
type PodSandboxManagerConfig struct{}
|
||||
|
||||
// NewPodSandboxManager creates a PodSandboxManager.
|
||||
func NewPodSandboxManager(PodSandboxManagerConfig) (kubeletapi.PodSandboxManager, error) {
|
||||
return &PodSandboxManager{}, nil
|
||||
}
|
||||
|
||||
// RunPodSandbox creates and starts a pod sandbox given a pod sandbox configuration.
|
||||
func (*PodSandboxManager) RunPodSandbox(*runtimeapi.PodSandboxConfig) (string, error) {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
// StopPodSandbox stops a pod sandbox and the apps inside the sandbox.
|
||||
func (*PodSandboxManager) StopPodSandbox(string) error {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
// RemovePodSandbox deletes the pod sandbox and the apps inside the sandbox.
|
||||
func (*PodSandboxManager) RemovePodSandbox(string) error {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
// PodSandboxStatus queries the status of the pod sandbox.
|
||||
func (*PodSandboxManager) PodSandboxStatus(string) (*runtimeapi.PodSandboxStatus, error) {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
// ListPodSandbox lists existing sandboxes, filtered by the PodSandboxFilter.
|
||||
func (*PodSandboxManager) ListPodSandbox(*runtimeapi.PodSandboxFilter) ([]*runtimeapi.PodSandbox, error) {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
// PortForward prepares a streaming endpoint to forward ports from a PodSandbox, and returns the address.
|
||||
func (*PodSandboxManager) PortForward(*runtimeapi.PortForwardRequest) (*runtimeapi.PortForwardResponse, error) {
|
||||
panic("not implemented")
|
||||
}
|
|
@ -664,7 +664,6 @@ k8s.io/kubernetes/pkg/kubelet/prober,alex-mohr,1,
|
|||
k8s.io/kubernetes/pkg/kubelet/prober/results,krousey,1,
|
||||
k8s.io/kubernetes/pkg/kubelet/qos,vishh,0,
|
||||
k8s.io/kubernetes/pkg/kubelet/rkt,apelisse,1,
|
||||
k8s.io/kubernetes/pkg/kubelet/rktshim,mml,1,
|
||||
k8s.io/kubernetes/pkg/kubelet/secret,kevin-wangzefeng,1,
|
||||
k8s.io/kubernetes/pkg/kubelet/server,tallclair,0,
|
||||
k8s.io/kubernetes/pkg/kubelet/server/portforward,rkouj,0,
|
||||
|
|
|
Loading…
Reference in New Issue