mirror of
https://github.com/containerd/containerd.git
synced 2026-08-08 17:11:15 +00:00
Merge pull request #13882 from samuelkarp/hcsshim-scrub-logs-2.2
[release/2.2] Use ScrubLogs by default on Windows
This commit is contained in:
@@ -39,6 +39,10 @@ var platformRunFlags = []cli.Flag{
|
||||
Name: "isolated",
|
||||
Usage: "Run the container with vm isolation",
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "scrub-logs",
|
||||
Usage: "Scrub sensitive information from the shim logs (Windows only)",
|
||||
},
|
||||
}
|
||||
|
||||
// NewContainer creates a new container
|
||||
@@ -176,9 +180,13 @@ func NewContainer(ctx context.Context, client *containerd.Client, cliContext *cl
|
||||
runtime := cliContext.String("runtime")
|
||||
var runtimeOpts interface{}
|
||||
if runtime == "io.containerd.runhcs.v1" {
|
||||
runtimeOpts = &options.Options{
|
||||
opts := &options.Options{
|
||||
Debug: cliContext.Bool("debug"),
|
||||
}
|
||||
if cliContext.IsSet("scrub-logs") {
|
||||
opts.ScrubLogs = cliContext.Bool("scrub-logs")
|
||||
}
|
||||
runtimeOpts = opts
|
||||
}
|
||||
cOpts = append(cOpts, containerd.WithRuntime(runtime, runtimeOpts))
|
||||
|
||||
|
||||
@@ -59,6 +59,13 @@ func DefaultRuntimeConfig() RuntimeConfig {
|
||||
"runhcs-wcow-process": {
|
||||
Type: "io.containerd.runhcs.v1",
|
||||
ContainerAnnotations: []string{"io.microsoft.container.*"},
|
||||
// Full set of Windows shim options:
|
||||
// https://pkg.go.dev/github.com/Microsoft/hcsshim/cmd/containerd-shim-runhcs-v1/options#Options
|
||||
Options: map[string]interface{}{
|
||||
// ScrubLogs enables removing environment variables and other potentially sensitive information
|
||||
// from logs
|
||||
"ScrubLogs": true,
|
||||
},
|
||||
},
|
||||
"runhcs-wcow-hypervisor": {
|
||||
Type: "io.containerd.runhcs.v1",
|
||||
@@ -67,6 +74,9 @@ func DefaultRuntimeConfig() RuntimeConfig {
|
||||
// Full set of Windows shim options:
|
||||
// https://pkg.go.dev/github.com/Microsoft/hcsshim/cmd/containerd-shim-runhcs-v1/options#Options
|
||||
Options: map[string]interface{}{
|
||||
// ScrubLogs enables removing environment variables and other potentially sensitive information
|
||||
// from logs
|
||||
"ScrubLogs": true,
|
||||
// SandboxIsolation specifies the isolation level of the sandbox.
|
||||
// PROCESS (0) and HYPERVISOR (1) are the valid options.
|
||||
"SandboxIsolation": 1,
|
||||
|
||||
Reference in New Issue
Block a user