Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make RPCs CRI v1 and v1alpha2 compatible #889

Merged
merged 1 commit into from
Mar 21, 2022
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.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
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