Skip to content
Open
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
34 changes: 32 additions & 2 deletions cmd/epp/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,9 @@ var (
configFile = flag.String("config-file", runserver.DefaultConfigFile, "The path to the configuration file")
configText = flag.String("config-text", runserver.DefaultConfigText, "The configuration specified as text, in lieu of a file")

modelServerMetricsPort = flag.Int("model-server-metrics-port", 0, "Port to scrape metrics from pods. "+
"Default value will be set to the InferencePool.Spec.TargetPorts[0].Number if not set.")
modelServerMetricsPort = flag.Int("model-server-metrics-port", 0, "[DEPRECATED] Port to scrape metrics from pods. "+
"Default value will be set to the InferencePool.Spec.TargetPorts[0].Number if not set."+
"[DEPRECATED] This option will be removed in the next release.")
Comment on lines +135 to +137
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we put the [DEPRECATED] note only once?

Suggested change
modelServerMetricsPort = flag.Int("model-server-metrics-port", 0, "[DEPRECATED] Port to scrape metrics from pods. "+
"Default value will be set to the InferencePool.Spec.TargetPorts[0].Number if not set."+
"[DEPRECATED] This option will be removed in the next release.")
modelServerMetricsPort = flag.Int("model-server-metrics-port", 0, "[DEPRECATED] Port to scrape metrics from pods. "+
"Default value will be set to the InferencePool.Spec.TargetPorts[0].Number if not set."+
"This option will be removed in the next release.")

modelServerMetricsPath = flag.String("model-server-metrics-path", "/metrics", "Path to scrape metrics from pods")
modelServerMetricsScheme = flag.String("model-server-metrics-scheme", "http", "Scheme to scrape metrics from pods")
modelServerMetricsHttpsInsecureSkipVerify = flag.Bool("model-server-metrics-https-insecure-skip-verify", true, "When using 'https' scheme for 'model-server-metrics-scheme', configure 'InsecureSkipVerify' (default to true)")
Expand Down Expand Up @@ -191,6 +192,8 @@ func (r *Runner) Run(ctx context.Context) error {
flag.Parse()
initLogging(&opts)

_ = r.deprecatedFlagsHandler(setupLog) // ignore error for now

if *tracing {
err := common.InitTracing(ctx, setupLog)
if err != nil {
Expand Down Expand Up @@ -467,6 +470,33 @@ func (r *Runner) parseConfigurationPhaseTwo(ctx context.Context, rawConfig *conf
return cfg, nil
}

func (r *Runner) deprecatedFlagsHandler(logger logr.Logger) error {
deprecated := map[string]string{ // Map of deprecated flags: key = flag name, value = replacement (empty if none)
"model-server-metrics-port": "",
}

var usedDeprecated []string // Track which deprecated flags were explicitly set
flag.Visit(func(f *flag.Flag) {
if _, ok := deprecated[f.Name]; ok {
usedDeprecated = append(usedDeprecated, f.Name)
}
})

if len(usedDeprecated) > 0 { // report on deprecated flags used
for _, option := range usedDeprecated {
if replacement := deprecated[option]; replacement != "" {
logger.Info("deprecated option will be removed in the next release",
"option", option, "replacement", replacement)
} else {
logger.Info("deprecated option will be removed in the next release. No replacement available.",
"option", option)
}
}
return errors.New("deprecated options used" + fmt.Sprintf("%+v", usedDeprecated))
}
return nil
}
Comment on lines +473 to +498
Copy link
Contributor

@nirrozenbaum nirrozenbaum Nov 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this function can be simplified to a 5 liner.
few points:

  • as for now, we have no depracated flag that is replaced by a different flag. so the replacement part seems redundant.
  • no need to use map for deprecated (can be a set or just a const as long as this is a single string).
  • no need to run flag.Visit and then iterating over it again. while we're at the flag.Visit, we can check - if the depracated flag is used, log the deprecation notice.
  • no need to return error (which is later ignored anyway).


func (r *Runner) deprecatedConfigurationHelper(cfg *config.Config, logger logr.Logger) {
// Handle deprecated environment variable based feature flags

Expand Down
4 changes: 3 additions & 1 deletion pkg/epp/datastore/datastore.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ type Datastore interface {
Clear()
}

// NewDatastore creates a new data store.
// TODO: modelServerMetricsPort is being deprecated
func NewDatastore(parentCtx context.Context, epFactory datalayer.EndpointFactory, modelServerMetricsPort int32) Datastore {
store := &datastore{
parentCtx: parentCtx,
Expand All @@ -93,7 +95,7 @@ type datastore struct {
pods *sync.Map
// modelServerMetricsPort metrics port from EPP command line argument
// used only if there is only one inference engine per pod
modelServerMetricsPort int32
modelServerMetricsPort int32 // TODO: deprecating
epf datalayer.EndpointFactory
}

Expand Down