Skip to content

Commit 7a983a6

Browse files
committed
feat: implement decision-based routing with plugin architecture
Signed-off-by: bitliu <[email protected]>
1 parent cde2d2f commit 7a983a6

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/semantic-router/cmd/main.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ func main() {
5454
logging.Fatalf("Failed to load config: %v", err)
5555
}
5656

57+
// Set the initial configuration in the global config
58+
// This is important for Kubernetes mode where the controller will update it
59+
config.Replace(cfg)
60+
5761
// Initialize distributed tracing if enabled
5862
ctx := context.Background()
5963
if cfg.Observability.Tracing.Enabled {

src/semantic-router/pkg/extproc/server.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
"google.golang.org/grpc"
1919
"google.golang.org/grpc/credentials"
2020

21+
"github.com/vllm-project/semantic-router/src/semantic-router/pkg/config"
2122
"github.com/vllm-project/semantic-router/src/semantic-router/pkg/observability/logging"
2223
tlsutil "github.com/vllm-project/semantic-router/src/semantic-router/pkg/utils/tls"
2324
)
@@ -158,6 +159,15 @@ func (rs *RouterService) Process(stream ext_proc.ExternalProcessor_ProcessServer
158159

159160
// watchConfigAndReload watches the config file and reloads router on changes.
160161
func (s *Server) watchConfigAndReload(ctx context.Context) {
162+
// Check if we're using Kubernetes config source
163+
// If so, skip file watching as config is managed by the Kubernetes controller
164+
cfg := config.Get()
165+
if cfg != nil && cfg.ConfigSource == config.ConfigSourceKubernetes {
166+
logging.Infof("ConfigSource is kubernetes, skipping file watcher")
167+
<-ctx.Done() // Just wait for context cancellation
168+
return
169+
}
170+
161171
watcher, err := fsnotify.NewWatcher()
162172
if err != nil {
163173
logging.LogEvent("config_watcher_error", map[string]interface{}{

0 commit comments

Comments
 (0)