Skip to content

Commit 27c8b3c

Browse files
committed
tidy code
Signed-off-by: Kuromesi <[email protected]>
1 parent fbc29de commit 27c8b3c

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

Diff for: pkg/ext-proc/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ func main() {
151151
klog.Error(err, "Error setting up EndpointSliceReconciler")
152152
}
153153

154-
orchestrator := &scheduling.FilterOrchestratorImpl{}
154+
var orchestrator scheduling.FilterOrchestrator
155155
if *enableFilterConfiguration {
156156
if err := (&backend.FilterConfigReconciler{
157157
Datastore: datastore,

Diff for: pkg/ext-proc/scheduling/orchestrate.go

+15
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,21 @@ func NewFilterOrchestrator(datastore *backend.K8sDatastore) *FilterOrchestratorI
1919
}
2020
}
2121

22+
func NewDefaultFilterOrchestrator() *DefaultFilterOrchestrator {
23+
return &DefaultFilterOrchestrator{}
24+
}
25+
26+
// DefaultFilterOrchestrator is a filter orchestrator that returns the default filter chain
27+
type DefaultFilterOrchestrator struct{}
28+
29+
var _ FilterOrchestrator = &DefaultFilterOrchestrator{}
30+
31+
func (DefaultFilterOrchestrator) Orchestrate() FilterChain {
32+
return defaultFilter
33+
}
34+
35+
// FilterOrchestratorImpl is a filter orchestrator that reads the filter configuration
36+
// from configmap and orchestrate the filter chain
2237
type FilterOrchestratorImpl struct {
2338
datastore *backend.K8sDatastore
2439
lastUpdated string

Diff for: pkg/ext-proc/scheduling/scheduler.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ func NewScheduler(pmp PodMetricsProvider, opts ...SchedulerOption) *Scheduler {
9494
s := &Scheduler{
9595
podMetricsProvider: pmp,
9696
filter: defaultFilter,
97-
filterOrchestrator: &FilterOrchestratorImpl{},
97+
filterOrchestrator: NewDefaultFilterOrchestrator(),
9898
}
9999

100100
for _, opt := range opts {
@@ -105,7 +105,9 @@ func NewScheduler(pmp PodMetricsProvider, opts ...SchedulerOption) *Scheduler {
105105

106106
func WithOrchestrator(orchestrator FilterOrchestrator) SchedulerOption {
107107
return func(s *Scheduler) {
108-
s.filterOrchestrator = orchestrator
108+
if orchestrator != nil {
109+
s.filterOrchestrator = orchestrator
110+
}
109111
}
110112
}
111113

0 commit comments

Comments
 (0)