Skip to content

Commit

Permalink
[RHOAIENG-16851] rawdeployment route bug fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Vedant Mahabaleshwarkar <vmahabal@redhat.com>
  • Loading branch information
VedantMahabaleshwarkar committed Jan 15, 2025
1 parent 4fad7e6 commit f370b4e
Showing 1 changed file with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ func (r *KserveRawRouteReconciler) createDesiredResource(ctx context.Context, lo
log.Error(err, "Failed to fetch service for InferenceService", "InferenceService", isvc.Name)
return nil, err
}
var servicePort int32
var targetService corev1.Service
var targetPort intstr.IntOrString
for _, service := range serviceList.Items {
if val, ok := service.Labels["component"]; ok {
if val == "transformer" {
Expand All @@ -121,15 +121,16 @@ func (r *KserveRawRouteReconciler) createDesiredResource(ctx context.Context, lo
}
}
}

for _, port := range targetService.Spec.Ports {
if !enableAuth {
if port.Name == "http" || port.Name == targetService.Name {
servicePort = port.Port
}
} else {
if enableAuth {
for _, port := range targetService.Spec.Ports {
if port.Name == "https" {
servicePort = port.Port
targetPort = intstr.FromInt32(port.Port)
}
}
} else {
for _, port := range targetService.Spec.Ports {
if port.Name == "http" || port.Name == targetService.Name {
targetPort = intstr.FromString(port.Name)
}
}
}
Expand All @@ -149,7 +150,7 @@ func (r *KserveRawRouteReconciler) createDesiredResource(ctx context.Context, lo
Weight: ptr.To(int32(100)),
},
Port: &v1.RoutePort{
TargetPort: intstr.FromInt32(servicePort),
TargetPort: targetPort,
},
WildcardPolicy: v1.WildcardPolicyNone,
},
Expand Down

0 comments on commit f370b4e

Please sign in to comment.