mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 18:00:08 +00:00
Remove namespace controller pod precedence
This commit is contained in:
parent
a8ebc131de
commit
4d1d98c49a
@ -18,7 +18,6 @@ package namespace
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"sort"
|
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -350,9 +349,6 @@ func deleteAllContent(
|
|||||||
) (int64, error) {
|
) (int64, error) {
|
||||||
estimate := int64(0)
|
estimate := int64(0)
|
||||||
glog.V(4).Infof("namespace controller - deleteAllContent - namespace: %s, gvrs: %v", namespace, groupVersionResources)
|
glog.V(4).Infof("namespace controller - deleteAllContent - namespace: %s, gvrs: %v", namespace, groupVersionResources)
|
||||||
// iterate over each group version, and attempt to delete all of its resources
|
|
||||||
// we sort resources to delete in a priority order that deletes pods LAST
|
|
||||||
sort.Sort(sortableGroupVersionResources(groupVersionResources))
|
|
||||||
for _, gvr := range groupVersionResources {
|
for _, gvr := range groupVersionResources {
|
||||||
gvrEstimate, err := deleteAllContentForGroupVersionResource(kubeClient, clientPool, opCache, gvr, namespace, namespaceDeletedAt)
|
gvrEstimate, err := deleteAllContentForGroupVersionResource(kubeClient, clientPool, opCache, gvr, namespace, namespaceDeletedAt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -502,20 +498,3 @@ func estimateGracefulTerminationForPods(kubeClient clientset.Interface, ns strin
|
|||||||
}
|
}
|
||||||
return estimate, nil
|
return estimate, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// sortableGroupVersionResources sorts the input set of resources for deletion, and orders pods to always be last.
|
|
||||||
// the idea is that the namespace controller will delete all things that spawn pods first in order to reduce the time
|
|
||||||
// those controllers spend creating pods only to be told NO in admission and potentially overwhelming cluster especially if they lack rate limiting.
|
|
||||||
type sortableGroupVersionResources []schema.GroupVersionResource
|
|
||||||
|
|
||||||
func (list sortableGroupVersionResources) Len() int {
|
|
||||||
return len(list)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (list sortableGroupVersionResources) Swap(i, j int) {
|
|
||||||
list[i], list[j] = list[j], list[i]
|
|
||||||
}
|
|
||||||
|
|
||||||
func (list sortableGroupVersionResources) Less(i, j int) bool {
|
|
||||||
return list[j].Group == "" && list[j].Resource == "pods"
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user