mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 22:17:14 +00:00
Fix an error in the async-path that led to dropping pods.
This commit is contained in:
parent
1fc71893cf
commit
0655370ea2
@ -661,6 +661,7 @@ func (kl *Kubelet) syncManifest(manifest *api.ContainerManifest, keepChannel cha
|
|||||||
}
|
}
|
||||||
keepChannel <- netID
|
keepChannel <- netID
|
||||||
for _, container := range manifest.Containers {
|
for _, container := range manifest.Containers {
|
||||||
|
glog.Infof("Syncing container: %v", container)
|
||||||
containerID, err := kl.getContainerID(manifest, &container)
|
containerID, err := kl.getContainerID(manifest, &container)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("Error finding container: %v skipping manifest %s container %s.", err, manifest.ID, container.Name)
|
glog.Errorf("Error finding container: %v skipping manifest %s container %s.", err, manifest.ID, container.Name)
|
||||||
@ -696,16 +697,18 @@ func (kl *Kubelet) SyncManifests(config []api.ContainerManifest) error {
|
|||||||
waitGroup := sync.WaitGroup{}
|
waitGroup := sync.WaitGroup{}
|
||||||
|
|
||||||
// Check for any containers that need starting
|
// Check for any containers that need starting
|
||||||
for _, manifest := range config {
|
for ix := range config {
|
||||||
waitGroup.Add(1)
|
waitGroup.Add(1)
|
||||||
go func() {
|
go func(index int) {
|
||||||
defer util.HandleCrash()
|
defer util.HandleCrash()
|
||||||
defer waitGroup.Done()
|
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 {
|
if err != nil {
|
||||||
glog.Errorf("Error syncing manifest: %v skipping.", err)
|
glog.Errorf("Error syncing manifest: %v skipping.", err)
|
||||||
}
|
}
|
||||||
}()
|
}(ix)
|
||||||
}
|
}
|
||||||
go func() {
|
go func() {
|
||||||
for id := range keepChannel {
|
for id := range keepChannel {
|
||||||
|
Loading…
Reference in New Issue
Block a user