Skip to content

Commit

Permalink
honor user specified url scheme
Browse files Browse the repository at this point in the history
Signed-off-by: Vaibhav Jain <[email protected]>
  • Loading branch information
vaibhavjainwiz committed Oct 5, 2023
1 parent caf432b commit f3569a5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
6 changes: 4 additions & 2 deletions controllers/constants/constants.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package constants

const (
IstioNamespace = "istio-system"
IstioIngressService = "istio-ingressgateway"
IstioNamespace = "istio-system"
IstioIngressService = "istio-ingressgateway"
IstioIngressServiceHTTPPortName = "http2"
IstioIngressServiceHTTPSPortName = "https"
)
21 changes: 16 additions & 5 deletions controllers/reconcilers/kisvc_route_reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,20 @@ func (r *kserveInferenceServiceRouteReconciler) createDesiredResource() (*v1.Rou
annotations := utils.Filter(r.isvc.Annotations, func(key string) bool {
return !utils.Includes(constants.ServiceAnnotationDisallowedList, key)
})

urlScheme := ingressConfig.UrlScheme
var targetPort intstr.IntOrString
var tlsConfig *v1.TLSConfig
if urlScheme == "http" {
targetPort = intstr.FromString(constants2.IstioIngressServiceHTTPPortName)
} else {
targetPort = intstr.FromString(constants2.IstioIngressServiceHTTPSPortName)
tlsConfig = &v1.TLSConfig{
Termination: v1.TLSTerminationPassthrough,
InsecureEdgeTerminationPolicy: v1.InsecureEdgeTerminationPolicyRedirect,
}
}

route := &v1.Route{
ObjectMeta: metav1.ObjectMeta{
Name: GetKServeRouteName(r.isvc),
Expand All @@ -111,12 +125,9 @@ func (r *kserveInferenceServiceRouteReconciler) createDesiredResource() (*v1.Rou
Weight: pointer.Int32(100),
},
Port: &v1.RoutePort{
TargetPort: intstr.FromString("https"),
},
TLS: &v1.TLSConfig{
Termination: v1.TLSTerminationPassthrough,
InsecureEdgeTerminationPolicy: v1.InsecureEdgeTerminationPolicyRedirect,
TargetPort: targetPort,
},
TLS: tlsConfig,
WildcardPolicy: v1.WildcardPolicyNone,
},
Status: v1.RouteStatus{
Expand Down

0 comments on commit f3569a5

Please sign in to comment.