Merge pull request #18321 from janetkuo/fix-deployment-getoldrcs

Fix bug when getting old RCs of a deployment
pull/6/head
Nikhil Jindal 2015-12-10 14:22:56 -08:00
commit aaa1fe67f6
1 changed files with 5 additions and 1 deletions

View File

@ -61,7 +61,11 @@ func GetOldRCs(deployment extensions.Deployment, c client.Interface) ([]*api.Rep
}
}
requiredRCs := []*api.ReplicationController{}
for _, value := range oldRCs {
// Note that go reuses the same memory location for every iteration,
// which means the 'value' returned from range will have the same address.
// Therefore, we should use the returned 'index' instead.
for i := range oldRCs {
value := oldRCs[i]
requiredRCs = append(requiredRCs, &value)
}
return requiredRCs, nil