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

drivers/docker: rename logging type to driver #5372

Merged
merged 2 commits into from
Feb 28, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions drivers/docker/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ var (
"load": hclspec.NewAttr("load", "string", false),
"logging": hclspec.NewBlock("logging", false, hclspec.NewObject(map[string]*hclspec.Spec{
"type": hclspec.NewAttr("type", "string", false),
"driver": hclspec.NewAttr("driver", "string", false),
"config": hclspec.NewAttr("config", "list(map(string))", false),
})),
"mac_address": hclspec.NewAttr("mac_address", "string", false),
Expand Down Expand Up @@ -397,6 +398,7 @@ func (d DockerDevice) toDockerDevice() (docker.Device, error) {

type DockerLogging struct {
Type string `codec:"type"`
Driver string `codec:"driver"`
Config hclutils.MapStrStr `codec:"config"`
}

Expand Down
6 changes: 4 additions & 2 deletions drivers/docker/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,8 @@ config {
}
load = "/tmp/image.tar.gz"
logging {
type = "json-file"
driver = "json-file-driver"
type = "json-file"
config {
"max-file" = "3"
"max-size" = "10m"
Expand Down Expand Up @@ -308,7 +309,8 @@ config {
},
LoadImage: "/tmp/image.tar.gz",
Logging: DockerLogging{
Type: "json-file",
Driver: "json-file-driver",
Type: "json-file",
Config: map[string]string{
"max-file": "3",
"max-size": "10m",
Expand Down
7 changes: 6 additions & 1 deletion drivers/docker/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -706,8 +706,13 @@ func (d *Driver) createContainerConfig(task *drivers.TaskConfig, driverConfig *T
hostConfig.MemorySwap = task.Resources.LinuxResources.MemoryLimitBytes // MemorySwap is memory + swap.
}

loggingDriver := driverConfig.Logging.Driver
if loggingDriver == "" {
loggingDriver = driverConfig.Logging.Type
notnoop marked this conversation as resolved.
Show resolved Hide resolved
}

hostConfig.LogConfig = docker.LogConfig{
Type: driverConfig.Logging.Type,
Type: loggingDriver,
Config: driverConfig.Logging.Config,
}

Expand Down