Skip to content

Commit b491fee

Browse files
committed
Add runtime handler support.
Signed-off-by: Lantao Liu <[email protected]>
1 parent d11cc0f commit b491fee

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

cmd/crictl/logs.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
package main
1818

1919
import (
20+
gocontext "context"
2021
"fmt"
2122
"os"
2223
"time"
@@ -91,7 +92,7 @@ var logsCommand = cli.Command{
9192
if logPath == "" {
9293
return fmt.Errorf("The container has not set log path")
9394
}
94-
return logs.ReadLogs(logPath, status.GetId(), logOptions, runtimeService, os.Stdout, os.Stderr)
95+
return logs.ReadLogs(gocontext.Background(), logPath, status.GetId(), logOptions, runtimeService, os.Stdout, os.Stderr)
9596
},
9697
After: closeConnection,
9798
}

cmd/crictl/sandbox.go

+13-3
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ var runPodCommand = cli.Command{
4747
Name: "runp",
4848
Usage: "Run a new pod",
4949
ArgsUsage: "pod-config.[json|yaml]",
50+
Flags: []cli.Flag{
51+
cli.StringFlag{
52+
Name: "runtime, r",
53+
Usage: "Runtime handler to use. Available options are defined by the container runtime.",
54+
},
55+
},
56+
5057
Action: func(context *cli.Context) error {
5158
sandboxSpec := context.Args().First()
5259
if sandboxSpec == "" {
@@ -63,7 +70,7 @@ var runPodCommand = cli.Command{
6370
}
6471

6572
// Test RuntimeServiceClient.RunPodSandbox
66-
err = RunPodSandbox(runtimeClient, podSandboxConfig)
73+
err = RunPodSandbox(runtimeClient, podSandboxConfig, context.String("runtime"))
6774
if err != nil {
6875
return fmt.Errorf("run pod sandbox failed: %v", err)
6976
}
@@ -236,8 +243,11 @@ var listPodCommand = cli.Command{
236243

237244
// RunPodSandbox sends a RunPodSandboxRequest to the server, and parses
238245
// the returned RunPodSandboxResponse.
239-
func RunPodSandbox(client pb.RuntimeServiceClient, config *pb.PodSandboxConfig) error {
240-
request := &pb.RunPodSandboxRequest{Config: config}
246+
func RunPodSandbox(client pb.RuntimeServiceClient, config *pb.PodSandboxConfig, runtime string) error {
247+
request := &pb.RunPodSandboxRequest{
248+
Config: config,
249+
RuntimeHandler: runtime,
250+
}
241251
logrus.Debugf("RunPodSandboxRequest: %v", request)
242252
r, err := client.RunPodSandbox(context.Background(), request)
243253
logrus.Debugf("RunPodSandboxResponse: %v", r)

pkg/validate/container.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import (
2727
"strings"
2828
"time"
2929

30-
"github.com/docker/docker/pkg/jsonlog"
30+
"github.com/docker/docker/daemon/logger/jsonfilelog/jsonlog"
3131
"github.com/kubernetes-sigs/cri-tools/pkg/framework"
3232
internalapi "k8s.io/kubernetes/pkg/kubelet/apis/cri"
3333
runtimeapi "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"

0 commit comments

Comments
 (0)