Skip to content

Commit

Permalink
Merge pull request kubernetes#350 from brendandburns/async
Browse files Browse the repository at this point in the history
Fix an error in the async-path that led to dropping pods.
  • Loading branch information
brendandburns committed Jul 3, 2014
2 parents d386c02 + 0655370 commit bf44347
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions pkg/kubelet/kubelet.go
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,7 @@ func (kl *Kubelet) syncManifest(manifest *api.ContainerManifest, keepChannel cha
}
keepChannel <- netID
for _, container := range manifest.Containers {
glog.Infof("Syncing container: %v", container)
containerID, err := kl.getContainerID(manifest, &container)
if err != nil {
glog.Errorf("Error finding container: %v skipping manifest %s container %s.", err, manifest.ID, container.Name)
Expand Down Expand Up @@ -697,16 +698,18 @@ func (kl *Kubelet) SyncManifests(config []api.ContainerManifest) error {
waitGroup := sync.WaitGroup{}

// Check for any containers that need starting
for _, manifest := range config {
for ix := range config {
waitGroup.Add(1)
go func() {
go func(index int) {
defer util.HandleCrash()
defer waitGroup.Done()
err := kl.syncManifest(&manifest, keepChannel)
// necessary to dereference by index here b/c otherwise the shared value
// in the for each is re-used.
err := kl.syncManifest(&config[index], keepChannel)
if err != nil {
glog.Errorf("Error syncing manifest: %v skipping.", err)
}
}()
}(ix)
}
go func() {
for id := range keepChannel {
Expand Down

0 comments on commit bf44347

Please sign in to comment.