Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getPodsForPdb on disruption.go makes unnecessary loop to copy #46433

Closed
yastij opened this issue May 25, 2017 · 2 comments · Fixed by #46590
Closed

getPodsForPdb on disruption.go makes unnecessary loop to copy #46433

yastij opened this issue May 25, 2017 · 2 comments · Fixed by #46590
Assignees
Labels
sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling.

Comments

@yastij
Copy link
Member

yastij commented May 25, 2017

Is this a request for help? (If yes, you should use our troubleshooting guide and community support channels, see http://kubernetes.io/docs/troubleshooting/.): No.

What keywords did you search in Kubernetes issues before filing this one? (If you have found any duplicates, you should instead reply there.):

DisruptionController
getPodsForPdb


Is this a BUG REPORT or FEATURE REQUEST? FEATURE REQUEST

in kubernetes/pkg/controller/disruption/disruption.go we have getPodsForPdb function return pods using policy.PodDisruptionBudget.
but at the end we perform a copy of the pod array that we listed with :

	result := make([]*v1.Pod, 0, len(pods))
	for i := range pods {
		result = append(result, &(*pods[i]))  //pods being the array returned from the listing
	}

this is not necessary cc @deads2k @wojtek-t

@yastij
Copy link
Member Author

yastij commented May 25, 2017

/assign

@yastij
Copy link
Member Author

yastij commented May 25, 2017

/kind enhancement

@yastij yastij changed the title getPodsForPdb makes unnecessary loop to copy getPodsForPdb on disruption.go makes unnecessary loop to copy May 25, 2017
@grodrigues3 grodrigues3 added the sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. label May 26, 2017
yastij added a commit to yastij/kubernetes that referenced this issue May 29, 2017
adding comments stating that returned pods should be used as read-only objects

fixing typo

avoiding unnecessary loop to copy pods listed see kubernetes#46433

fixing fmt

avoiding unnecessary loop to copy pods listed see kubernetes#46433
k8s-github-robot pushed a commit that referenced this issue May 30, 2017
Automatic merge from submit-queue

avoiding unnecessary loop to copy pods listed

**What this PR does / why we need it**: avoids unnecessary loop to copy pods listed

**Which issue this PR fixes** : fixes #46433 

**Release note**:

```release-note
```
/assign @wojtek-t
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants