From 69162b5918aafcc714eff9f03d021afa1724931a Mon Sep 17 00:00:00 2001 From: glindsell Date: Fri, 19 Jun 2020 10:56:16 +0100 Subject: [PATCH] Switch on executor enabled for service ports Signed-off-by: glindsell --- .../seldondeployment_controller.go | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/operator/controllers/seldondeployment_controller.go b/operator/controllers/seldondeployment_controller.go index edd7be7c6f..0fb73e39af 100644 --- a/operator/controllers/seldondeployment_controller.go +++ b/operator/controllers/seldondeployment_controller.go @@ -626,12 +626,22 @@ func createPredictorService(pSvcName string, seldonId string, p *machinelearning }, } - if engine_http_port != 0 && len(psvc.Spec.Ports) == 0 { - psvc.Spec.Ports = append(psvc.Spec.Ports, corev1.ServicePort{Protocol: corev1.ProtocolTCP, Port: int32(engine_http_port), TargetPort: intstr.FromInt(engine_http_port), Name: "http"}) - } + if isExecutorEnabled(mlDep) { + if engine_http_port != 0 && len(psvc.Spec.Ports) == 0 { + psvc.Spec.Ports = append(psvc.Spec.Ports, corev1.ServicePort{Protocol: corev1.ProtocolTCP, Port: int32(engine_http_port), TargetPort: intstr.FromInt(engine_http_port), Name: "http"}) + } - if engine_grpc_port != 0 && len(psvc.Spec.Ports) < 2 { - psvc.Spec.Ports = append(psvc.Spec.Ports, corev1.ServicePort{Protocol: corev1.ProtocolTCP, Port: int32(engine_grpc_port), TargetPort: intstr.FromInt(engine_http_port), Name: "grpc"}) + if engine_grpc_port != 0 && len(psvc.Spec.Ports) < 2 { + psvc.Spec.Ports = append(psvc.Spec.Ports, corev1.ServicePort{Protocol: corev1.ProtocolTCP, Port: int32(engine_http_port), TargetPort: intstr.FromInt(engine_http_port), Name: "grpc"}) + } + } else { + if engine_http_port != 0 && len(psvc.Spec.Ports) == 0 { + psvc.Spec.Ports = append(psvc.Spec.Ports, corev1.ServicePort{Protocol: corev1.ProtocolTCP, Port: int32(engine_http_port), TargetPort: intstr.FromInt(engine_http_port), Name: "http"}) + } + + if engine_grpc_port != 0 && len(psvc.Spec.Ports) < 2 { + psvc.Spec.Ports = append(psvc.Spec.Ports, corev1.ServicePort{Protocol: corev1.ProtocolTCP, Port: int32(engine_grpc_port), TargetPort: intstr.FromInt(engine_grpc_port), Name: "grpc"}) + } } if GetEnv("AMBASSADOR_ENABLED", "false") == "true" {