Clear Architecture field in platform constraint for arm architectures

Signed-off-by: Nishant Totla <nishanttotla@gmail.com>
This commit is contained in:
Nishant Totla 2017-07-07 15:10:15 -07:00
parent cb952bf006
commit 772af6040e
No known key found for this signature in database
GPG key ID: 7EA5781C9B3D0C19

View file

@ -3,6 +3,7 @@ package client
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"strings"
"github.com/docker/distribution/reference" "github.com/docker/distribution/reference"
"github.com/docker/docker/api/types" "github.com/docker/docker/api/types"
@ -98,6 +99,16 @@ func imageDigestAndPlatforms(ctx context.Context, cli DistributionAPIClient, ima
if len(distributionInspect.Platforms) > 0 { if len(distributionInspect.Platforms) > 0 {
platforms = make([]swarm.Platform, 0, len(distributionInspect.Platforms)) platforms = make([]swarm.Platform, 0, len(distributionInspect.Platforms))
for _, p := range distributionInspect.Platforms { for _, p := range distributionInspect.Platforms {
// clear architecture field for arm. This is a temporary patch to address
// https://github.com/docker/swarmkit/issues/2294. The issue is that while
// image manifests report "arm" as the architecture, the node reports
// something like "armv7l" (includes the variant), which causes arm images
// to stop working with swarm mode. This patch removes the architecture
// constraint for arm images to ensure tasks get scheduled.
arch := strings.ToLower(p.Architecture)
if arch == "arm" {
arch = ""
}
platforms = append(platforms, swarm.Platform{ platforms = append(platforms, swarm.Platform{
Architecture: p.Architecture, Architecture: p.Architecture,
OS: p.OS, OS: p.OS,