Browse Source

Bind port in docker with udp flag when protocol is udp (#915)

* Bind port in docker with udp flag when port protocol is udp

* Update src/Microsoft.Tye.Hosting/DockerRunner.cs

Co-authored-by: Justin Kotalik <jukotali@microsoft.com>

* Added error when using udp binding for project service

Co-authored-by: Justin Kotalik <jukotali@microsoft.com>
pull/1080/head
Tim Potze 5 years ago
committed by GitHub
parent
commit
7eae8c64d3
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      src/Microsoft.Tye.Hosting/DockerRunner.cs
  2. 5
      src/Microsoft.Tye.Hosting/ProxyService.cs

7
src/Microsoft.Tye.Hosting/DockerRunner.cs

@ -79,6 +79,11 @@ namespace Microsoft.Tye.Hosting
continue;
}
if (string.Equals(binding.Protocol, "udp", StringComparison.InvariantCultureIgnoreCase))
{
throw new CommandException("Proxy does not support the udp protocol yet.");
}
var b = new ServiceBinding()
{
ConnectionString = binding.ConnectionString,
@ -232,7 +237,7 @@ namespace Microsoft.Tye.Hosting
// These are the ports that the application should use for binding
// 1. Tell the docker container what port to bind to
portString = docker.Private ? "" : string.Join(" ", ports.Select(p => $"-p {p.Port}:{p.ContainerPort ?? p.Port}"));
portString = docker.Private ? "" : string.Join(" ", ports.Select(p => $"-p {p.Port}:{p.ContainerPort ?? p.Port}{(string.Equals(p.Protocol, "udp", StringComparison.OrdinalIgnoreCase) ? "/udp" : string.Empty)}"));
if (docker.IsAspNet)
{

5
src/Microsoft.Tye.Hosting/ProxyService.cs

@ -63,6 +63,11 @@ namespace Microsoft.Tye.Hosting
continue;
}
if (string.Equals(binding.Protocol, "udp", StringComparison.InvariantCultureIgnoreCase))
{
throw new CommandException("Proxy does not support the udp protocol yet.");
}
var ports = binding.ReplicaPorts;
// We need to bind to all interfaces on linux since the container -> host communication won't work

Loading…
Cancel
Save