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.14.1 release #723

Merged
merged 29 commits into from
Mar 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
2e91fea
Fixed some race conditions in task engine tests (#673)
aaithal Jan 25, 2017
1be5420
Fixed https://github.com/aws/amazon-ecs-agent/issues/506
liwenwu-amazon Dec 21, 2016
d179457
Update tcshandler logging for seelog.
Jan 31, 2017
7219a65
travis: remove hacky symlinking
euank Feb 1, 2017
95dd837
Merge pull request #693 from nmeyerhans/tcs-logging
nmeyerhans Feb 2, 2017
6a9584a
engine: Increase start and create timeouts
samuelkarp Feb 3, 2017
89930da
Fix test batch container happy path unit test (#703)
aaithal Feb 9, 2017
e66feed
Fixed a race condition that can cause agent panici
Jan 24, 2017
d43880f
Increase the task life duration to fix CleanupDoesNotDeadlock functio…
Jan 25, 2017
de17a2c
updating gorilla/websocket
petderek Dec 14, 2016
e6d30e8
Use gorilla/websocket proxy
petderek Dec 15, 2016
496df86
api/task.go: Fix many metalinter warnings
samuelkarp Feb 9, 2017
0bd64f3
api: Handle SentStatus more safely
samuelkarp Feb 9, 2017
57b21c7
engine: Report task status prior to removal
samuelkarp Feb 9, 2017
eb98724
dockerstate: Create TaskEngineState interface
samuelkarp Feb 10, 2017
c9a1295
engine: Unit tests for managedTask.cleanupTask
samuelkarp Feb 10, 2017
3d154da
engine: Abort tasks with corrupted internal state
samuelkarp Feb 10, 2017
4477e30
engine: Extract wait logic for stop reporting
samuelkarp Feb 10, 2017
d113ab4
Update copyright on modified files
samuelkarp Feb 10, 2017
61371b4
engine: Simplify code in mtask.cleanupTask
samuelkarp Feb 10, 2017
38165f2
Update LICENSE to 2017
vsiddharth Feb 1, 2017
017dcbe
Update gogenerate mock interfaces
vsiddharth Feb 2, 2017
43ed35a
Update README for `ECS_INSTANCE_ATTRIBUTES`
vsiddharth Feb 6, 2017
2eda892
Update wording from `list` to `map` for clarity
vsiddharth Feb 13, 2017
0e6ebda
Adding functional tests for Custom-Instance-Attributes
vsiddharth Feb 8, 2017
9f4c10a
Log a bit more info around image pulls.
Feb 20, 2017
760c64f
Update log wording to indicate that measured latency includes lock ac…
Mar 1, 2017
737db6b
Merge pull request #715 from nmeyerhans/pull-logging
adnxn Mar 3, 2017
467c3d7
update agent version to 1.14.1
adnxn Mar 6, 2017
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
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
language: go
sudo: false
go:
- 1.7
before_install: ./scripts/hack/symlink-gopath-travisci
- 1.7
go_import_path: github.com/aws/amazon-ecs-agent

install: make get-deps
script:
# Full tests require building/running docker containers; short only for now
- cd $HOME/gopath/src/github.com/aws/amazon-ecs-agent; make test
- make test
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 1.14.1
* Enhancement - Log completion of image pulls. [#715](https://github.com/aws/amazon-ecs-agent/pull/715)
* Enhancement - Increase start and create timeouts to improve reliability under
some workloads. [#696](https://github.com/aws/amazon-ecs-agent/pull/696)
* Bug - Fixed a bug where throttles on state change reporting could lead to
corrupted state. [#705](https://github.com/aws/amazon-ecs-agent/pull/705)
* Bug - Correct formatting of log messages from tcshandler. [#693](https://github.com/aws/amazon-ecs-agent/pull/693)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to include the first one and this in the changelog, which is just helpful for debugging.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that we don't need to include everything in our changelog, but since this was an addition of a "debugging feature" it seemed worth including.

* Bug - Fixed an issue where agent could crash. [#692](https://github.com/aws/amazon-ecs-agent/pull/692)

## 1.14.0
* Feature - Support definition of custom attributes on agent registration.
* Feature - Support Docker on Windows Server 2016.
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2014-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Copyright 2014-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"). You
may not use this file except in compliance with the License. A copy of
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ configure them as something other than the defaults.
| `ECS_IMAGE_CLEANUP_INTERVAL` | 30m | The time interval between automated image cleanup cycles. If set to less than 10 minutes, the value is ignored. | 30m | 30m |
| `ECS_IMAGE_MINIMUM_CLEANUP_AGE` | 30m | The minimum time interval between when an image is pulled and when it can be considered for automated image cleanup. | 1h | 1h |
| `ECS_NUM_IMAGES_DELETE_PER_CYCLE` | 5 | The maximum number of images to delete in a single automated image cleanup cycle. If set to less than 1, the value is ignored. | 5 | 5 |
| `ECS_INSTANCE_ATTRIBUTES` | `[{"stack": "prod"}]` | A list of custom attributes, in JSON form, to apply to your container instances. | `[]` | `[]` |
| `ECS_INSTANCE_ATTRIBUTES` | `{"stack": "prod"}` | A map of custom attributes, in JSON form, to apply to your container instances. | `{}` | `{}` |

### Persistence

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.14.0
1.14.1
7 changes: 4 additions & 3 deletions agent/Godeps/Godeps.json

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

14 changes: 7 additions & 7 deletions agent/acs/client/acs_client.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2014-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// Copyright 2014-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"). You may
// not use this file except in compliance with the License. A copy of the
Expand All @@ -21,6 +21,7 @@ package acsclient
import (
"errors"

"github.com/aws/amazon-ecs-agent/agent/config"
"github.com/aws/amazon-ecs-agent/agent/logger"
"github.com/aws/amazon-ecs-agent/agent/wsclient"
"github.com/aws/aws-sdk-go/aws/credentials"
Expand All @@ -36,15 +37,14 @@ type clientServer struct {
// New returns a client/server to bidirectionally communicate with ACS
// The returned struct should have both 'Connect' and 'Serve' called upon it
// before being used.
func New(url string, region string, credentialProvider *credentials.Credentials, acceptInvalidCert bool) wsclient.ClientServer {
func New(url string, cfg *config.Config, credentialProvider *credentials.Credentials) wsclient.ClientServer {
cs := &clientServer{}
cs.URL = url
cs.Region = region
cs.CredentialProvider = credentialProvider
cs.AcceptInvalidCert = acceptInvalidCert
cs.AgentConfig = cfg
cs.ServiceError = &acsError{}
cs.RequestHandlers = make(map[string]wsclient.RequestHandler)
cs.TypeDecoder = &decoder{}
cs.TypeDecoder = NewACSDecoder()
return cs
}

Expand All @@ -53,8 +53,8 @@ func New(url string, region string, credentialProvider *credentials.Credentials,
// call as unhandled requests will be discarded.
func (cs *clientServer) Serve() error {
log.Debug("Starting websocket poll loop")
if cs.Conn == nil {
return errors.New("nil connection")
if !cs.IsReady() {
return errors.New("Websocket not ready for connections")
}
return cs.ConsumeMessages()
}
Expand Down
17 changes: 12 additions & 5 deletions agent/acs/client/acs_client_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2014-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// Copyright 2014-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"). You may
// not use this file except in compliance with the License. A copy of the
Expand All @@ -23,6 +23,7 @@ import (
"time"

"github.com/aws/amazon-ecs-agent/agent/acs/model/ecsacs"
"github.com/aws/amazon-ecs-agent/agent/config"
"github.com/aws/amazon-ecs-agent/agent/wsclient"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
Expand Down Expand Up @@ -54,6 +55,11 @@ type messageLogger struct {
closed bool
}

var testCfg = &config.Config{
AcceptInsecureCert: true,
AWSRegion: "us-east-1",
}

func (ml *messageLogger) WriteMessage(_ int, data []byte) error {
if ml.closed {
return errors.New("can't write to closed ws")
Expand Down Expand Up @@ -81,9 +87,10 @@ func (ml *messageLogger) ReadMessage() (int, []byte, error) {

func testCS() (wsclient.ClientServer, *messageLogger) {
testCreds := credentials.AnonymousCredentials
cs := New("localhost:443", "us-east-1", testCreds, true).(*clientServer)

cs := New("localhost:443", testCfg, testCreds).(*clientServer)
ml := &messageLogger{make([][]byte, 0), make([][]byte, 0), false}
cs.Conn = ml
cs.SetConnection(ml)
return cs, ml
}

Expand Down Expand Up @@ -281,7 +288,7 @@ func TestConnect(t *testing.T) {
t.Fatal(<-serverErr)
}()

cs := New(server.URL, "us-east-1", credentials.AnonymousCredentials, true)
cs := New(server.URL, testCfg, credentials.AnonymousCredentials)
// Wait for up to a second for the mock server to launch
for i := 0; i < 100; i++ {
err = cs.Connect()
Expand Down Expand Up @@ -352,7 +359,7 @@ func TestConnectClientError(t *testing.T) {
}))
defer testServer.Close()

cs := New(testServer.URL, "us-east-1", credentials.AnonymousCredentials, true)
cs := New(testServer.URL, testCfg, credentials.AnonymousCredentials)
err := cs.Connect()
if _, ok := err.(*wsclient.WSError); !ok || err.Error() != "InvalidClusterException: Invalid cluster" {
t.Error("Did not get correctly typed error: " + err.Error())
Expand Down
31 changes: 6 additions & 25 deletions agent/acs/client/acs_client_types.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2014-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// Copyright 2014-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"). You may
// not use this file except in compliance with the License. A copy of the
Expand All @@ -14,12 +14,11 @@
package acsclient

import (
"reflect"

"github.com/aws/amazon-ecs-agent/agent/acs/model/ecsacs"
"github.com/aws/amazon-ecs-agent/agent/wsclient"
)

var acsTypeMappings map[string]reflect.Type
var acsRecognizedTypes []interface{}

func init() {
// This list is currently *manually updated* and assumes that the generated
Expand All @@ -29,7 +28,7 @@ func init() {
// I couldn't figure out how to get a list of all structs in a package via
// reflection, but that would solve this. The alternative is to either parse
// the .json model or the generated struct names.
recognizedTypes := []interface{}{
acsRecognizedTypes = []interface{}{
ecsacs.HeartbeatMessage{},
ecsacs.PayloadMessage{},
ecsacs.CloseMessage{},
Expand All @@ -47,26 +46,8 @@ func init() {
ecsacs.InactiveInstanceException{},
ecsacs.ErrorMessage{},
}

acsTypeMappings = make(map[string]reflect.Type)
// This produces a map of:
// "MyMessage": TypeOf(ecsacs.MyMessage)
for _, recognizedType := range recognizedTypes {
acsTypeMappings[reflect.TypeOf(recognizedType).Name()] = reflect.TypeOf(recognizedType)
}
}

// decoder implments wsclient.TypeDecoder.
type decoder struct{}

func (dc *decoder) NewOfType(acsType string) (interface{}, bool) {
rtype, ok := acsTypeMappings[acsType]
if !ok {
return nil, false
}
return reflect.New(rtype).Interface(), true
}

func (dc *decoder) GetRecognizedTypes() map[string]reflect.Type {
return acsTypeMappings
func NewACSDecoder() wsclient.TypeDecoder {
return wsclient.BuildTypeDecoder(acsRecognizedTypes)
}
22 changes: 7 additions & 15 deletions agent/acs/handler/acs_handler.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2014-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// Copyright 2014-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"). You may
// not use this file except in compliance with the License. A copy of the
Expand Down Expand Up @@ -79,7 +79,6 @@ type session struct {
taskEngine engine.TaskEngine
ecsClient api.ECSClient
stateManager statemanager.StateManager
acceptInsecureCert bool
credentialsManager rolecredentials.Manager
ctx context.Context
cancel context.CancelFunc
Expand All @@ -99,17 +98,15 @@ type session struct {
// The goal is to make it easier to test and inject dependencies
type sessionResources interface {
// createACSClient creates a new websocket client
createACSClient(url string) wsclient.ClientServer
createACSClient(url string, cfg *config.Config) wsclient.ClientServer
sessionState
}

// acsSessionResources implements resource creator and session state interfaces
// to create resources needed to connect to ACS and to record session state
// for the same
type acsSessionResources struct {
region string
credentialsProvider *credentials.Credentials
acceptInsecureCert bool
// sendCredentials is used to set the 'sendCredentials' URL parameter
// used to connect to ACS
// It is set to 'true' for the very first successful connection on
Expand All @@ -131,7 +128,6 @@ type sessionState interface {

// NewSession creates a new Session object
func NewSession(ctx context.Context,
acceptInsecureCert bool,
config *config.Config,
deregisterInstanceEventStream *eventstream.EventStream,
containerInstanceArn string,
Expand All @@ -140,13 +136,12 @@ func NewSession(ctx context.Context,
stateManager statemanager.StateManager,
taskEngine engine.TaskEngine,
credentialsManager rolecredentials.Manager) Session {
resources := newSessionResources(config.AWSRegion, credentialsProvider, acceptInsecureCert)
resources := newSessionResources(credentialsProvider)
backoff := utils.NewSimpleBackoff(connectionBackoffMin, connectionBackoffMax,
connectionBackoffJitter, connectionBackoffMultiplier)
derivedContext, cancel := context.WithCancel(ctx)

return &session{
acceptInsecureCert: acceptInsecureCert,
agentConfig: config,
deregisterInstanceEventStream: deregisterInstanceEventStream,
containerInstanceARN: containerInstanceArn,
Expand Down Expand Up @@ -239,7 +234,7 @@ func (acsSession *session) startSessionOnce() error {
}

url := acsWsURL(acsEndpoint, acsSession.agentConfig.Cluster, acsSession.containerInstanceARN, acsSession.taskEngine, acsSession.resources)
client := acsSession.resources.createACSClient(url)
client := acsSession.resources.createACSClient(url, acsSession.agentConfig)
defer client.Close()

// Start inactivity timer for closing the connection
Expand Down Expand Up @@ -347,9 +342,8 @@ func (acsSession *session) heartbeatJitter() time.Duration {
}

// createACSClient creates the ACS Client using the specified URL
func (acsResources *acsSessionResources) createACSClient(url string) wsclient.ClientServer {
return acsclient.New(
url, acsResources.region, acsResources.credentialsProvider, acsResources.acceptInsecureCert)
func (acsResources *acsSessionResources) createACSClient(url string, cfg *config.Config) wsclient.ClientServer {
return acsclient.New(url, cfg, acsResources.credentialsProvider)
}

// connectedToACS records a successful connection to ACS
Expand All @@ -364,11 +358,9 @@ func (acsResources *acsSessionResources) getSendCredentialsURLParameter() string
return strconv.FormatBool(acsResources.sendCredentials)
}

func newSessionResources(region string, credentialsProvider *credentials.Credentials, acceptInsecureCert bool) sessionResources {
func newSessionResources(credentialsProvider *credentials.Credentials) sessionResources {
return &acsSessionResources{
region: region,
credentialsProvider: credentialsProvider,
acceptInsecureCert: acceptInsecureCert,
sendCredentials: true,
}
}
Expand Down
Loading