Skip to content

Commit

Permalink
engine/dockerclient, app: Add new Docker version support and required…
Browse files Browse the repository at this point in the history
… agent Capability

New Docker client versions' agent capabilities to use the Capability prefix "ecs.capability"
  • Loading branch information
sharanyad committed Sep 28, 2017
1 parent b3db90b commit 0430a03
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion agent/app/agent_capability.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
package app

import (
"strconv"

"github.com/aws/amazon-ecs-agent/agent/ecs_client/model/ecs"
"github.com/aws/amazon-ecs-agent/agent/ecscni"
"github.com/aws/amazon-ecs-agent/agent/engine/dockerclient"
Expand All @@ -30,6 +32,7 @@ const (
taskENIAttributeSuffix = "task-eni"
taskENIBlockInstanceMetadataAttributeSuffix = "task-eni-block-instance-metadata"
cniPluginVersionSuffix = "cni-plugin-version"
dockerVersionUsingNewCapabilityPrefix = 1.25
)

// capabilities returns the supported capabilities of this agent / docker-client pair.
Expand Down Expand Up @@ -63,7 +66,12 @@ func (agent *ecsAgent) capabilities() []*ecs.Attribute {
// Determine API versions to report as supported. Supported versions are also used for capability-enablement, except
// logging drivers.
for _, version := range agent.dockerClient.SupportedVersions() {
capabilities = appendNameOnlyAttribute(capabilities, capabilityPrefix+"docker-remote-api."+string(version))
dockerVersion, _ := strconv.ParseFloat(string(version), 64)
if dockerVersion >= dockerVersionUsingNewCapabilityPrefix {
capabilities = appendNameOnlyAttribute(capabilities, attributePrefix+"docker-remote-api."+string(version))
} else {
capabilities = appendNameOnlyAttribute(capabilities, capabilityPrefix+"docker-remote-api."+string(version))
}
supportedVersions[version] = true
}

Expand Down
1 change: 1 addition & 0 deletions agent/engine/dockerclient/versionsupport_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func getAgentVersions() []DockerVersion {
Version_1_22,
Version_1_23,
Version_1_24,
Version_1_25,
}
}

Expand Down

0 comments on commit 0430a03

Please sign in to comment.