Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
231e372d
Unverified
Commit
231e372d
authored
Mar 25, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Mar 25, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #75620 from misterikkit/logcleanup
Scheduler: Logging cleanup in predicates.go.
parents
ec64aef2
1b447e8d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
11 deletions
+14
-11
predicates.go
pkg/scheduler/algorithm/predicates/predicates.go
+14
-11
No files found.
pkg/scheduler/algorithm/predicates/predicates.go
View file @
231e372d
...
@@ -978,16 +978,18 @@ func (s *ServiceAffinity) serviceAffinityMetadataProducer(pm *predicateMetadata)
...
@@ -978,16 +978,18 @@ func (s *ServiceAffinity) serviceAffinityMetadataProducer(pm *predicateMetadata)
return
return
}
}
pm
.
serviceAffinityInUse
=
true
pm
.
serviceAffinityInUse
=
true
var
err
Svc
,
errList
error
var
err
error
// Store services which match the pod.
// Store services which match the pod.
pm
.
serviceAffinityMatchingPodServices
,
errSvc
=
s
.
serviceLister
.
GetPodServices
(
pm
.
pod
)
pm
.
serviceAffinityMatchingPodServices
,
err
=
s
.
serviceLister
.
GetPodServices
(
pm
.
pod
)
if
err
!=
nil
{
klog
.
Errorf
(
"Error precomputing service affinity: could not list services: %v"
,
err
)
}
selector
:=
CreateSelectorFromLabels
(
pm
.
pod
.
Labels
)
selector
:=
CreateSelectorFromLabels
(
pm
.
pod
.
Labels
)
allMatches
,
errList
:=
s
.
podLister
.
List
(
selector
)
allMatches
,
err
:=
s
.
podLister
.
List
(
selector
)
if
err
!=
nil
{
// In the future maybe we will return them as part of the function.
klog
.
Errorf
(
"Error precomputing service affinity: could not list pods: %v"
,
err
)
if
errSvc
!=
nil
||
errList
!=
nil
{
klog
.
Errorf
(
"Some Error were found while precomputing svc affinity:
\n
services:%v ,
\n
pods:%v"
,
errSvc
,
errList
)
}
}
// consider only the pods that belong to the same namespace
// consider only the pods that belong to the same namespace
pm
.
serviceAffinityMatchingPodList
=
FilterPodsByNamespace
(
allMatches
,
pm
.
pod
.
Namespace
)
pm
.
serviceAffinityMatchingPodList
=
FilterPodsByNamespace
(
allMatches
,
pm
.
pod
.
Namespace
)
}
}
...
@@ -1315,7 +1317,8 @@ func (c *PodAffinityChecker) getMatchingAntiAffinityTopologyPairsOfPods(pod *v1.
...
@@ -1315,7 +1317,8 @@ func (c *PodAffinityChecker) getMatchingAntiAffinityTopologyPairsOfPods(pod *v1.
existingPodNode
,
err
:=
c
.
info
.
GetNodeInfo
(
existingPod
.
Spec
.
NodeName
)
existingPodNode
,
err
:=
c
.
info
.
GetNodeInfo
(
existingPod
.
Spec
.
NodeName
)
if
err
!=
nil
{
if
err
!=
nil
{
if
apierrors
.
IsNotFound
(
err
)
{
if
apierrors
.
IsNotFound
(
err
)
{
klog
.
Errorf
(
"Node not found, %v"
,
existingPod
.
Spec
.
NodeName
)
klog
.
Errorf
(
"Pod %s has NodeName %q but node is not found"
,
podName
(
existingPod
),
existingPod
.
Spec
.
NodeName
)
continue
continue
}
}
return
nil
,
err
return
nil
,
err
...
@@ -1344,12 +1347,12 @@ func (c *PodAffinityChecker) satisfiesExistingPodsAntiAffinity(pod *v1.Pod, meta
...
@@ -1344,12 +1347,12 @@ func (c *PodAffinityChecker) satisfiesExistingPodsAntiAffinity(pod *v1.Pod, meta
// present in nodeInfo. Pods on other nodes pass the filter.
// present in nodeInfo. Pods on other nodes pass the filter.
filteredPods
,
err
:=
c
.
podLister
.
FilteredList
(
nodeInfo
.
Filter
,
labels
.
Everything
())
filteredPods
,
err
:=
c
.
podLister
.
FilteredList
(
nodeInfo
.
Filter
,
labels
.
Everything
())
if
err
!=
nil
{
if
err
!=
nil
{
errMessage
:=
fmt
.
Sprintf
(
"Failed to get all pods
, %+
v"
,
err
)
errMessage
:=
fmt
.
Sprintf
(
"Failed to get all pods
: %
v"
,
err
)
klog
.
Error
(
errMessage
)
klog
.
Error
(
errMessage
)
return
ErrExistingPodsAntiAffinityRulesNotMatch
,
errors
.
New
(
errMessage
)
return
ErrExistingPodsAntiAffinityRulesNotMatch
,
errors
.
New
(
errMessage
)
}
}
if
topologyMaps
,
err
=
c
.
getMatchingAntiAffinityTopologyPairsOfPods
(
pod
,
filteredPods
);
err
!=
nil
{
if
topologyMaps
,
err
=
c
.
getMatchingAntiAffinityTopologyPairsOfPods
(
pod
,
filteredPods
);
err
!=
nil
{
errMessage
:=
fmt
.
Sprintf
(
"Failed to get all terms that
pod %+v matches, err: %+
v"
,
podName
(
pod
),
err
)
errMessage
:=
fmt
.
Sprintf
(
"Failed to get all terms that
match pod %s: %
v"
,
podName
(
pod
),
err
)
klog
.
Error
(
errMessage
)
klog
.
Error
(
errMessage
)
return
ErrExistingPodsAntiAffinityRulesNotMatch
,
errors
.
New
(
errMessage
)
return
ErrExistingPodsAntiAffinityRulesNotMatch
,
errors
.
New
(
errMessage
)
}
}
...
@@ -1454,7 +1457,7 @@ func (c *PodAffinityChecker) satisfiesPodsAffinityAntiAffinity(pod *v1.Pod,
...
@@ -1454,7 +1457,7 @@ func (c *PodAffinityChecker) satisfiesPodsAffinityAntiAffinity(pod *v1.Pod,
if
!
matchFound
&&
len
(
affinityTerms
)
>
0
{
if
!
matchFound
&&
len
(
affinityTerms
)
>
0
{
affTermsMatch
,
termsSelectorMatch
,
err
:=
c
.
podMatchesPodAffinityTerms
(
pod
,
targetPod
,
nodeInfo
,
affinityTerms
)
affTermsMatch
,
termsSelectorMatch
,
err
:=
c
.
podMatchesPodAffinityTerms
(
pod
,
targetPod
,
nodeInfo
,
affinityTerms
)
if
err
!=
nil
{
if
err
!=
nil
{
errMessage
:=
fmt
.
Sprintf
(
"Cannot schedule pod %
+v onto node %v, because of PodAffinity, err
: %v"
,
podName
(
pod
),
node
.
Name
,
err
)
errMessage
:=
fmt
.
Sprintf
(
"Cannot schedule pod %
s onto node %s, because of PodAffinity
: %v"
,
podName
(
pod
),
node
.
Name
,
err
)
klog
.
Error
(
errMessage
)
klog
.
Error
(
errMessage
)
return
ErrPodAffinityRulesNotMatch
,
errors
.
New
(
errMessage
)
return
ErrPodAffinityRulesNotMatch
,
errors
.
New
(
errMessage
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment