Skip to content

Commit aa4989e

Browse files
authored
moved the creation of the context to main.go. (#995)
this is useful when writing a different main like llm-d, allowing to propogate the same context to the whole system. Signed-off-by: Nir Rozenbaum <[email protected]>
1 parent ea5f667 commit aa4989e

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

cmd/epp/main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@ package main
1919
import (
2020
"os"
2121

22+
ctrl "sigs.k8s.io/controller-runtime"
23+
2224
"sigs.k8s.io/gateway-api-inference-extension/cmd/epp/runner"
2325
)
2426

2527
func main() {
26-
if err := runner.NewRunner().Run(); err != nil {
28+
if err := runner.NewRunner().Run(ctrl.SetupSignalHandler()); err != nil {
2729
os.Exit(1)
2830
}
2931
}

cmd/epp/runner/runner.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
package runner
1818

1919
import (
20+
"context"
2021
"flag"
2122
"fmt"
2223

@@ -139,7 +140,7 @@ func (r *Runner) WithSchedulerConfig(schedulerConfig *scheduling.SchedulerConfig
139140
return r
140141
}
141142

142-
func (r *Runner) Run() error {
143+
func (r *Runner) Run(ctx context.Context) error {
143144
opts := zap.Options{
144145
Development: true,
145146
}
@@ -182,7 +183,7 @@ func (r *Runner) Run() error {
182183
}
183184
verifyMetricMapping(*mapping, setupLog)
184185
pmf := backendmetrics.NewPodMetricsFactory(&backendmetrics.PodMetricsClientImpl{MetricMapping: mapping}, *refreshMetricsInterval)
185-
ctx := ctrl.SetupSignalHandler()
186+
186187
datastore := datastore.NewDatastore(ctx, pmf)
187188

188189
// --- Setup Metrics Server ---

0 commit comments

Comments
 (0)