Commit aaa1fe67 authored by Nikhil Jindal's avatar Nikhil Jindal

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

Fix bug when getting old RCs of a deployment
parents 9d1f07da 524ec8b4
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment