nats-io / nats-operator

NATS Operator
https://nats-io.github.io/k8s/
Apache License 2.0
574 stars 111 forks source link

change service port name to support Istio explicit protocol selection #346

Closed nberlee closed 2 years ago

nberlee commented 2 years ago

Kubernetes has a native construct for this called appProtocol. Kubernetes expects either a IANA protocol or a custom protocol prefix with a domain.

I tried setting appProtocol to nats.io/client but that does not effect anything Istio, as istio expects only these protocols: https://istio.io/latest/docs/ops/configuration/traffic-management/protocol-selection/#explicit-protocol-selection

Setting appProtocol to tcp probably does work, but tcp is not a valid iana service name. See: https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml

Therefor the least intrusive, compatible leaves us with prefixing the service port name.

Fixes: #88

vitalii-buchyn-exa commented 1 year ago

hi, sorry for postmortem post, but is this fix needed for tcp/6222 server port as well? thank you

nberlee commented 1 year ago

Typically no... As running NATS inside the istio-mesh may break other things also... but it could not hurt

If I understand correctly 6222 is only used from server to server. And I think most people will run NATS outside the istio-mesh as you run into other problems as well when you run it inside the mesh.

As 4222 can be called from a pod inside the istio-mesh, you need the explicit protocol selection.