-
Notifications
You must be signed in to change notification settings - Fork 402
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
feat: set appProtocol based on target service #2094
base: master
Are you sure you want to change the base?
Conversation
for name, port := range ports_int { | ||
svcPort := corev1.ServicePort{Name: name, Port: port, AppProtocol: &defaultAppProtocol} | ||
for svc, portInfo := range serviceMapPortInfo { | ||
svcPort := corev1.ServicePort{Name: svc, Port: portInfo.PortNumber, AppProtocol: &portInfo.Protocol} |
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.
Is it possible that the &portInfo.Protocol
here points to an empty value? I think in that case we should still use the &defaultAppProtocol
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.
fixed
@@ -203,7 +202,7 @@ func BuildServeService(ctx context.Context, rayService rayv1.RayService, rayClus | |||
ports := []corev1.ServicePort{} | |||
for name, port := range ports_int { | |||
if name == utils.ServingPortName { | |||
svcPort := corev1.ServicePort{Name: name, Port: port} | |||
svcPort := corev1.ServicePort{Name: name, Port: port.PortNumber} |
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.
Should we set AppProtocol
here?
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.
fixed
@@ -369,35 +368,55 @@ func getServicePorts(cluster rayv1.RayCluster) map[string]int32 { | |||
|
|||
// check if metrics port is defined. If not, add default value for it. | |||
if _, metricsDefined := ports[utils.MetricsPortName]; !metricsDefined { | |||
ports[utils.MetricsPortName] = utils.DefaultMetricsPort | |||
ports[utils.MetricsPortName] = portInfo{PortNumber: utils.DefaultMetricsPort} |
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.
Should we set AppProtocol here?
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.
fixed
d886490
to
4b9052f
Compare
@@ -42,10 +42,10 @@ func BuildIngressForHeadService(ctx context.Context, cluster rayv1.RayCluster) ( | |||
|
|||
var paths []networkingv1.HTTPIngressPath | |||
pathType := networkingv1.PathTypeExact | |||
servicePorts := getServicePorts(cluster) | |||
serviceMapPortInfo := getServicePorts(cluster) |
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.
serviceMapPortInfo
sounds a little wired. How about we keep it as servicePorts
?
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.
Adjusted
if portInfo.Protocol != "" { | ||
appProtocol = portInfo.Protocol | ||
} | ||
|
||
svcPort := corev1.ServicePort{Name: svc, Port: portInfo.PortNumber, AppProtocol: &appProtocol} |
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.
The corev1.ServicePort
has two protocol fields. One is Protocol
and the other one is AppProtocol
.
To avoid confusion, I think we should rename the portInfo.Protocol
to portInfo.AppProtocol
here. That is:
if portInfo.Protocol != "" { | |
appProtocol = portInfo.Protocol | |
} | |
svcPort := corev1.ServicePort{Name: svc, Port: portInfo.PortNumber, AppProtocol: &appProtocol} | |
if portInfo.Protocol != "" { | |
appProtocol = portInfo.AppProtocol | |
} | |
svcPort := corev1.ServicePort{Name: svc, Port: portInfo.PortNumber, AppProtocol: &appProtocol} |
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.
Got it
4b9052f
to
7bca49e
Compare
Why are these changes needed?
#668 always set app protocol to
tcp
. This change dynamically adjusts the port protocol based on the target service.Related issue number
#1946
Checks