Skip to content

Commit

Permalink
Merge pull request #369 from damemi/duplicates-panic
Browse files Browse the repository at this point in the history
Add check for ownerref length in DuplicatePods strategy
  • Loading branch information
k8s-ci-robot authored Aug 10, 2020
2 parents cdcd677 + ec4c5be commit 19e1387
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/descheduler/strategies/duplicates.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func RemoveDuplicatePods(
duplicateKeysMap := map[string][][]string{}
for _, pod := range pods {
ownerRefList := podutil.OwnerRef(pod)
if hasExcludedOwnerRefKind(ownerRefList, strategy) {
if hasExcludedOwnerRefKind(ownerRefList, strategy) || len(ownerRefList) == 0 {
continue
}
podContainerKeys := make([]string, 0, len(ownerRefList)*len(pod.Spec.Containers))
Expand Down

0 comments on commit 19e1387

Please sign in to comment.