-
Notifications
You must be signed in to change notification settings - Fork 195
Add deprecation notice on metrics port in runner and datastore #1886
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add deprecation notice on metrics port in runner and datastore #1886
Conversation
Signed-off-by: Etai Lev Ran <[email protected]>
✅ Deploy Preview for gateway-api-inference-extension ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: elevran The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
| 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.") |
There was a problem hiding this comment.
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?
| 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.") |
| 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 | ||
| } |
There was a problem hiding this comment.
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).
|
PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
What type of PR is this?
/kind deprecation
What this PR does / why we need it:
Defining a metric port via CLI conflicts with use of multiport inference pool and/or changes to inference-pool at runtime (see #1396 and #1398).
Which issue(s) this PR fixes:
Fixes #1398
Fixes #1396
Does this PR introduce a user-facing change?: