Skip to content

Commit

Permalink
Merge pull request #383 from Random-Liu/add-runtime-handler-support
Browse files Browse the repository at this point in the history
Add runtime handler support
  • Loading branch information
k8s-ci-robot committed Sep 17, 2018
2 parents 3306a4d + 49a5dad commit 98eea54
Show file tree
Hide file tree
Showing 127 changed files with 6,522 additions and 4,592 deletions.
19 changes: 10 additions & 9 deletions cmd/crictl/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package main

import (
"context"
"fmt"
"os"
"time"
Expand Down Expand Up @@ -59,25 +60,25 @@ var logsCommand = cli.Command{
Usage: "Show timestamps",
},
},
Action: func(context *cli.Context) error {
runtimeService, err := getRuntimeService(context)
Action: func(ctx *cli.Context) error {
runtimeService, err := getRuntimeService(ctx)
if err != nil {
return err
}

containerID := context.Args().First()
containerID := ctx.Args().First()
if containerID == "" {
return fmt.Errorf("ID cannot be empty")
}
tailLines := context.Int64("tail")
limitBytes := context.Int64("limit-bytes")
since, err := parseTimestamp(context.String("since"))
tailLines := ctx.Int64("tail")
limitBytes := ctx.Int64("limit-bytes")
since, err := parseTimestamp(ctx.String("since"))
if err != nil {
return err
}
timestamp := context.Bool("timestamps")
timestamp := ctx.Bool("timestamps")
logOptions := logs.NewLogOptions(&v1.PodLogOptions{
Follow: context.Bool("follow"),
Follow: ctx.Bool("follow"),
TailLines: &tailLines,
LimitBytes: &limitBytes,
SinceTime: since,
Expand All @@ -91,7 +92,7 @@ var logsCommand = cli.Command{
if logPath == "" {
return fmt.Errorf("The container has not set log path")
}
return logs.ReadLogs(logPath, status.GetId(), logOptions, runtimeService, os.Stdout, os.Stderr)
return logs.ReadLogs(context.Background(), logPath, status.GetId(), logOptions, runtimeService, os.Stdout, os.Stderr)
},
After: closeConnection,
}
Expand Down
16 changes: 13 additions & 3 deletions cmd/crictl/sandbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ var runPodCommand = cli.Command{
Name: "runp",
Usage: "Run a new pod",
ArgsUsage: "pod-config.[json|yaml]",
Flags: []cli.Flag{
cli.StringFlag{
Name: "runtime, r",
Usage: "Runtime handler to use. Available options are defined by the container runtime.",
},
},

Action: func(context *cli.Context) error {
sandboxSpec := context.Args().First()
if sandboxSpec == "" {
Expand All @@ -63,7 +70,7 @@ var runPodCommand = cli.Command{
}

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

// RunPodSandbox sends a RunPodSandboxRequest to the server, and parses
// the returned RunPodSandboxResponse.
func RunPodSandbox(client pb.RuntimeServiceClient, config *pb.PodSandboxConfig) error {
request := &pb.RunPodSandboxRequest{Config: config}
func RunPodSandbox(client pb.RuntimeServiceClient, config *pb.PodSandboxConfig, runtime string) error {
request := &pb.RunPodSandboxRequest{
Config: config,
RuntimeHandler: runtime,
}
logrus.Debugf("RunPodSandboxRequest: %v", request)
r, err := client.RunPodSandbox(context.Background(), request)
logrus.Debugf("RunPodSandboxResponse: %v", r)
Expand Down
2 changes: 1 addition & 1 deletion pkg/validate/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"strings"
"time"

"github.com/docker/docker/pkg/jsonlog"
"github.com/docker/docker/daemon/logger/jsonfilelog/jsonlog"
"github.com/kubernetes-sigs/cri-tools/pkg/framework"
internalapi "k8s.io/kubernetes/pkg/kubelet/apis/cri"
runtimeapi "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
Expand Down
18 changes: 10 additions & 8 deletions vendor.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github.com/Azure/go-ansiterm 19f72df4d05d31cbe1c56bfc8045c96babff6c7e
github.com/docker/docker 4f3616fb1c112e206b88cb7a9922bf49067a7756
github.com/Azure/go-ansiterm d6e3b3328b783f23731bc4d058875b0371ff8109
github.com/docker/docker a9fbbdc8dd8794b20af358382ab780559bca589d
github.com/docker/go-units 9e638d38cf6977a37a8ea0078f3ee75a7cdb2dd1
github.com/docker/spdystream 449fdfce4d962303d702fec724ef0ad181c92528
github.com/fsnotify/fsnotify f12c6236fe7b5cf6bcf30e5935d08cb079d78334
Expand All @@ -15,22 +15,24 @@ github.com/modern-go/concurrent bacd9c7ef1dd9b15be4a9909b8ac7a4e313eec94
github.com/modern-go/reflect2 05fbef0ca5da472bbf96c9322b84a53edc03c9fd
github.com/onsi/ginkgo 67b9df7f55fe1165fd9ad49aca7754cce01a42b8
github.com/onsi/gomega d59fa0ac68bb5dd932ee8d24eed631cdd519efc3
github.com/opencontainers/selinux 4a2974bf1ee960774ffd517717f1f45325af0206
github.com/opencontainers/go-digest c9281466c8b2f606084ac71339773efd177436e7
github.com/opencontainers/selinux 4a2974bf1ee960774ffd517717f1f45325af0206
github.com/pborman/uuid ca53cad383cad2479bbba7f7a1a05797ec1386e4
github.com/pkg/errors v0.8.0
github.com/sirupsen/logrus 89742aefa4b206dcf400792f3bd35b542998eb3b
github.com/urfave/cli 934abfb2f102315b5794e15ebc7949e4ca253920
golang.org/x/crypto 49796115aa4b964c318aad4f3084fdb41e9aa067
golang.org/x/net 1c05540f6879653db88113bc4a2b70aec4bd491f
golang.org/x/oauth2 a6bd8cefa1811bd24b86f8902872e4e8225f74c4
golang.org/x/sys 95c6576299259db960f6c5b9b69ea52422860fce
golang.org/x/text b19bf474d317b857955b12035d2c5acb57ce8b01
golang.org/x/time f51c12702a4d776e4c1fa9b0fabab841babae631
google.golang.org/genproto 09f6ed296fc66555a25fe4ce95173148778dfa85
google.golang.org/grpc v1.7.5
gopkg.in/inf.v0 v0.9.0
gopkg.in/yaml.v2 670d4cfef0544295bc27a114dbac37980d83185a
k8s.io/api 783dfbe86ff74ef4a6e1243688e1585ac243f8e7
k8s.io/apimachinery 5a8013207d0d28c7fe98193e5b6cdbf92e98a000
k8s.io/client-go 8d6e3480fc03b7337a24f349d35733190655e2ad
k8s.io/kubernetes 3abba25160590921fec61236ba012a8bbd757d6c
k8s.io/utils 258e2a2fa64568210fbd6267cf1d8fd87c3cb86e
k8s.io/api 012f271b5d41baad56190c5f1ae19bff16df0fd8
k8s.io/apimachinery 6429050ef506887d121f3e7306e894f8900d8a63
k8s.io/client-go 37c3c02ec96533daec0dbda1f39a6b1d68505c79
k8s.io/kubernetes v1.12.0-beta.1
k8s.io/utils 982821ea41da7e7c15f3d3738921eb2e7e241ccd
4 changes: 2 additions & 2 deletions vendor/github.com/Azure/go-ansiterm/csi_entry_state.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions vendor/github.com/Azure/go-ansiterm/csi_param_state.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions vendor/github.com/Azure/go-ansiterm/escape_state.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

99 changes: 57 additions & 42 deletions vendor/github.com/Azure/go-ansiterm/parser.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 98eea54

Please sign in to comment.