From 6f33523fe9ca9f800a9ef731b79cbe8b9db3d932 Mon Sep 17 00:00:00 2001 From: Aithal Date: Fri, 27 Oct 2017 15:06:05 -0700 Subject: [PATCH 1/4] register agent with "none" log driver capability Agent registers itself as being capable of placing containers with "none" logging driver on start, without the need for explicitly specifying this in the config --- agent/config/config_unix.go | 2 +- agent/config/config_unix_test.go | 3 ++- agent/config/config_windows.go | 2 +- agent/config/config_windows_test.go | 3 ++- agent/config/types.go | 2 +- agent/engine/dockerclient/logging_drivers.go | 2 ++ 6 files changed, 9 insertions(+), 5 deletions(-) diff --git a/agent/config/config_unix.go b/agent/config/config_unix.go index 5700b8279fa..746d279ab5e 100644 --- a/agent/config/config_unix.go +++ b/agent/config/config_unix.go @@ -35,7 +35,7 @@ func DefaultConfig() Config { DataDirOnHost: "/var/lib/ecs", DisableMetrics: false, ReservedMemory: 0, - AvailableLoggingDrivers: []dockerclient.LoggingDriver{dockerclient.JSONFileDriver}, + AvailableLoggingDrivers: []dockerclient.LoggingDriver{dockerclient.JSONFileDriver, dockerclient.NoneDriver}, TaskCleanupWaitDuration: DefaultTaskCleanupWaitDuration, DockerStopTimeout: DefaultDockerStopTimeout, CredentialsAuditLogFile: defaultCredentialsAuditLogFile, diff --git a/agent/config/config_unix_test.go b/agent/config/config_unix_test.go index d9446236f1a..54a8a14e168 100644 --- a/agent/config/config_unix_test.go +++ b/agent/config/config_unix_test.go @@ -61,7 +61,8 @@ func TestConfigDefault(t *testing.T) { assert.Equal(t, uint16(0), cfg.ReservedMemory, "Default reserved memory set incorrectly") assert.Equal(t, 30*time.Second, cfg.DockerStopTimeout, "Default docker stop container timeout set incorrectly") assert.False(t, cfg.PrivilegedDisabled, "Default PrivilegedDisabled set incorrectly") - assert.Equal(t, []dockerclient.LoggingDriver{dockerclient.JSONFileDriver}, cfg.AvailableLoggingDrivers, "Default logging drivers set incorrectly") + assert.Equal(t, []dockerclient.LoggingDriver{dockerclient.JSONFileDriver, dockerclient.NoneDriver}, + cfg.AvailableLoggingDrivers, "Default logging drivers set incorrectly") assert.Equal(t, 3*time.Hour, cfg.TaskCleanupWaitDuration, "Default task cleanup wait duration set incorrectly") assert.False(t, cfg.TaskENIEnabled, "TaskENIEnabled set incorrectly") assert.False(t, cfg.TaskIAMRoleEnabled, "TaskIAMRoleEnabled set incorrectly") diff --git a/agent/config/config_windows.go b/agent/config/config_windows.go index c64d5dd0a15..c0a5fce0334 100644 --- a/agent/config/config_windows.go +++ b/agent/config/config_windows.go @@ -67,7 +67,7 @@ func DefaultConfig() Config { // DisableMetrics is set to true on Windows as docker stats does not work DisableMetrics: true, ReservedMemory: 0, - AvailableLoggingDrivers: []dockerclient.LoggingDriver{dockerclient.JSONFileDriver}, + AvailableLoggingDrivers: []dockerclient.LoggingDriver{dockerclient.JSONFileDriver, dockerclient.NoneDriver}, TaskCleanupWaitDuration: DefaultTaskCleanupWaitDuration, DockerStopTimeout: DefaultDockerStopTimeout, CredentialsAuditLogFile: filepath.Join(ecsRoot, defaultCredentialsAuditLogFile), diff --git a/agent/config/config_windows_test.go b/agent/config/config_windows_test.go index f052faf965f..85292202126 100644 --- a/agent/config/config_windows_test.go +++ b/agent/config/config_windows_test.go @@ -54,7 +54,8 @@ func TestConfigDefault(t *testing.T) { assert.Equal(t, uint16(0), cfg.ReservedMemory, "Default reserved memory set incorrectly") assert.Equal(t, 30*time.Second, cfg.DockerStopTimeout, "Default docker stop container timeout set incorrectly") assert.False(t, cfg.PrivilegedDisabled, "Default PrivilegedDisabled set incorrectly") - assert.Equal(t, []dockerclient.LoggingDriver{dockerclient.JSONFileDriver}, cfg.AvailableLoggingDrivers, "Default logging drivers set incorrectly") + assert.Equal(t, []dockerclient.LoggingDriver{dockerclient.JSONFileDriver, dockerclient.NoneDriver}, + cfg.AvailableLoggingDrivers, "Default logging drivers set incorrectly") assert.Equal(t, 3*time.Hour, cfg.TaskCleanupWaitDuration, "Default task cleanup wait duration set incorrectly") assert.False(t, cfg.TaskIAMRoleEnabled, "TaskIAMRoleEnabled set incorrectly") assert.False(t, cfg.TaskIAMRoleEnabledForNetworkHost, "TaskIAMRoleEnabledForNetworkHost set incorrectly") diff --git a/agent/config/types.go b/agent/config/types.go index 05549c9c58f..b3076ba6cc9 100644 --- a/agent/config/types.go +++ b/agent/config/types.go @@ -91,7 +91,7 @@ type Config struct { DockerStopTimeout time.Duration // AvailableLoggingDrivers specifies the logging drivers available for use - // with Docker. If not set, it defaults to ["json-file"]. + // with Docker. If not set, it defaults to ["json-file","none"]. AvailableLoggingDrivers []dockerclient.LoggingDriver // PrivilegedDisabled specified whether the Agent is capable of launching diff --git a/agent/engine/dockerclient/logging_drivers.go b/agent/engine/dockerclient/logging_drivers.go index 484e7fc613b..9376d9c748f 100644 --- a/agent/engine/dockerclient/logging_drivers.go +++ b/agent/engine/dockerclient/logging_drivers.go @@ -25,6 +25,7 @@ const ( SplunklogsDriver LoggingDriver = "splunk" LogentriesDriver LoggingDriver = "logentries" SumoLogicDriver LoggingDriver = "sumologic" + NoneDriver LoggingDriver = "none" ) var LoggingDriverMinimumVersion = map[LoggingDriver]DockerVersion{ @@ -37,4 +38,5 @@ var LoggingDriverMinimumVersion = map[LoggingDriver]DockerVersion{ SplunklogsDriver: Version_1_22, LogentriesDriver: Version_1_25, SumoLogicDriver: Version_1_29, + NoneDriver: Version_1_18, } From 29747d4d55efb5d7c4ac0659bf73aef46f5c24fd Mon Sep 17 00:00:00 2001 From: Aithal Date: Fri, 27 Oct 2017 15:15:45 -0700 Subject: [PATCH 2/4] changelog entry for none log driver support --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1dfd4acc01a..ab633c4997c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ * Feature - Support for provisioning Tasks with ENIs * Enhancement - Support `init` process in containers by adding support for Docker remote API client version 1.25 [#996](https://github.com/aws/amazon-ecs-agent/pull/996) +* Enhancement - Enable 'none' logging driver capability by default + [#1041](https://github.com/aws/amazon-ecs-agent/pull/1041) * Bug - Fixed a bug where tasks that fail to pull containers can cause the agent to fail to restore properly after a restart. [#1033](https://github.com/aws/amazon-ecs-agent/pull/1033) From c25f354840cea1b2f03f3fc634a39ba88eb2d055 Mon Sep 17 00:00:00 2001 From: Aithal Date: Fri, 27 Oct 2017 15:20:54 -0700 Subject: [PATCH 3/4] change min docker version to for none log driver changed min docker version required to 1.19 --- agent/engine/dockerclient/logging_drivers.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/agent/engine/dockerclient/logging_drivers.go b/agent/engine/dockerclient/logging_drivers.go index 9376d9c748f..0aec379b03b 100644 --- a/agent/engine/dockerclient/logging_drivers.go +++ b/agent/engine/dockerclient/logging_drivers.go @@ -38,5 +38,5 @@ var LoggingDriverMinimumVersion = map[LoggingDriver]DockerVersion{ SplunklogsDriver: Version_1_22, LogentriesDriver: Version_1_25, SumoLogicDriver: Version_1_29, - NoneDriver: Version_1_18, + NoneDriver: Version_1_19, } From 044fadae7d2c6a59459bce57bf6d805a177dce4c Mon Sep 17 00:00:00 2001 From: Aithal Date: Mon, 30 Oct 2017 09:08:00 -0700 Subject: [PATCH 4/4] readme changes for 'none' logging driver --- README.md | 2 +- agent/app/agent_capability.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1ee0d31d5b7..78b3dee42f4 100644 --- a/README.md +++ b/README.md @@ -162,7 +162,7 @@ configure them as something other than the defaults. | `ECS_UPDATE_DOWNLOAD_DIR` | /cache | Where to place update tarballs within the container. | | | | `ECS_DISABLE_METRICS` | <true | false> | Whether to disable metrics gathering for tasks. | false | true | | `ECS_RESERVED_MEMORY` | 32 | Memory, in MB, to reserve for use by things other than containers managed by Amazon ECS. | 0 | 0 | -| `ECS_AVAILABLE_LOGGING_DRIVERS` | `["awslogs","fluentd","gelf","json-file","journald","logentries","splunk","syslog"]` | Which logging drivers are available on the container instance. | `["json-file"]` | `["json-file"]` | +| `ECS_AVAILABLE_LOGGING_DRIVERS` | `["awslogs","fluentd","gelf","json-file","journald","logentries","splunk","syslog"]` | Which logging drivers are available on the container instance. | `["json-file","none"]` | `["json-file","none"]` | | `ECS_DISABLE_PRIVILEGED` | `true` | Whether launching privileged containers is disabled on the container instance. | `false` | `false` | | `ECS_SELINUX_CAPABLE` | `true` | Whether SELinux is available on the container instance. | `false` | `false` | | `ECS_APPARMOR_CAPABLE` | `true` | Whether AppArmor is available on the container instance. | `false` | `false` | diff --git a/agent/app/agent_capability.go b/agent/app/agent_capability.go index 6a6c905f903..e27bf5f7012 100644 --- a/agent/app/agent_capability.go +++ b/agent/app/agent_capability.go @@ -45,6 +45,7 @@ const ( // com.amazonaws.ecs.capability.logging-driver.fluentd // com.amazonaws.ecs.capability.logging-driver.journald // com.amazonaws.ecs.capability.logging-driver.gelf +// com.amazonaws.ecs.capability.logging-driver.none // com.amazonaws.ecs.capability.selinux // com.amazonaws.ecs.capability.apparmor // com.amazonaws.ecs.capability.ecr-auth