Skip to content

Commit f90f80d

Browse files
authored
Merge pull request containerd#9254 from adisky/cri-streaming-from-k8s
Use staging k8s.io/kubelet/cri/streaming package
2 parents f7af7fc + 03d81f5 commit f90f80d

275 files changed

Lines changed: 7628 additions & 32069 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

go.mod

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ require (
2929
github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c
3030
github.com/docker/go-metrics v0.0.1
3131
github.com/docker/go-units v0.5.0
32-
github.com/emicklei/go-restful/v3 v3.10.2
3332
github.com/fsnotify/fsnotify v1.6.0
3433
github.com/google/go-cmp v0.5.9
3534
github.com/google/uuid v1.3.1
@@ -69,25 +68,24 @@ require (
6968
google.golang.org/genproto/googleapis/rpc v0.0.0-20230726155614-23370e0ffb3e
7069
google.golang.org/grpc v1.57.1
7170
google.golang.org/protobuf v1.31.0
72-
k8s.io/api v0.26.4
73-
k8s.io/apimachinery v0.26.4
74-
k8s.io/apiserver v0.26.2
75-
k8s.io/client-go v0.26.4
76-
k8s.io/component-base v0.26.2
77-
k8s.io/cri-api v0.28.0-beta.0
78-
k8s.io/klog/v2 v2.90.1
79-
k8s.io/utils v0.0.0-20230220204549-a5ecb0141aa5
71+
k8s.io/apimachinery v0.28.2
72+
k8s.io/client-go v0.28.2
73+
k8s.io/component-base v0.28.2
74+
k8s.io/cri-api v0.28.2
75+
k8s.io/klog/v2 v2.100.1
76+
k8s.io/kubelet v0.28.2
77+
k8s.io/utils v0.0.0-20230406110748-d93618cff8a2
8078
)
8179

8280
require (
8381
github.com/beorn7/perks v1.0.1 // indirect
84-
github.com/blang/semver/v4 v4.0.0 // indirect
8582
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
8683
github.com/cespare/xxhash/v2 v2.2.0 // indirect
8784
github.com/cilium/ebpf v0.9.1 // indirect
8885
github.com/containerd/typeurl v1.0.2 // indirect
8986
github.com/containers/ocicrypt v1.1.6 // indirect
9087
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
88+
github.com/emicklei/go-restful/v3 v3.10.2 // indirect
9189
github.com/go-logr/logr v1.2.4 // indirect
9290
github.com/go-logr/stdr v1.2.2 // indirect
9391
github.com/godbus/dbus/v5 v5.1.0 // indirect
@@ -107,11 +105,10 @@ require (
107105
github.com/modern-go/reflect2 v1.0.2 // indirect
108106
github.com/pkg/errors v0.9.1 // indirect
109107
github.com/pmezard/go-difflib v1.0.0 // indirect
110-
github.com/prometheus/client_model v0.3.0 // indirect
111-
github.com/prometheus/common v0.42.0 // indirect
108+
github.com/prometheus/client_model v0.4.0 // indirect
109+
github.com/prometheus/common v0.44.0 // indirect
112110
github.com/prometheus/procfs v0.10.1 // indirect
113111
github.com/russross/blackfriday/v2 v2.1.0 // indirect
114-
github.com/spf13/pflag v1.0.5 // indirect
115112
github.com/stefanberger/go-pkcs11uri v0.0.0-20201008174630-78d3cae3a980 // indirect
116113
github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635 // indirect
117114
github.com/vishvananda/netns v0.0.4 // indirect
@@ -126,16 +123,18 @@ require (
126123
golang.org/x/oauth2 v0.10.0 // indirect
127124
golang.org/x/term v0.13.0 // indirect
128125
golang.org/x/text v0.13.0 // indirect
129-
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect
126+
golang.org/x/time v0.3.0 // indirect
130127
golang.org/x/tools v0.11.0 // indirect
131128
google.golang.org/appengine v1.6.7 // indirect
132129
google.golang.org/genproto v0.0.0-20230720185612-659f7aaaa771 // indirect
133130
google.golang.org/genproto/googleapis/api v0.0.0-20230726155614-23370e0ffb3e // indirect
134131
gopkg.in/inf.v0 v0.9.1 // indirect
135-
gopkg.in/square/go-jose.v2 v2.5.1 // indirect
132+
gopkg.in/square/go-jose.v2 v2.6.0 // indirect
136133
gopkg.in/yaml.v2 v2.4.0 // indirect
137134
gopkg.in/yaml.v3 v3.0.1 // indirect
138-
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
135+
k8s.io/api v0.28.2 // indirect
136+
k8s.io/apiserver v0.28.2 // indirect
137+
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
139138
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
140139
sigs.k8s.io/yaml v1.3.0 // indirect
141140
)

go.sum

Lines changed: 36 additions & 33 deletions
Large diffs are not rendered by default.

integration/client/go.sum

Lines changed: 50 additions & 44 deletions
Large diffs are not rendered by default.

pkg/cri/config/config_unix.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ import (
2222
"time"
2323

2424
"github.com/containerd/containerd"
25-
"github.com/containerd/containerd/pkg/cri/streaming"
2625
"github.com/pelletier/go-toml/v2"
26+
"k8s.io/kubelet/pkg/cri/streaming"
2727
)
2828

2929
// DefaultConfig returns default configurations of cri plugin.

pkg/cri/config/config_windows.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
"time"
2323

2424
"github.com/containerd/containerd"
25-
"github.com/containerd/containerd/pkg/cri/streaming"
25+
"k8s.io/kubelet/pkg/cri/streaming"
2626
)
2727

2828
// DefaultConfig returns default configurations of cri plugin.

pkg/cri/server/service.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ import (
3535
"github.com/containerd/containerd/pkg/cri/server/podsandbox"
3636
imagestore "github.com/containerd/containerd/pkg/cri/store/image"
3737
snapshotstore "github.com/containerd/containerd/pkg/cri/store/snapshot"
38-
"github.com/containerd/containerd/pkg/cri/streaming"
3938
"github.com/containerd/containerd/plugins"
4039
"github.com/containerd/containerd/sandbox"
4140
"github.com/containerd/go-cni"
4241
"github.com/containerd/log"
4342
"google.golang.org/grpc"
4443
runtime "k8s.io/cri-api/pkg/apis/runtime/v1"
44+
"k8s.io/kubelet/pkg/cri/streaming"
4545

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

pkg/cri/server/streaming.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ import (
3333
k8scert "k8s.io/client-go/util/cert"
3434
"k8s.io/utils/exec"
3535

36-
"github.com/containerd/containerd/pkg/cri/streaming"
3736
ctrdutil "github.com/containerd/containerd/pkg/cri/util"
37+
"k8s.io/kubelet/pkg/cri/streaming"
3838
)
3939

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

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

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

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

pkg/cri/streaming/remotecommand/doc.go

Lines changed: 0 additions & 34 deletions
This file was deleted.

vendor/github.com/blang/semver/v4/LICENSE

Lines changed: 0 additions & 22 deletions
This file was deleted.

vendor/github.com/blang/semver/v4/json.go

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)