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

V1.47.0 stage #2698

Merged
merged 13 commits into from
Nov 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 1.47.0
* Feature - Add support for FSxWindowsFileServerVolumeConfiguration in task definition [#2690](https://github.com/aws/amazon-ecs-agent/pull/2690)
* Bug - Fixed Makefile to use Go1.12 for Agent windows build
[#2688](https://github.com/aws/amazon-ecs-agent/pull/2688)
* Bug - Initialize the logger from the agent’s main() [#2644](https://github.com/aws/amazon-ecs-agent/pull/2644)

## 1.46.0
* Enhancement - Use Go 1.15 for Linux platforms and Go 1.12 for Windows platforms [#2653](https://github.com/aws/amazon-ecs-agent/pull/2653)
* Bug - Currently, while polling docker stats, there is no timeout for the API call. So the call could be stuck until the container is stopped. Adding poll stats timeout [#2656](https://github.com/aws/amazon-ecs-agent/pull/2656)
Expand Down
27 changes: 20 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ else
GOARCH=amd64
endif

ifeq (${TARGET_OS},windows)
GO_VERSION=1.12
else
GO_VERSION=1.15
endif

all: docker

# Dynamic go build; useful in that it does not have -a so it won't recompile
Expand All @@ -47,7 +53,7 @@ xplatform-build:

BUILDER_IMAGE="amazon/amazon-ecs-agent-build:make"
.builder-image-stamp: scripts/dockerfiles/Dockerfile.build
@docker build -f scripts/dockerfiles/Dockerfile.build -t $(BUILDER_IMAGE) .
@docker build --build-arg GO_VERSION=$(GO_VERSION) -f scripts/dockerfiles/Dockerfile.build -t $(BUILDER_IMAGE) .
touch .builder-image-stamp

# 'build-in-docker' builds the agent within a dockerfile and saves it to the ./out
Expand All @@ -71,11 +77,17 @@ docker: certs build-in-docker pause-container-release cni-plugins .out-stamp
@docker build -f scripts/dockerfiles/Dockerfile.release -t "amazon/amazon-ecs-agent:make" .
@echo "Built Docker image \"amazon/amazon-ecs-agent:make\""

ifeq (${TARGET_OS},windows)
BUILD="cleanbuild-${TARGET_OS}"
else
BUILD=cleanbuild
endif

# 'docker-release' builds the agent from a clean snapshot of the git repo in
# 'RELEASE' mode
# TODO: make this idempotent
docker-release: pause-container-release cni-plugins .out-stamp
@docker build -f scripts/dockerfiles/Dockerfile.cleanbuild -t "amazon/amazon-ecs-agent-cleanbuild:make" .
@docker build --build-arg GO_VERSION=${GO_VERSION} -f scripts/dockerfiles/Dockerfile.cleanbuild -t "amazon/amazon-ecs-agent-${BUILD}:make" .
@docker run --net=none \
--env TARGET_OS="${TARGET_OS}" \
--env LDFLAGS="-X github.com/aws/amazon-ecs-agent/agent/config.DefaultPauseContainerTag=$(PAUSE_CONTAINER_TAG) \
Expand All @@ -84,7 +96,7 @@ docker-release: pause-container-release cni-plugins .out-stamp
--volume "$(PWD)/out:/out" \
--volume "$(PWD):/src/amazon-ecs-agent" \
--rm \
"amazon/amazon-ecs-agent-cleanbuild:make"
"amazon/amazon-ecs-agent-${BUILD}:make"

# Release packages our agent into a "scratch" based dockerfile
release: certs docker-release
Expand Down Expand Up @@ -181,7 +193,7 @@ get-cni-sources:
git submodule update --init --recursive

build-ecs-cni-plugins:
@docker build -f scripts/dockerfiles/Dockerfile.buildECSCNIPlugins -t "amazon/amazon-ecs-build-ecs-cni-plugins:make" .
@docker build --build-arg GO_VERSION=$(GO_VERSION) -f scripts/dockerfiles/Dockerfile.buildECSCNIPlugins -t "amazon/amazon-ecs-build-ecs-cni-plugins:make" .
docker run --rm --net=none \
-e GIT_SHORT_HASH=$(shell cd $(ECS_CNI_REPOSITORY_SRC_DIR) && git rev-parse --short=8 HEAD) \
-e GIT_PORCELAIN=$(shell cd $(ECS_CNI_REPOSITORY_SRC_DIR) && git status --porcelain 2> /dev/null | wc -l | sed 's/^ *//') \
Expand All @@ -192,7 +204,7 @@ build-ecs-cni-plugins:
@echo "Built amazon-ecs-cni-plugins successfully."

build-vpc-cni-plugins:
@docker build --build-arg GOARCH=$(GOARCH) -f scripts/dockerfiles/Dockerfile.buildVPCCNIPlugins -t "amazon/amazon-ecs-build-vpc-cni-plugins:make" .
@docker build --build-arg GOARCH=$(GOARCH) --build-arg GO_VERSION=$(GO_VERSION) -f scripts/dockerfiles/Dockerfile.buildVPCCNIPlugins -t "amazon/amazon-ecs-build-vpc-cni-plugins:make" .
docker run --rm --net=none \
-e GIT_SHORT_HASH=$(shell cd $(VPC_CNI_REPOSITORY_SRC_DIR) && git rev-parse --short=8 HEAD) \
-u "$(USERID)" \
Expand Down Expand Up @@ -268,7 +280,7 @@ GOFILES:=$(shell go list -f '{{$$p := .}}{{range $$f := .GoFiles}}{{$$p.Dir}}/{{
.PHONY: gocyclo
gocyclo:
# Run gocyclo over all .go files
gocyclo -over 15 ${GOFILES}
gocyclo -over 17 ${GOFILES}

# same as gofiles above, but without the `-f`
.PHONY: govet
Expand Down Expand Up @@ -304,7 +316,7 @@ GOPATH=$(shell go env GOPATH)
go get github.com/golang/mock/mockgen
cd "${GOPATH}/src/github.com/golang/mock/mockgen" && git checkout 1.3.1 && go get ./... && go install ./... && cd -
go get golang.org/x/tools/cmd/goimports
go get github.com/fzipp/gocyclo
go get github.com/fzipp/gocyclo/cmd/gocyclo
go get honnef.co/go/tools/cmd/staticcheck
touch .get-deps-stamp

Expand All @@ -331,6 +343,7 @@ clean:
# ensure docker is running and we can talk to it, abort if not:
docker ps > /dev/null
-docker rmi $(BUILDER_IMAGE) "amazon/amazon-ecs-agent-cleanbuild:make"
-docker rmi $(BUILDER_IMAGE) "amazon/amazon-ecs-agent-cleanbuild-windows:make"
rm -f misc/certs/ca-certificates.crt &> /dev/null
rm -rf out/
-$(MAKE) -C $(ECS_CNI_REPOSITORY_SRC_DIR) clean
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ additional details on each available environment variable.
| `ECS_LOG_DRIVER` | `awslogs` | `fluentd` | `gelf` | `json-file` | `journald` | `logentries` | `syslog` | `splunk` | The logging driver to be used by the Agent container. | `json-file` | Not applicable |
| `ECS_LOG_OPTS` | `{"option":"value"}` | The options for configuring the logging driver set in `ECS_LOG_DRIVER`. | `{}` | Not applicable |
| `ECS_ENABLE_AWSLOGS_EXECUTIONROLE_OVERRIDE` | `true` | Whether to enable awslogs log driver to authenticate via credentials of task execution IAM role. Needs to be true if you want to use awslogs log driver in a task that has task execution IAM role specified. When using the ecs-init RPM with version equal or later than V1.16.0-1, this env is set to true by default. | `false` | `false` |
| `ECS_FSX_WINDOWS_FILE_SERVER_SUPPORTED` | `true` | Whether FSx for Windows File Server volume type is supported on the container instance. This variable is only supported on agent versions 1.47.0 and later. | `false` | `true` |

### Persistence

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.46.0
1.47.0
4 changes: 3 additions & 1 deletion agent/Gopkg.lock

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

21 changes: 19 additions & 2 deletions agent/acs/model/api/api-2.json
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,21 @@
"message":{"shape":"String"}
}
},
"FSxWindowsFileServerAuthorizationConfig":{
"type":"structure",
"members":{
"credentialsParameter":{"shape":"String"},
"domain":{"shape":"String"}
}
},
"FSxWindowsFileServerVolumeConfiguration":{
"type":"structure",
"members":{
"fileSystemId":{"shape":"String"},
"rootDirectory":{"shape":"String"},
"authorizationConfig":{"shape":"FSxWindowsFileServerAuthorizationConfig"}
}
},
"HealthCheckType":{
"type":"string",
"enum":["docker"]
Expand Down Expand Up @@ -720,7 +735,8 @@
"type":{"shape":"VolumeType"},
"host":{"shape":"HostVolumeProperties"},
"dockerVolumeConfiguration":{"shape":"DockerVolumeConfiguration"},
"efsVolumeConfiguration":{"shape":"EFSVolumeConfiguration"}
"efsVolumeConfiguration":{"shape":"EFSVolumeConfiguration"},
"fsxWindowsFileServerVolumeConfiguration":{"shape":"FSxWindowsFileServerVolumeConfiguration"}
}
},
"VolumeFrom":{
Expand All @@ -743,7 +759,8 @@
"enum":[
"host",
"docker",
"efs"
"efs",
"fsxWindowsFileServer"
]
},
"TaskIdentifier": {
Expand Down
40 changes: 40 additions & 0 deletions agent/acs/model/ecsacs/api.go

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

2 changes: 2 additions & 0 deletions agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ import (
"time"

"github.com/aws/amazon-ecs-agent/agent/app"
"github.com/aws/amazon-ecs-agent/agent/logger"
)

func init() {
rand.Seed(time.Now().UnixNano())
}

func main() {
logger.InitSeelog()
os.Exit(app.Run(os.Args[1:]))
}
10 changes: 9 additions & 1 deletion agent/api/task/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,14 @@ func (task *Task) PostUnmarshalTask(cfg *config.Config,
}
task.populateTaskARN()

// fsxWindowsFileserver is the product type -- it is technically "agnostic" ie it should apply to both Windows and Linux tasks
if task.requiresFSxWindowsFileServerResource() {
if err := task.initializeFSxWindowsFileServerResource(cfg, credentialsManager, resourceFields); err != nil {
seelog.Errorf("Task [%s]: could not initialize FSx for Windows File Server resource: %v", task.Arn, err)
return apierrors.NewResourceInitError(task.Arn, err)
}
}

return nil
}

Expand Down Expand Up @@ -1316,7 +1324,7 @@ func (task *Task) HostVolumeByName(name string) (taskresourcevolume.Volume, bool
// volume feature.
func (task *Task) UpdateMountPoints(cont *apicontainer.Container, vols []types.MountPoint) {
for _, mountPoint := range cont.MountPoints {
containerPath := getCanonicalPath(mountPoint.ContainerPath)
containerPath := utils.GetCanonicalPath(mountPoint.ContainerPath)
for _, vol := range vols {
if strings.Compare(vol.Destination, containerPath) == 0 ||
// /path/ -> /path or \path\ -> \path
Expand Down
14 changes: 12 additions & 2 deletions agent/api/task/task_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ func (task *Task) initializeCgroupResourceSpec(cgroupPath string, cGroupCPUPerio
return nil
}

func getCanonicalPath(path string) string { return path }

// BuildCgroupRoot helps build the task cgroup prefix
// Example: /ecs/task-id
func (task *Task) BuildCgroupRoot() (string, error) {
Expand Down Expand Up @@ -241,3 +239,15 @@ func enableIPv6SysctlSetting(hostConfig *dockercontainer.HostConfig) {
}
hostConfig.Sysctls[disableIPv6SysctlKey] = sysctlValueOff
}

// requiresFSxWindowsFileServerResource returns true if at least one volume in the task
// is of type 'fsxWindowsFileServer'
func (task *Task) requiresFSxWindowsFileServerResource() bool {
return false
}

// initializeFSxWindowsFileServerResource builds the resource dependency map for the fsxwindowsfileserver resource
func (task *Task) initializeFSxWindowsFileServerResource(cfg *config.Config, credentialsManager credentials.Manager,
resourceFields *taskresource.ResourceFields) error {
return errors.New("task with FSx for Windows File Server volumes is only supported on Windows container instance")
}
14 changes: 12 additions & 2 deletions agent/api/task/task_unsupported.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ func (task *Task) adjustForPlatform(cfg *config.Config) {
task.MemoryCPULimitsEnabled = cfg.TaskCPUMemLimit.Enabled()
}

func getCanonicalPath(path string) string { return path }

func (task *Task) initializeCgroupResourceSpec(cgroupPath string, cGroupCPUPeriod time.Duration, resourceFields *taskresource.ResourceFields) error {
return nil
}
Expand Down Expand Up @@ -80,3 +78,15 @@ func (task *Task) GetCredentialSpecResource() ([]taskresource.TaskResource, bool
func enableIPv6SysctlSetting(hostConfig *dockercontainer.HostConfig) {
return
}

// requiresFSxWindowsFileServerResource returns true if at least one volume in the task
// is of type 'fsxWindowsFileServer'
func (task *Task) requiresFSxWindowsFileServerResource() bool {
return false
}

// initializeFSxWindowsFileServerResource builds the resource dependency map for the fsxwindowsfileserver resource
func (task *Task) initializeFSxWindowsFileServerResource(cfg *config.Config, credentialsManager credentials.Manager,
resourceFields *taskresource.ResourceFields) error {
return errors.New("task with FSx for Windows File Server volumes is only supported on Windows container instance")
}
Loading