@@ -32,54 +32,54 @@ var (
32
32
// failure error in nodesWherePreemptionMightHelp() in scheduler/core/generic_scheduler.go
33
33
34
34
// ErrDiskConflict is used for NoDiskConflict predicate error.
35
- ErrDiskConflict = newPredicateFailureError ("NoDiskConflict" , "node(s) had no available disk" )
35
+ ErrDiskConflict = NewPredicateFailureError ("NoDiskConflict" , "node(s) had no available disk" )
36
36
// ErrVolumeZoneConflict is used for NoVolumeZoneConflict predicate error.
37
- ErrVolumeZoneConflict = newPredicateFailureError ("NoVolumeZoneConflict" , "node(s) had no available volume zone" )
37
+ ErrVolumeZoneConflict = NewPredicateFailureError ("NoVolumeZoneConflict" , "node(s) had no available volume zone" )
38
38
// ErrNodeSelectorNotMatch is used for MatchNodeSelector predicate error.
39
- ErrNodeSelectorNotMatch = newPredicateFailureError ("MatchNodeSelector" , "node(s) didn't match node selector" )
39
+ ErrNodeSelectorNotMatch = NewPredicateFailureError ("MatchNodeSelector" , "node(s) didn't match node selector" )
40
40
// ErrPodAffinityNotMatch is used for MatchInterPodAffinity predicate error.
41
- ErrPodAffinityNotMatch = newPredicateFailureError ("MatchInterPodAffinity" , "node(s) didn't match pod affinity/anti-affinity" )
41
+ ErrPodAffinityNotMatch = NewPredicateFailureError ("MatchInterPodAffinity" , "node(s) didn't match pod affinity/anti-affinity" )
42
42
// ErrPodAffinityRulesNotMatch is used for PodAffinityRulesNotMatch predicate error.
43
- ErrPodAffinityRulesNotMatch = newPredicateFailureError ("PodAffinityRulesNotMatch" , "node(s) didn't match pod affinity rules" )
43
+ ErrPodAffinityRulesNotMatch = NewPredicateFailureError ("PodAffinityRulesNotMatch" , "node(s) didn't match pod affinity rules" )
44
44
// ErrPodAntiAffinityRulesNotMatch is used for PodAntiAffinityRulesNotMatch predicate error.
45
- ErrPodAntiAffinityRulesNotMatch = newPredicateFailureError ("PodAntiAffinityRulesNotMatch" , "node(s) didn't match pod anti-affinity rules" )
45
+ ErrPodAntiAffinityRulesNotMatch = NewPredicateFailureError ("PodAntiAffinityRulesNotMatch" , "node(s) didn't match pod anti-affinity rules" )
46
46
// ErrExistingPodsAntiAffinityRulesNotMatch is used for ExistingPodsAntiAffinityRulesNotMatch predicate error.
47
- ErrExistingPodsAntiAffinityRulesNotMatch = newPredicateFailureError ("ExistingPodsAntiAffinityRulesNotMatch" , "node(s) didn't satisfy existing pods anti-affinity rules" )
47
+ ErrExistingPodsAntiAffinityRulesNotMatch = NewPredicateFailureError ("ExistingPodsAntiAffinityRulesNotMatch" , "node(s) didn't satisfy existing pods anti-affinity rules" )
48
48
// ErrTaintsTolerationsNotMatch is used for PodToleratesNodeTaints predicate error.
49
- ErrTaintsTolerationsNotMatch = newPredicateFailureError ("PodToleratesNodeTaints" , "node(s) had taints that the pod didn't tolerate" )
49
+ ErrTaintsTolerationsNotMatch = NewPredicateFailureError ("PodToleratesNodeTaints" , "node(s) had taints that the pod didn't tolerate" )
50
50
// ErrPodNotMatchHostName is used for HostName predicate error.
51
- ErrPodNotMatchHostName = newPredicateFailureError ("HostName" , "node(s) didn't match the requested hostname" )
51
+ ErrPodNotMatchHostName = NewPredicateFailureError ("HostName" , "node(s) didn't match the requested hostname" )
52
52
// ErrPodNotFitsHostPorts is used for PodFitsHostPorts predicate error.
53
- ErrPodNotFitsHostPorts = newPredicateFailureError ("PodFitsHostPorts" , "node(s) didn't have free ports for the requested pod ports" )
53
+ ErrPodNotFitsHostPorts = NewPredicateFailureError ("PodFitsHostPorts" , "node(s) didn't have free ports for the requested pod ports" )
54
54
// ErrNodeLabelPresenceViolated is used for CheckNodeLabelPresence predicate error.
55
- ErrNodeLabelPresenceViolated = newPredicateFailureError ("CheckNodeLabelPresence" , "node(s) didn't have the requested labels" )
55
+ ErrNodeLabelPresenceViolated = NewPredicateFailureError ("CheckNodeLabelPresence" , "node(s) didn't have the requested labels" )
56
56
// ErrServiceAffinityViolated is used for CheckServiceAffinity predicate error.
57
- ErrServiceAffinityViolated = newPredicateFailureError ("CheckServiceAffinity" , "node(s) didn't match service affinity" )
57
+ ErrServiceAffinityViolated = NewPredicateFailureError ("CheckServiceAffinity" , "node(s) didn't match service affinity" )
58
58
// ErrMaxVolumeCountExceeded is used for MaxVolumeCount predicate error.
59
- ErrMaxVolumeCountExceeded = newPredicateFailureError ("MaxVolumeCount" , "node(s) exceed max volume count" )
59
+ ErrMaxVolumeCountExceeded = NewPredicateFailureError ("MaxVolumeCount" , "node(s) exceed max volume count" )
60
60
// ErrNodeUnderMemoryPressure is used for NodeUnderMemoryPressure predicate error.
61
- ErrNodeUnderMemoryPressure = newPredicateFailureError ("NodeUnderMemoryPressure" , "node(s) had memory pressure" )
61
+ ErrNodeUnderMemoryPressure = NewPredicateFailureError ("NodeUnderMemoryPressure" , "node(s) had memory pressure" )
62
62
// ErrNodeUnderDiskPressure is used for NodeUnderDiskPressure predicate error.
63
- ErrNodeUnderDiskPressure = newPredicateFailureError ("NodeUnderDiskPressure" , "node(s) had disk pressure" )
63
+ ErrNodeUnderDiskPressure = NewPredicateFailureError ("NodeUnderDiskPressure" , "node(s) had disk pressure" )
64
64
// ErrNodeUnderPIDPressure is used for NodeUnderPIDPressure predicate error.
65
- ErrNodeUnderPIDPressure = newPredicateFailureError ("NodeUnderPIDPressure" , "node(s) had pid pressure" )
65
+ ErrNodeUnderPIDPressure = NewPredicateFailureError ("NodeUnderPIDPressure" , "node(s) had pid pressure" )
66
66
// ErrNodeNotReady is used for NodeNotReady predicate error.
67
- ErrNodeNotReady = newPredicateFailureError ("NodeNotReady" , "node(s) were not ready" )
67
+ ErrNodeNotReady = NewPredicateFailureError ("NodeNotReady" , "node(s) were not ready" )
68
68
// ErrNodeNetworkUnavailable is used for NodeNetworkUnavailable predicate error.
69
- ErrNodeNetworkUnavailable = newPredicateFailureError ("NodeNetworkUnavailable" , "node(s) had unavailable network" )
69
+ ErrNodeNetworkUnavailable = NewPredicateFailureError ("NodeNetworkUnavailable" , "node(s) had unavailable network" )
70
70
// ErrNodeUnschedulable is used for NodeUnschedulable predicate error.
71
- ErrNodeUnschedulable = newPredicateFailureError ("NodeUnschedulable" , "node(s) were unschedulable" )
71
+ ErrNodeUnschedulable = NewPredicateFailureError ("NodeUnschedulable" , "node(s) were unschedulable" )
72
72
// ErrNodeUnknownCondition is used for NodeUnknownCondition predicate error.
73
- ErrNodeUnknownCondition = newPredicateFailureError ("NodeUnknownCondition" , "node(s) had unknown conditions" )
73
+ ErrNodeUnknownCondition = NewPredicateFailureError ("NodeUnknownCondition" , "node(s) had unknown conditions" )
74
74
// ErrVolumeNodeConflict is used for VolumeNodeAffinityConflict predicate error.
75
- ErrVolumeNodeConflict = newPredicateFailureError ("VolumeNodeAffinityConflict" , "node(s) had volume node affinity conflict" )
75
+ ErrVolumeNodeConflict = NewPredicateFailureError ("VolumeNodeAffinityConflict" , "node(s) had volume node affinity conflict" )
76
76
// ErrVolumeBindConflict is used for VolumeBindingNoMatch predicate error.
77
- ErrVolumeBindConflict = newPredicateFailureError ("VolumeBindingNoMatch" , "node(s) didn't find available persistent volumes to bind" )
77
+ ErrVolumeBindConflict = NewPredicateFailureError ("VolumeBindingNoMatch" , "node(s) didn't find available persistent volumes to bind" )
78
78
// ErrTopologySpreadConstraintsNotMatch is used for EvenPodsSpread predicate error.
79
- ErrTopologySpreadConstraintsNotMatch = newPredicateFailureError ("EvenPodsSpreadNotMatch" , "node(s) didn't match pod topology spread constraints" )
79
+ ErrTopologySpreadConstraintsNotMatch = NewPredicateFailureError ("EvenPodsSpreadNotMatch" , "node(s) didn't match pod topology spread constraints" )
80
80
// ErrFakePredicate is used for test only. The fake predicates returning false also returns error
81
81
// as ErrFakePredicate.
82
- ErrFakePredicate = newPredicateFailureError ("FakePredicateError" , "Nodes failed the fake predicate" )
82
+ ErrFakePredicate = NewPredicateFailureError ("FakePredicateError" , "Nodes failed the fake predicate" )
83
83
)
84
84
85
85
var unresolvablePredicateFailureErrors = map [PredicateFailureReason ]struct {}{
@@ -154,7 +154,8 @@ type PredicateFailureError struct {
154
154
PredicateDesc string
155
155
}
156
156
157
- func newPredicateFailureError (predicateName , predicateDesc string ) * PredicateFailureError {
157
+ // NewPredicateFailureError creates a PredicateFailureError with message.
158
+ func NewPredicateFailureError (predicateName , predicateDesc string ) * PredicateFailureError {
158
159
return & PredicateFailureError {PredicateName : predicateName , PredicateDesc : predicateDesc }
159
160
}
160
161
@@ -171,18 +172,3 @@ func (e *PredicateFailureError) GetReason() string {
171
172
type PredicateFailureReason interface {
172
173
GetReason () string
173
174
}
174
-
175
- // FailureReason describes a failure reason.
176
- type FailureReason struct {
177
- reason string
178
- }
179
-
180
- // NewFailureReason creates a FailureReason with message.
181
- func NewFailureReason (msg string ) * FailureReason {
182
- return & FailureReason {reason : msg }
183
- }
184
-
185
- // GetReason returns the reason of the FailureReason.
186
- func (e * FailureReason ) GetReason () string {
187
- return e .reason
188
- }
0 commit comments