Skip to content

Commit

Permalink
Merge pull request #18321 from janetkuo/fix-deployment-getoldrcs
Browse files Browse the repository at this point in the history
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

1 comment on commit aaa1fe6

@k8s-teamcity-mesosphere

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TeamCity OSS :: Kubernetes Mesos :: 4 - Smoke Tests Build 9036 outcome was SUCCESS
Summary: Tests passed: 1, ignored: 205 Build time: 00:04:04

Please sign in to comment.