Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix handling of nil dontschedule strategy #78

Merged
merged 1 commit into from
Mar 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions .github/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,15 +307,6 @@ func getTASPolicy(name string, str string, metric string, operator string, targe
},
},
}
if str != dontschedule.StrategyType {
pol.Spec.Strategies[dontschedule.StrategyType] =
api.TASPolicyStrategy{
PolicyName: "filter1",
Rules: []api.TASPolicyRule{
{Metricname: "filter1_metric", Operator: "Equals", Target: 2000000},
},
}
}
return pol
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ import (
"net/http"
"strings"

v1 "k8s.io/api/core/v1"
"k8s.io/klog/v2"

"github.com/intel/platform-aware-scheduling/extender"
"github.com/intel/platform-aware-scheduling/telemetry-aware-scheduling/pkg/cache"
"github.com/intel/platform-aware-scheduling/telemetry-aware-scheduling/pkg/metrics"
"github.com/intel/platform-aware-scheduling/telemetry-aware-scheduling/pkg/strategies/core"
"github.com/intel/platform-aware-scheduling/telemetry-aware-scheduling/pkg/strategies/dontschedule"
"github.com/intel/platform-aware-scheduling/telemetry-aware-scheduling/pkg/strategies/scheduleonmetric"
telemetrypolicy "github.com/intel/platform-aware-scheduling/telemetry-aware-scheduling/pkg/telemetrypolicy/api/v1alpha1"
v1 "k8s.io/api/core/v1"
"k8s.io/klog/v2"
)

var tasPolicy = "telemetry-policy"
Expand Down Expand Up @@ -193,8 +194,10 @@ func (m MetricsExtender) filterNodes(args extender.Args) *extender.FilterResult
}
dontscheduleStrategy, err := m.getDontScheduleStrategy(policy)
if err != nil {
klog.V(2).InfoS("Don't scheduler strategy failed "+err.Error(), "component", "extender")
return nil
klog.V(4).InfoS("Returning all nodes "+err.Error(), "component", "extender")
return &extender.FilterResult{
Nodes: args.Nodes,
}
}
violatingNodes := dontscheduleStrategy.Violated(m.cache)
if len(args.Nodes.Items) == 0 {
Expand Down