Skip to content

Commit

Permalink
Use cri streaming pkg from k8s staging
Browse files Browse the repository at this point in the history
Use staging k8s.io/kubelet/cri/streaming package

Signed-off-by: Aditi Sharma <[email protected]>
  • Loading branch information
adisky committed Oct 18, 2023
1 parent aef2ebc commit 03d81f5
Show file tree
Hide file tree
Showing 275 changed files with 7,628 additions and 32,069 deletions.
31 changes: 15 additions & 16 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ require (
github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c
github.com/docker/go-metrics v0.0.1
github.com/docker/go-units v0.5.0
github.com/emicklei/go-restful/v3 v3.10.2
github.com/fsnotify/fsnotify v1.6.0
github.com/google/go-cmp v0.5.9
github.com/google/uuid v1.3.1
Expand Down Expand Up @@ -69,25 +68,24 @@ require (
google.golang.org/genproto/googleapis/rpc v0.0.0-20230726155614-23370e0ffb3e
google.golang.org/grpc v1.57.1
google.golang.org/protobuf v1.31.0
k8s.io/api v0.26.4
k8s.io/apimachinery v0.26.4
k8s.io/apiserver v0.26.2
k8s.io/client-go v0.26.4
k8s.io/component-base v0.26.2
k8s.io/cri-api v0.28.0-beta.0
k8s.io/klog/v2 v2.90.1
k8s.io/utils v0.0.0-20230220204549-a5ecb0141aa5
k8s.io/apimachinery v0.28.2
k8s.io/client-go v0.28.2
k8s.io/component-base v0.28.2
k8s.io/cri-api v0.28.2
k8s.io/klog/v2 v2.100.1
k8s.io/kubelet v0.28.2
k8s.io/utils v0.0.0-20230406110748-d93618cff8a2
)

require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cilium/ebpf v0.9.1 // indirect
github.com/containerd/typeurl v1.0.2 // indirect
github.com/containers/ocicrypt v1.1.6 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/emicklei/go-restful/v3 v3.10.2 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
Expand All @@ -107,11 +105,10 @@ require (
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.42.0 // indirect
github.com/prometheus/client_model v0.4.0 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.10.1 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stefanberger/go-pkcs11uri v0.0.0-20201008174630-78d3cae3a980 // indirect
github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635 // indirect
github.com/vishvananda/netns v0.0.4 // indirect
Expand All @@ -126,16 +123,18 @@ require (
golang.org/x/oauth2 v0.10.0 // indirect
golang.org/x/term v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.11.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230720185612-659f7aaaa771 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230726155614-23370e0ffb3e // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/square/go-jose.v2 v2.5.1 // indirect
gopkg.in/square/go-jose.v2 v2.6.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
k8s.io/api v0.28.2 // indirect
k8s.io/apiserver v0.28.2 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)
69 changes: 36 additions & 33 deletions go.sum

Large diffs are not rendered by default.

94 changes: 50 additions & 44 deletions integration/client/go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pkg/cri/config/config_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (
"time"

"github.com/containerd/containerd"
"github.com/containerd/containerd/pkg/cri/streaming"
"github.com/pelletier/go-toml/v2"
"k8s.io/kubelet/pkg/cri/streaming"
)

// DefaultConfig returns default configurations of cri plugin.
Expand Down
2 changes: 1 addition & 1 deletion pkg/cri/config/config_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"time"

"github.com/containerd/containerd"
"github.com/containerd/containerd/pkg/cri/streaming"
"k8s.io/kubelet/pkg/cri/streaming"
)

// DefaultConfig returns default configurations of cri plugin.
Expand Down
2 changes: 1 addition & 1 deletion pkg/cri/server/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ import (
"github.com/containerd/containerd/pkg/cri/server/podsandbox"
imagestore "github.com/containerd/containerd/pkg/cri/store/image"
snapshotstore "github.com/containerd/containerd/pkg/cri/store/snapshot"
"github.com/containerd/containerd/pkg/cri/streaming"
"github.com/containerd/containerd/plugins"
"github.com/containerd/containerd/sandbox"
"github.com/containerd/go-cni"
"github.com/containerd/log"
"google.golang.org/grpc"
runtime "k8s.io/cri-api/pkg/apis/runtime/v1"
"k8s.io/kubelet/pkg/cri/streaming"

"github.com/containerd/containerd/pkg/cri/store/label"

Expand Down
14 changes: 7 additions & 7 deletions pkg/cri/server/streaming.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ import (
k8scert "k8s.io/client-go/util/cert"
"k8s.io/utils/exec"

"github.com/containerd/containerd/pkg/cri/streaming"
ctrdutil "github.com/containerd/containerd/pkg/cri/util"
"k8s.io/kubelet/pkg/cri/streaming"
)

type streamListenerMode int
Expand Down Expand Up @@ -126,9 +126,9 @@ func newStreamRuntime(c *criService) streaming.Runtime {

// Exec executes a command inside the container. exec.ExitError is returned if the command
// returns non-zero exit code.
func (s *streamRuntime) Exec(containerID string, cmd []string, stdin io.Reader, stdout, stderr io.WriteCloser,
func (s *streamRuntime) Exec(ctx context.Context, containerID string, cmd []string, stdin io.Reader, stdout, stderr io.WriteCloser,
tty bool, resize <-chan remotecommand.TerminalSize) error {
exitCode, err := s.c.execInContainer(ctrdutil.NamespacedContext(), containerID, execOptions{
exitCode, err := s.c.execInContainer(ctrdutil.WithNamespace(ctx), containerID, execOptions{
cmd: cmd,
stdin: stdin,
stdout: stdout,
Expand All @@ -148,16 +148,16 @@ func (s *streamRuntime) Exec(containerID string, cmd []string, stdin io.Reader,
}
}

func (s *streamRuntime) Attach(containerID string, in io.Reader, out, err io.WriteCloser, tty bool,
func (s *streamRuntime) Attach(ctx context.Context, containerID string, in io.Reader, out, err io.WriteCloser, tty bool,
resize <-chan remotecommand.TerminalSize) error {
return s.c.attachContainer(ctrdutil.NamespacedContext(), containerID, in, out, err, tty, resize)
return s.c.attachContainer(ctrdutil.WithNamespace(ctx), containerID, in, out, err, tty, resize)
}

func (s *streamRuntime) PortForward(podSandboxID string, port int32, stream io.ReadWriteCloser) error {
func (s *streamRuntime) PortForward(ctx context.Context, podSandboxID string, port int32, stream io.ReadWriteCloser) error {
if port <= 0 || port > math.MaxUint16 {
return fmt.Errorf("invalid port %d", port)
}
ctx := ctrdutil.NamespacedContext()
ctx = ctrdutil.WithNamespace(ctx)
return s.c.portForward(ctx, podSandboxID, port, stream)
}

Expand Down
34 changes: 0 additions & 34 deletions pkg/cri/streaming/remotecommand/doc.go

This file was deleted.

22 changes: 0 additions & 22 deletions vendor/github.com/blang/semver/v4/LICENSE

This file was deleted.

23 changes: 0 additions & 23 deletions vendor/github.com/blang/semver/v4/json.go

This file was deleted.

Loading

0 comments on commit 03d81f5

Please sign in to comment.