Skip to content
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
27 changes: 17 additions & 10 deletions cmd/bbr/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"context"
"flag"
"fmt"
"os"

uberzap "go.uber.org/zap"
"go.uber.org/zap/zapcore"
Expand Down Expand Up @@ -106,18 +107,24 @@ func (r *Runner) Run(ctx context.Context) error {
}
// label "inference-gateway.k8s.io/managed" = "true" is used for server-side filtering of configmaps.
// only the configmap objects with this label will be tracked by bbr.
mgr, err := ctrl.NewManager(cfg, ctrl.Options{
Cache: cache.Options{
ByObject: map[client.Object]cache.ByObject{
&corev1.ConfigMap{}: {
Label: labels.SelectorFromSet(labels.Set{
"inference-gateway.k8s.io/managed": "true",
}),
},
cacheOptions := cache.Options{
ByObject: map[client.Object]cache.ByObject{
&corev1.ConfigMap{}: {
Label: labels.SelectorFromSet(labels.Set{
"inference-gateway.k8s.io/managed": "true",
}),
},
},
Metrics: metricsServerOptions,
})
}
// Apply namespace filtering only if env var is set
namespace := os.Getenv("NAMESPACE")
if namespace != "" {
cacheOptions.DefaultNamespaces = map[string]cache.Config{
namespace: {},
}
}

mgr, err := ctrl.NewManager(cfg, ctrl.Options{Cache: cacheOptions, Metrics: metricsServerOptions})
if err != nil {
setupLog.Error(err, "Failed to create manager", "config", cfg)
return err
Expand Down
7 changes: 7 additions & 0 deletions config/charts/body-based-routing/templates/bbr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ spec:
- --{{ $key }}
- "{{ $value }}"
{{- end }}
{{- if not .Values.bbr.multiNamespace }}
env:
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
{{- end }}
ports:
- containerPort: {{ .Values.bbr.port }}
# health check
Expand Down