Skip to content

Commit

Permalink
Make RPCs CRI v1 and v1alpha2 compatible
Browse files Browse the repository at this point in the history
Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
  • Loading branch information
saschagrunert committed Mar 11, 2022
1 parent 10bd4bc commit c7382f0
Show file tree
Hide file tree
Showing 1,450 changed files with 5,065 additions and 376,575 deletions.
9 changes: 4 additions & 5 deletions cmd/crictl/attach.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/urfave/cli/v2"
"golang.org/x/net/context"
internalapi "k8s.io/cri-api/pkg/apis"
pb "k8s.io/cri-api/pkg/apis/runtime/v1"
)

Expand All @@ -50,11 +50,10 @@ var runtimeAttachCommand = &cli.Command{
return cli.ShowSubcommandHelp(context)
}

runtimeClient, conn, err := getRuntimeClient(context)
runtimeClient, err := getRuntimeService(context, 0)
if err != nil {
return err
}
defer closeConnection(context, conn)

var opts = attachOptions{
id: id,
Expand All @@ -71,7 +70,7 @@ var runtimeAttachCommand = &cli.Command{
}

// Attach sends an AttachRequest to server, and parses the returned AttachResponse
func Attach(client pb.RuntimeServiceClient, opts attachOptions) error {
func Attach(client internalapi.RuntimeService, opts attachOptions) error {
if opts.id == "" {
return fmt.Errorf("ID cannot be empty")

Expand All @@ -84,7 +83,7 @@ func Attach(client pb.RuntimeServiceClient, opts attachOptions) error {
Stderr: !opts.tty,
}
logrus.Debugf("AttachRequest: %v", request)
r, err := client.Attach(context.Background(), request)
r, err := client.Attach(request)
logrus.Debugf("AttachResponse: %v", r)
if err != nil {
return err
Expand Down

0 comments on commit c7382f0

Please sign in to comment.