Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ RUN set -x \
&& rm -rf "$GOPATH"

# Install crictl
ENV CRICTL_COMMIT f1a58d681c056f259802f5cae2fe1fbcc6b28667
ENV CRICTL_COMMIT 240a840375cdabb5860c75c99e8b0d0a776006b4
RUN set -x \
&& export GOPATH="$(mktemp -d)" \
&& git clone https://github.com/kubernetes-incubator/cri-tools.git "$GOPATH/src/github.com/kubernetes-incubator/cri-tools" \
Expand Down
2 changes: 1 addition & 1 deletion cmd/crio/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"github.com/urfave/cli"
"golang.org/x/sys/unix"
"google.golang.org/grpc"
"k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
)

// gitCommit is the commit that the binary is being built from.
Expand Down
16 changes: 15 additions & 1 deletion contrib/test/integration/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,28 @@
path: "{{ artifacts }}"
state: directory

- name: Add repo for new version of git
yum_repository:
name: Wandisco
description: Wandisco git repo
baseurl: http://opensource.wandisco.com/rhel/7Server/git/$basearch
gpgcheck: no
when: ansible_distribution in ['RedHat']

- name: upgrade git package
yum:
name: 'git'
state: latest
when: ansible_distribution in ['RedHat']

# TODO remove the last test skipped once https://github.com/kubernetes-incubator/cri-o/pull/1217 is merged
- name: Buffer the e2e testing command to workaround Ansible YAML folding "feature"
set_fact:
e2e_shell_cmd: >
/usr/bin/go run hack/e2e.go
--test
--test_args="-host=https://{{ ansible_default_ipv4.address }}:6443
--ginkgo.skip=\[Slow\]|\[Serial\]|\[Disruptive\]|\[Flaky\]|\[Feature:.+\]|PersistentVolumes|\[HPA\]|should.support.building.a.client.with.a.CSR|should.support.inline.execution.and.attach
--ginkgo.skip=\[Slow\]|\[Serial\]|\[Disruptive\]|\[Flaky\]|\[Feature:.+\]|PersistentVolumes|\[HPA\]|should.support.building.a.client.with.a.CSR|should.support.inline.execution.and.attach|should.propagate.mounts.to.the.host
--report-dir={{ artifacts }}"
&> {{ artifacts }}/e2e.log
# Fix vim syntax hilighting: "
Expand Down
9 changes: 4 additions & 5 deletions contrib/test/integration/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
include: "build/cri-tools.yml"
vars:
force_clone: True
cri_tools_git_version: "f1a58d681c056f259802f5cae2fe1fbcc6b28667"
cri_tools_git_version: "240a840375cdabb5860c75c99e8b0d0a776006b4"
- name: run cri-o integration tests
include: test.yml

Expand All @@ -78,7 +78,7 @@
include: "build/cri-tools.yml"
vars:
force_clone: True
cri_tools_git_version: "f1a58d681c056f259802f5cae2fe1fbcc6b28667"
cri_tools_git_version: "240a840375cdabb5860c75c99e8b0d0a776006b4"
- name: run critest validation and benchmarks
include: critest.yml

Expand Down Expand Up @@ -118,9 +118,8 @@
include: "build/kubernetes.yml"
vars:
force_clone: True
# master as of 12/11/2017
k8s_git_version: "master-nfs-fix"
k8s_github_fork: "runcom"
k8s_git_version: "master"
k8s_github_fork: "kubernetes"
crio_socket: "/var/run/crio/crio.sock"
- name: run k8s e2e tests
include: e2e.yml
9 changes: 6 additions & 3 deletions lib/container_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"github.com/opencontainers/selinux/go-selinux/label"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
"k8s.io/kubernetes/pkg/kubelet/network/hostport"
)

Expand Down Expand Up @@ -340,7 +340,10 @@ func (c *ContainerServer) LoadSandbox(id string) error {

privileged := isTrue(m.Annotations[annotations.PrivilegedRuntime])
trusted := isTrue(m.Annotations[annotations.TrustedSandbox])
hostNetwork := isTrue(m.Annotations[annotations.HostNetwork])
nsOpts := pb.NamespaceOption{}
if err := json.Unmarshal([]byte(m.Annotations[annotations.NamespaceOptions]), &nsOpts); err != nil {
return err
}

sb, err := sandbox.New(id, m.Annotations[annotations.Namespace], name, m.Annotations[annotations.KubeName], filepath.Dir(m.Annotations[annotations.LogPath]), labels, kubeAnnotations, processLabel, mountLabel, &metadata, m.Annotations[annotations.ShmPath], m.Annotations[annotations.CgroupParent], privileged, trusted, m.Annotations[annotations.ResolvPath], m.Annotations[annotations.HostName], portMappings)
if err != nil {
Expand All @@ -349,7 +352,7 @@ func (c *ContainerServer) LoadSandbox(id string) error {
sb.AddHostnamePath(m.Annotations[annotations.HostnamePath])
sb.AddIP(ip)
sb.SetSeccompProfilePath(spp)
sb.SetHostNetwork(hostNetwork)
sb.SetNamespaceOptions(&nsOpts)

// We add a netNS only if we can load a permanent one.
// Otherwise, the sandbox will live in the host namespace.
Expand Down
2 changes: 1 addition & 1 deletion lib/rename.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/json"
"path/filepath"

"k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"

"github.com/docker/docker/pkg/ioutils"
"github.com/kubernetes-incubator/cri-o/oci"
Expand Down
15 changes: 8 additions & 7 deletions lib/sandbox/sandbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"github.com/sirupsen/logrus"
"golang.org/x/sys/unix"
"k8s.io/apimachinery/pkg/fields"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
"k8s.io/kubernetes/pkg/kubelet/network/hostport"
)

Expand Down Expand Up @@ -147,6 +147,7 @@ type Sandbox struct {
mountLabel string
netns *NetNs
metadata *pb.PodSandboxMetadata
nsOpts *pb.NamespaceOption
shmPath string
cgroupParent string
privileged bool
Expand Down Expand Up @@ -225,14 +226,14 @@ func (s *Sandbox) AddIP(ip string) {
s.ip = ip
}

// SetHostNetwork sets whether the pod is running using host network
func (s *Sandbox) SetHostNetwork(hn bool) {
s.hostNetwork = hn
// SetNamespaceOptions sets whether the pod is running using host network
func (s *Sandbox) SetNamespaceOptions(nsOpts *pb.NamespaceOption) {
s.nsOpts = nsOpts
}

// HostNetwork returns whether the pod is using host network
func (s *Sandbox) HostNetwork() bool {
return s.hostNetwork
// NamespaceOptions returns the namespace options for the sandbox
func (s *Sandbox) NamespaceOptions() *pb.NamespaceOption {
return s.nsOpts
}

// IP returns the ip of the sandbox
Expand Down
2 changes: 1 addition & 1 deletion oci/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/docker/docker/pkg/signal"
specs "github.com/opencontainers/runtime-spec/specs-go"
"k8s.io/apimachinery/pkg/fields"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
)

const (
Expand Down
4 changes: 2 additions & 2 deletions pkg/annotations/annotations.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ const (
// IP is the container ipv4 or ipv6 address
IP = "io.kubernetes.cri-o.IP"

// HostNetwork tells whether the sandbox is using hostnetwork
HostNetwork = "io.kubernetes.cri-o.HostNetwork"
// NamespaceOptions store the options for namespaces
NamespaceOptions = "io.kubernetes.cri-o.NamespaceOptions"

// SeccompProfilePath is the node seccomp profile path
SeccompProfilePath = "io.kubernetes.cri-o.SeccompProfilePath"
Expand Down
2 changes: 1 addition & 1 deletion server/container_attach.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"golang.org/x/net/context"
"golang.org/x/sys/unix"
"k8s.io/client-go/tools/remotecommand"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
kubecontainer "k8s.io/kubernetes/pkg/kubelet/container"
)

Expand Down
6 changes: 3 additions & 3 deletions server/container_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import (
"github.com/sirupsen/logrus"
"golang.org/x/net/context"
"golang.org/x/sys/unix"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
)

const (
Expand Down Expand Up @@ -600,7 +600,7 @@ func hostNetwork(containerConfig *pb.ContainerConfig) bool {
return false
}

return securityContext.GetNamespaceOptions().HostNetwork
return securityContext.GetNamespaceOptions().GetNetwork() == pb.NamespaceMode_NODE
}

// ensureSaneLogPath is a hack to fix https://issues.k8s.io/44043 which causes
Expand Down Expand Up @@ -997,7 +997,7 @@ func (s *Server) createSandboxContainer(ctx context.Context, containerID string,
return nil, err
}

if containerConfig.GetLinux().GetSecurityContext().GetNamespaceOptions().GetHostPid() {
if containerConfig.GetLinux().GetSecurityContext().GetNamespaceOptions().GetPid() == pb.NamespaceMode_NODE {
// kubernetes PodSpec specify to use Host PID namespace
specgen.RemoveLinuxNamespace(string(rspec.PIDNamespace))
} else if s.config.EnableSharedPIDNamespace {
Expand Down
2 changes: 1 addition & 1 deletion server/container_exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/sirupsen/logrus"
"golang.org/x/net/context"
"k8s.io/client-go/tools/remotecommand"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
kubecontainer "k8s.io/kubernetes/pkg/kubelet/container"
"k8s.io/kubernetes/pkg/util/term"
utilexec "k8s.io/utils/exec"
Expand Down
2 changes: 1 addition & 1 deletion server/container_execsync.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/kubernetes-incubator/cri-o/oci"
"github.com/sirupsen/logrus"
"golang.org/x/net/context"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
)

// ExecSync runs a command in a container synchronously.
Expand Down
2 changes: 1 addition & 1 deletion server/container_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/sirupsen/logrus"
"golang.org/x/net/context"
"k8s.io/apimachinery/pkg/fields"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
)

// filterContainer returns whether passed container matches filtering criteria
Expand Down
2 changes: 1 addition & 1 deletion server/container_portforward.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/kubernetes-incubator/cri-o/oci"
"github.com/sirupsen/logrus"
"golang.org/x/net/context"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
)

// PortForward prepares a streaming endpoint to forward ports from a PodSandbox.
Expand Down
2 changes: 1 addition & 1 deletion server/container_remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/sirupsen/logrus"
"golang.org/x/net/context"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
)

// RemoveContainer removes the container. If the container is running, the container
Expand Down
13 changes: 13 additions & 0 deletions server/container_reopen_log.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package server

import (
"fmt"

"golang.org/x/net/context"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
)

// ReopenContainerLog reopens the containers log file
func (s *Server) ReopenContainerLog(ctx context.Context, in *pb.ReopenContainerLogRequest) (*pb.ReopenContainerLogResponse, error) {
return nil, fmt.Errorf("not yet implemented")
}
2 changes: 1 addition & 1 deletion server/container_start.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/kubernetes-incubator/cri-o/oci"
"github.com/sirupsen/logrus"
"golang.org/x/net/context"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
)

// StartContainer starts the container.
Expand Down
2 changes: 1 addition & 1 deletion server/container_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/kubernetes-incubator/cri-o/lib"
"github.com/kubernetes-incubator/cri-o/oci"
"golang.org/x/net/context"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
)

func buildContainerStats(stats *lib.ContainerStats, container *oci.Container) *pb.ContainerStats {
Expand Down
2 changes: 1 addition & 1 deletion server/container_stats_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/kubernetes-incubator/cri-o/lib"
"github.com/sirupsen/logrus"
"golang.org/x/net/context"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
)

// ListContainerStats returns stats of all running containers.
Expand Down
2 changes: 1 addition & 1 deletion server/container_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/kubernetes-incubator/cri-o/oci"
"github.com/sirupsen/logrus"
"golang.org/x/net/context"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion server/container_stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/sirupsen/logrus"
"golang.org/x/net/context"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
)

// StopContainer stops a running container with a grace period (i.e., timeout).
Expand Down
2 changes: 1 addition & 1 deletion server/container_update_resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
rspec "github.com/opencontainers/runtime-spec/specs-go"
"github.com/sirupsen/logrus"
"golang.org/x/net/context"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
)

// UpdateContainerResources updates ContainerConfig of the container.
Expand Down
2 changes: 1 addition & 1 deletion server/container_updateruntimeconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"time"

"golang.org/x/net/context"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
)

// UpdateRuntimeConfig updates the configuration of a running container.
Expand Down
15 changes: 4 additions & 11 deletions server/image_fs_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,24 @@ import (
"github.com/containers/storage"
crioStorage "github.com/kubernetes-incubator/cri-o/utils"
"golang.org/x/net/context"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
)

func getStorageFsInfo(store storage.Store) (*pb.FilesystemUsage, error) {
rootPath := store.GraphRoot()
storageDriver := store.GraphDriverName()
imagesPath := path.Join(rootPath, storageDriver+"-images")

deviceName, err := crioStorage.GetDeviceNameFromPath(imagesPath)

uuid, err := crioStorage.GetDeviceUUIDFromPath(deviceName)
if err != nil {
return nil, err
}

bytesUsed, inodesUsed, err := crioStorage.GetDiskUsageStats(imagesPath)
if err != nil {
return nil, err
}

usage := pb.FilesystemUsage{
Timestamp: time.Now().UnixNano(),
StorageId: &pb.StorageIdentifier{uuid},
UsedBytes: &pb.UInt64Value{bytesUsed},
InodesUsed: &pb.UInt64Value{inodesUsed},
FsId: &pb.FilesystemIdentifier{Mountpoint: imagesPath},
UsedBytes: &pb.UInt64Value{Value: bytesUsed},
InodesUsed: &pb.UInt64Value{Value: inodesUsed},
}

return &usage, nil
Expand Down
2 changes: 1 addition & 1 deletion server/image_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/sirupsen/logrus"
"golang.org/x/net/context"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
)

// ListImages lists existing images.
Expand Down
2 changes: 1 addition & 1 deletion server/image_pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/kubernetes-incubator/cri-o/pkg/storage"
"github.com/sirupsen/logrus"
"golang.org/x/net/context"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
)

// PullImage pulls a image with authentication config.
Expand Down
2 changes: 1 addition & 1 deletion server/image_remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/kubernetes-incubator/cri-o/pkg/storage"
"github.com/sirupsen/logrus"
"golang.org/x/net/context"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
)

// RemoveImage removes the image.
Expand Down
Loading