Skip to content

Commit

Permalink
feat(service): Update service port names for istio support
Browse files Browse the repository at this point in the history
Based off of our discussion
[here](https://seldondev.slack.com/archives/C8Y9A8G0Y/p1594744362472100).

The current port for grpc traffic is named `grpc` (very reasonably). Due
to the new pattern of multiplexing http/grpc traffic on the http port,
issues have popped up when trying to send grpc traffic to a service
defined by the `seldon.io/svc-name` due to the istio sidecar determining
the protocol and only allowing grpc traffic through (more info
[here](https://istio.io/latest/docs/ops/configuration/traffic-management/protocol-selection/)).

This fix changes the name of the grpc port from `grpc` to `http2` to
allow for multiplexing of traffic when istio sidecars are used, while
still maintaining the ability for istio grpc metrics to be generated
(more info
[here](https://istio.io/latest/docs/reference/config/policy-and-telemetry/metrics/#metrics)).

Signed off by: Nick Groszewski <groszewn@gmail.com>
  • Loading branch information
groszewn committed Jul 15, 2020
1 parent 3730769 commit def3eb4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions operator/controllers/seldondeployment_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -632,15 +632,15 @@ func createPredictorService(pSvcName string, seldonId string, p *machinelearning
}

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"})
psvc.Spec.Ports = append(psvc.Spec.Ports, corev1.ServicePort{Protocol: corev1.ProtocolTCP, Port: int32(engine_grpc_port), TargetPort: intstr.FromInt(engine_http_port), Name: "http2"})
}
} 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"})
psvc.Spec.Ports = append(psvc.Spec.Ports, corev1.ServicePort{Protocol: corev1.ProtocolTCP, Port: int32(engine_grpc_port), TargetPort: intstr.FromInt(engine_grpc_port), Name: "http2"})
}
}

Expand Down

0 comments on commit def3eb4

Please sign in to comment.