|
80 | 80 | enablePprof = flag.Bool("enable-pprof", runserver.DefaultEnablePprof, "Enables pprof handlers. Defaults to true. Set to false to disable pprof handlers.") |
81 | 81 | poolName = flag.String("pool-name", runserver.DefaultPoolName, "Name of the InferencePool this Endpoint Picker is associated with.") |
82 | 82 | poolGroup = flag.String("pool-group", runserver.DefaultPoolGroup, "group of the InferencePool this Endpoint Picker is associated with.") |
83 | | - poolNamespace = flag.String("pool-namespace", runserver.DefaultPoolNamespace, "Namespace of the InferencePool this Endpoint Picker is associated with.") |
| 83 | + poolNamespace = flag.String("pool-namespace", "", "Namespace of the InferencePool this Endpoint Picker is associated with.") |
84 | 84 | logVerbosity = flag.Int("v", logging.DEFAULT, "number for the log level verbosity") |
85 | 85 | secureServing = flag.Bool("secure-serving", runserver.DefaultSecureServing, "Enables secure serving. Defaults to true.") |
86 | 86 | healthChecking = flag.Bool("health-checking", runserver.DefaultHealthChecking, "Enables health checking") |
@@ -188,9 +188,20 @@ func (r *Runner) Run(ctx context.Context) error { |
188 | 188 | FilterProvider: filters.WithAuthenticationAndAuthorization, |
189 | 189 | } |
190 | 190 |
|
| 191 | + // Determine pool namespace: if --pool-namespace is non-empty, use it; else NAMESPACE env var; else default |
| 192 | + resolvePoolNamespace := func() string { |
| 193 | + if *poolNamespace != "" { |
| 194 | + return *poolNamespace |
| 195 | + } |
| 196 | + if nsEnv := os.Getenv("NAMESPACE"); nsEnv != "" { |
| 197 | + return nsEnv |
| 198 | + } |
| 199 | + return runserver.DefaultPoolNamespace |
| 200 | + } |
| 201 | + resolvedPoolNamespace := resolvePoolNamespace() |
191 | 202 | poolNamespacedName := types.NamespacedName{ |
192 | 203 | Name: *poolName, |
193 | | - Namespace: *poolNamespace, |
| 204 | + Namespace: resolvedPoolNamespace, |
194 | 205 | } |
195 | 206 | poolGroupKind := schema.GroupKind{ |
196 | 207 | Group: *poolGroup, |
|
0 commit comments