Skip to content
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

Add support to configure multiple service ports #316

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

shivamerla
Copy link
Collaborator

  • Default named port of "api" will be added with legacy .spec.port attribute
  • Ability to setup multiple named ports "api", "metrics" etc.
  • auto detection of metrics and api ports for probes and metrics collection

Copy link

copy-pr-bot bot commented Feb 7, 2025

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@shivamerla shivamerla requested review from shengnuo and varunrsekar and removed request for ArangoGutierrez February 7, 2025 23:13
@shivamerla shivamerla force-pushed the support_multiple_service_ports branch from 11f0e22 to 4d4944e Compare February 14, 2025 04:05
 * Default named port of "api" will be added with legacy .spec.port attribute
 * Ability to setup multiple named ports "api", "metrics" etc.
 * auto detection of metrics and api ports for probes and metrics collection

Signed-off-by: Shiva Krishna, Merla <[email protected]>
Signed-off-by: Shiva Krishna, Merla <[email protected]>
@shivamerla shivamerla force-pushed the support_multiple_service_ports branch from 4d4944e to 41b8ae6 Compare March 7, 2025 07:13
Comment on lines +46 to +49
// Port is the main api serving port
Port int32 `json:"port"`
// MetricsPort is the port to be used for the metrics collection (optional)
MetricsPort int32 `json:"metricsPort,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

The helm charts for customizer allow for its internal Port to be customizable. Are we not going to support it here?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// Port is the main api serving port
Port int32 `json:"port"`
// MetricsPort is the port to be used for the metrics collection (optional)
MetricsPort int32 `json:"metricsPort,omitempty"`
// Port is the main api serving port
Port *int32 `json:"port"`
// MetricsPort is the port to be used for the metrics collection (optional)
MetricsPort *int32 `json:"metricsPort,omitempty"`

Also, these ports needs to be a pointer. Not setting port and setting port: 0 have different meanings.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, internal port need not be configurable, this is for the jobs to report back status to the customer service and all auto-configured by the operator. Also, the port setting was intentional. We don't want users to be able to set to 0. In that case we use the default port 8000.

Copy link
Collaborator

Choose a reason for hiding this comment

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

We don't want users to be able to set to 0
To address this, we would add a validation for that value to be between 1 and 65535.

k8s APIs explicitly reject that port number to be set to be 0. We should atleast be consistent with that. But for the per-service defaults, this still needs to be a ptr.

@@ -435,18 +441,15 @@ func (n *NemoCustomizer) GetStartupProbe() *corev1.Probe {
// GetDefaultStartupProbe returns the default startup probe for the NemoCustomizer container
func (n *NemoCustomizer) GetDefaultStartupProbe() *corev1.Probe {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we extract this to a common util? The only difference for each CR seems to be the Path

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is true for all defaults being applied, need to refactor in a separate MR.

},
}

if n.GetMetricsPort() != 0 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

For nimservice, defauling MetricsPort to 9009 would make sense since they always expose it. But for nemo microservices, they dont yet have metrics exposed in a separate port. How do we differentiate between the 2 cases?

Do we still need to default the metrics port here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

NIMs don't expose 9009, all are reported through default API port. Same with NeMo services too.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Was metrics port introduced as a placeholder? Trying to understand which CR uses a separate port for metrics. If no one is using it, lets remove it now and reintroduce it later?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants