diff --git a/agent/api/task/task.go b/agent/api/task/task.go index 7964a0cc2eb..dcbd592be6c 100644 --- a/agent/api/task/task.go +++ b/agent/api/task/task.go @@ -157,8 +157,8 @@ type Task struct { // MemoryCPULimitsEnabled to determine if task supports CPU, memory limits MemoryCPULimitsEnabled bool `json:"MemoryCPULimitsEnabled,omitempty"` - // platformFields consists of fields specific to linux/windows for a task - platformFields platformFields + // PlatformFields consists of fields specific to linux/windows for a task + PlatformFields PlatformFields `json:"PlatformFields,omitempty"` // terminalReason should be used when we explicitly move a task to stopped. // This ensures the task object carries some context for why it was explicitly diff --git a/agent/api/task/task_linux.go b/agent/api/task/task_linux.go index 9abaf278de8..17e54d1dc0f 100644 --- a/agent/api/task/task_linux.go +++ b/agent/api/task/task_linux.go @@ -59,8 +59,8 @@ const ( bytesPerMegabyte = 1024 * 1024 ) -// platformFields consists of fields specific to Linux for a task -type platformFields struct{} +// PlatformFields consists of fields specific to Linux for a task +type PlatformFields struct{} func (task *Task) adjustForPlatform(cfg *config.Config) { task.lock.Lock() diff --git a/agent/api/task/task_unsupported.go b/agent/api/task/task_unsupported.go index 10762695844..e61072ae523 100644 --- a/agent/api/task/task_unsupported.go +++ b/agent/api/task/task_unsupported.go @@ -51,8 +51,8 @@ const ( bytesPerMegabyte = 1024 * 1024 ) -// platformFields consists of fields specific to Linux for a task -type platformFields struct{} +// PlatformFields consists of fields specific to Linux for a task +type PlatformFields struct{} func (task *Task) adjustForPlatform(cfg *config.Config) { task.lock.Lock() diff --git a/agent/api/task/task_windows.go b/agent/api/task/task_windows.go index 07a99b157b5..1a036e1842a 100644 --- a/agent/api/task/task_windows.go +++ b/agent/api/task/task_windows.go @@ -37,11 +37,11 @@ const ( minimumCPUPercent = 1 ) -// platformFields consists of fields specific to Windows for a task -type platformFields struct { - // cpuUnbounded determines whether a mix of unbounded and bounded CPU tasks +// PlatformFields consists of fields specific to Windows for a task +type PlatformFields struct { + // CpuUnbounded determines whether a mix of unbounded and bounded CPU tasks // are allowed to run in the instance - cpuUnbounded bool + CpuUnbounded bool `json:"cpuUnbounded"` } var cpuShareScaleFactor = runtime.NumCPU() * cpuSharesPerCore @@ -49,10 +49,10 @@ var cpuShareScaleFactor = runtime.NumCPU() * cpuSharesPerCore // adjustForPlatform makes Windows-specific changes to the task after unmarshal func (task *Task) adjustForPlatform(cfg *config.Config) { task.downcaseAllVolumePaths() - platformFields := platformFields{ - cpuUnbounded: cfg.PlatformVariables.CPUUnbounded, + platformFields := PlatformFields{ + CpuUnbounded: cfg.PlatformVariables.CPUUnbounded, } - task.platformFields = platformFields + task.PlatformFields = platformFields } // downcaseAllVolumePaths forces all volume paths (host path and container path) @@ -109,7 +109,7 @@ func (task *Task) overrideDefaultMemorySwappiness(hostConfig *docker.HostConfig) // want. Instead, we convert 0 to 2 to be closer to expected behavior. The // reason for 2 over 1 is that 1 is an invalid value (Linux's choice, not Docker's). func (task *Task) dockerCPUShares(containerCPU uint) int64 { - if containerCPU <= 1 && !task.platformFields.cpuUnbounded { + if containerCPU <= 1 && !task.PlatformFields.CpuUnbounded { seelog.Debugf( "Converting CPU shares to allowed minimum of 2 for task arn: [%s] and cpu shares: %d", task.Arn, containerCPU) diff --git a/agent/api/task/task_windows_test.go b/agent/api/task/task_windows_test.go index 9e3668fc4f6..472e672e65b 100644 --- a/agent/api/task/task_windows_test.go +++ b/agent/api/task/task_windows_test.go @@ -295,8 +295,8 @@ func TestCPUPercentBasedOnUnboundedEnabled(t *testing.T) { CPU: uint(tc.cpu), }, }, - platformFields: platformFields{ - cpuUnbounded: tc.cpuUnbounded, + PlatformFields: PlatformFields{ + CpuUnbounded: tc.cpuUnbounded, }, } diff --git a/agent/statemanager/state_manager.go b/agent/statemanager/state_manager.go index f9674f1d3d9..f0a98b163fc 100644 --- a/agent/statemanager/state_manager.go +++ b/agent/statemanager/state_manager.go @@ -64,7 +64,8 @@ const ( // b)Remove `AppliedStatus` field form 'apicontainer.Container' // 12) Deprecate 'TransitionDependencySet' and add new 'TransitionDependenciesMap' in 'apicontainer.Container' // 13) Add 'resources' field to 'api.task.task' - ECSDataVersion = 13 + // 14) Add 'PlatformFields' field to 'api.task.task' + ECSDataVersion = 14 // ecsDataFile specifies the filename in the ECS_DATADIR ecsDataFile = "ecs_agent_data.json"