Skip to content

Commit

Permalink
Fix timing issue with etcd snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
galal-hussein authored and Alena Prokharchyk committed Jun 29, 2018
1 parent 8a52e0d commit a67b5e1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"io/ioutil"
"os"
"strings"
"time"

"github.com/coreos/go-semver/semver"
ref "github.com/docker/distribution/reference"
Expand All @@ -24,6 +25,7 @@ import (

const (
DockerRegistryURL = "docker.io"
RestartTimeout = 30
)

var K8sDockerVersions = map[string][]string{
Expand Down Expand Up @@ -53,6 +55,14 @@ func DoRunContainer(ctx context.Context, dClient *client.Client, imageCfg *conta
}
// Check for upgrades
if container.State.Running {
// check if container is in a restarting loop
if container.State.Restarting {
logrus.Debugf("[%s] Container [%s] is in a restarting loop [%s]", plane, containerName, hostname)
restartTimeoutDuration := RestartTimeout * time.Second
if err := dClient.ContainerRestart(ctx, container.ID, &restartTimeoutDuration); err != nil {
return fmt.Errorf("Failed to start [%s] container on host [%s]: %v", containerName, hostname, err)
}
}
logrus.Debugf("[%s] Container [%s] is already running on host [%s]", plane, containerName, hostname)
isUpgradable, err := IsContainerUpgradable(ctx, dClient, imageCfg, containerName, hostname, plane)
if err != nil {
Expand Down

0 comments on commit a67b5e1

Please sign in to comment.