mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-06 10:43:56 +00:00
Merge pull request #28715 from euank/kubelet-trim-dead-code
Automatic merge from submit-queue kubelete: delete a few bits of dead code Less is more.
This commit is contained in:
commit
5067af159e
@ -2174,19 +2174,6 @@ func (kl *Kubelet) isOutOfDisk() bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// matchesNodeSelector returns true if pod matches node's labels.
|
|
||||||
func (kl *Kubelet) matchesNodeSelector(pod *api.Pod) bool {
|
|
||||||
if kl.standaloneMode {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
node, err := kl.GetNode()
|
|
||||||
if err != nil {
|
|
||||||
glog.Errorf("error getting node: %v", err)
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return predicates.PodMatchesNodeLabels(pod, node)
|
|
||||||
}
|
|
||||||
|
|
||||||
// rejectPod records an event about the pod with the given reason and message,
|
// rejectPod records an event about the pod with the given reason and message,
|
||||||
// and updates the pod to the failed phase in the status manage.
|
// and updates the pod to the failed phase in the status manage.
|
||||||
func (kl *Kubelet) rejectPod(pod *api.Pod, reason, message string) {
|
func (kl *Kubelet) rejectPod(pod *api.Pod, reason, message string) {
|
||||||
|
@ -22,7 +22,6 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
|
||||||
"os"
|
"os"
|
||||||
"reflect"
|
"reflect"
|
||||||
goruntime "runtime"
|
goruntime "runtime"
|
||||||
@ -99,16 +98,6 @@ const (
|
|||||||
maxImgSize int64 = 1000 * 1024 * 1024
|
maxImgSize int64 = 1000 * 1024 * 1024
|
||||||
)
|
)
|
||||||
|
|
||||||
type fakeHTTP struct {
|
|
||||||
url string
|
|
||||||
err error
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *fakeHTTP) Get(url string) (*http.Response, error) {
|
|
||||||
f.url = url
|
|
||||||
return nil, f.err
|
|
||||||
}
|
|
||||||
|
|
||||||
type TestKubelet struct {
|
type TestKubelet struct {
|
||||||
kubelet *Kubelet
|
kubelet *Kubelet
|
||||||
fakeRuntime *containertest.FakeRuntime
|
fakeRuntime *containertest.FakeRuntime
|
||||||
|
@ -199,11 +199,6 @@ func (pm *basicManager) GetPodsAndMirrorPods() ([]*api.Pod, []*api.Pod) {
|
|||||||
return pods, mirrorPods
|
return pods, mirrorPods
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns all pods (including mirror pods).
|
|
||||||
func (pm *basicManager) getAllPods() []*api.Pod {
|
|
||||||
return append(podsMapToPods(pm.podByUID), podsMapToPods(pm.mirrorPodByUID)...)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (pm *basicManager) GetPodByUID(uid types.UID) (*api.Pod, bool) {
|
func (pm *basicManager) GetPodByUID(uid types.UID) (*api.Pod, bool) {
|
||||||
pm.lock.RLock()
|
pm.lock.RLock()
|
||||||
defer pm.lock.RUnlock()
|
defer pm.lock.RUnlock()
|
||||||
|
@ -533,7 +533,7 @@ func nodeMatchesNodeSelectorTerms(node *api.Node, nodeSelectorTerms []api.NodeSe
|
|||||||
}
|
}
|
||||||
|
|
||||||
// The pod can only schedule onto nodes that satisfy requirements in both NodeAffinity and nodeSelector.
|
// The pod can only schedule onto nodes that satisfy requirements in both NodeAffinity and nodeSelector.
|
||||||
func PodMatchesNodeLabels(pod *api.Pod, node *api.Node) bool {
|
func podMatchesNodeLabels(pod *api.Pod, node *api.Node) bool {
|
||||||
// Check if node.Labels match pod.Spec.NodeSelector.
|
// Check if node.Labels match pod.Spec.NodeSelector.
|
||||||
if len(pod.Spec.NodeSelector) > 0 {
|
if len(pod.Spec.NodeSelector) > 0 {
|
||||||
selector := labels.SelectorFromSet(pod.Spec.NodeSelector)
|
selector := labels.SelectorFromSet(pod.Spec.NodeSelector)
|
||||||
@ -590,7 +590,7 @@ func PodSelectorMatches(pod *api.Pod, meta interface{}, nodeInfo *schedulercache
|
|||||||
if node == nil {
|
if node == nil {
|
||||||
return false, fmt.Errorf("node not found")
|
return false, fmt.Errorf("node not found")
|
||||||
}
|
}
|
||||||
if PodMatchesNodeLabels(pod, node) {
|
if podMatchesNodeLabels(pod, node) {
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
return false, ErrNodeSelectorNotMatch
|
return false, ErrNodeSelectorNotMatch
|
||||||
|
Loading…
Reference in New Issue
Block a user