Skip to content

Commit

Permalink
Merge pull request kubernetes#18321 from janetkuo/fix-deployment-geto…
Browse files Browse the repository at this point in the history
…ldrcs

Fix bug when getting old RCs of a deployment
  • Loading branch information
nikhiljindal committed Dec 10, 2015
2 parents 9d1f07d + 524ec8b commit aaa1fe6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/util/deployment/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit aaa1fe6

Please sign in to comment.