flagger icon indicating copy to clipboard operation
flagger copied to clipboard

Port Discovery should use Service ports if available

Open egaudet opened this issue 6 years ago • 6 comments

Currently the Port Discovery feature uses the ContainerPorts on Pods, but it should use the Service ports instead when available.

egaudet avatar Nov 01 '19 15:11 egaudet

There are no services. Flagger expects a deployment and nothing more see https://docs.flagger.app/faq#kubernetes-services

stefanprodan avatar Nov 01 '19 16:11 stefanprodan

Which means Flagger will break communication in some existing working scenarios, when a Service is defined and ContainerPorts are not complete. If services A and B are working as they are, there should be a way to add a Canary without requiring they be modified. Flagger should have a way to refer to an existing service rather than assume one does not exist.

Also will Flagger be able to support multiple service ports in traffic shifting, for example if I want 5% of HTTP traffic and 5% of GRPC traffic to go to my Canary since my service has endpoints for both?

egaudet avatar Nov 01 '19 20:11 egaudet

Which means Flagger will break communication in some existing working scenarios, when a Service is defined and ContainerPorts are not complete.

Well that's bad practice in my opinion, fixing the container ports before creating the canary should solve it.

Also will Flagger be able to support multiple service ports in traffic shifting, for example if I want 5% of HTTP traffic and 5% of GRPC traffic to go to my Canary since my service has endpoints for both?

That's why the port discovery exists, to shifting traffic across all ports. Not all providers have support for multiple ports, but works with Istio and Linkerd.

stefanprodan avatar Nov 01 '19 20:11 stefanprodan

Whether it is bad practice or not, it is valid practice that works today.

egaudet avatar Nov 01 '19 21:11 egaudet

Which means Flagger will break communication in some existing working scenarios, when a Service is defined and ContainerPorts are not complete.

Well that's bad practice in my opinion, fixing the container ports before creating the canary should solve it.

Also will Flagger be able to support multiple service ports in traffic shifting, for example if I want 5% of HTTP traffic and 5% of GRPC traffic to go to my Canary since my service has endpoints for both?

That's why the port discovery exists, to shifting traffic across all ports. Not all providers have support for multiple ports, but works with Istio and Linkerd.

Using gateway (other than mesh off course) force the destination to use the port. In my use case, HTTP traffic is allowed through ingress-gateway and internal service to service traffic is GRPC.

softcane avatar Apr 20 '20 12:04 softcane

@stefanprodan does the port discovery still work for linkerd? I set portDiscovery: true but the new generated services only had the port set in spec.service, and other ports were missing.

rye-sw avatar Oct 04 '23 22:10 rye-sw