Skip to content

Commit

Permalink
Merge pull request #9 from silentred/main
Browse files Browse the repository at this point in the history
add reasons to built-in filters
  • Loading branch information
silentred authored Dec 12, 2023
2 parents 0d98a05 + 63a7e6d commit 847dec1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/controller/manager/scheduler/filter/affinity.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ func AffinityFilterFunc(ctx *FilterContext, n *state.Node, vol *v1.AntstorVolume
match, err := schedcore.MatchNodeSelectorTerms(convertNodeInfo(n.Info), vol.Spec.NodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution)
if !match || err != nil {
klog.Infof("[SchedFail] vol=%s Pool %s NodeAffnity fail", vol.Name, n.Pool.Name)
ctx.Error.AddReason(ReasonNodeAffinity)
return false
}
}
Expand All @@ -31,6 +32,7 @@ func AffinityFilterFunc(ctx *FilterContext, n *state.Node, vol *v1.AntstorVolume
matched := selector.Matches(labels.Set(n.Info.Labels))
if !matched {
klog.Infof("[SchedFail] vol=%s Pool %s NodeLabelSelector fail", vol.Name, n.Pool.Name)
ctx.Error.AddReason(ReasonNodeAffinity)
return false
}
}
Expand All @@ -41,6 +43,7 @@ func AffinityFilterFunc(ctx *FilterContext, n *state.Node, vol *v1.AntstorVolume
match, err := schedcore.MatchNodeSelectorTerms(convertPoolLabels(n.Pool.Labels), vol.Spec.PoolAffinity.RequiredDuringSchedulingIgnoredDuringExecution)
if !match || err != nil {
klog.Infof("[SchedFail] vol=%s Pool %s PoolAffinity fail", vol.Name, n.Pool.Name)
ctx.Error.AddReason(ReasonPoolAffinity)
return false
}
}
Expand All @@ -52,6 +55,7 @@ func AffinityFilterFunc(ctx *FilterContext, n *state.Node, vol *v1.AntstorVolume
matched := selector.Matches(labels.Set(n.Pool.Labels))
if !matched {
klog.Infof("[SchedFail] vol=%s Pool %s PoolLabelSelector fail", vol.Name, n.Pool.Name)
ctx.Error.AddReason(ReasonPoolAffinity)
return false
}
}
Expand Down
1 change: 1 addition & 0 deletions pkg/controller/manager/scheduler/filter/basic.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ func BasicFilterFunc(ctx *FilterContext, n *state.Node, vol *v1.AntstorVolume) b
// consider Pool status
if !n.Pool.IsSchedulable() {
klog.Infof("[SchedFail] vol=%s Pool %s status is %s, or check Pool labels", vol.Name, n.Pool.Name, n.Pool.Status.Status)
ctx.Error.AddReason(ReasonPoolUnschedulable)
return false
}

Expand Down
3 changes: 3 additions & 0 deletions pkg/controller/manager/scheduler/filter/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ const (
ReasonPositionNotMatch = "PositionNotMatch"
ReasonVolTypeNotMatch = "VolTypeNotMatch"
ReasonDataConflict = "DataConflict"
ReasonNodeAffinity = "NodeAffinity"
ReasonPoolAffinity = "PoolAffinity"
ReasonPoolUnschedulable = "PoolUnschedulable"

NoStoragePoolAvailable = "NoStoragePoolAvailable"
//
Expand Down

0 comments on commit 847dec1

Please sign in to comment.