mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-06-04 08:40:49 +00:00
Allow services (and their images) to expose udp ports besides tcp
Closes #621 Change-Type: patch Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
This commit is contained in:
parent
2fdf385c09
commit
015d33f8f5
@ -367,14 +367,15 @@ module.exports = class Service
|
|||||||
return @labels
|
return @labels
|
||||||
|
|
||||||
extendAndSanitiseExposedPorts: (imageInfo) =>
|
extendAndSanitiseExposedPorts: (imageInfo) =>
|
||||||
@expose = _.clone(@expose)
|
@expose = _.map @expose, (p) ->
|
||||||
@expose = _.map(@expose, String)
|
p = new String(p)
|
||||||
|
if /^[0-9]*$/.test(p)
|
||||||
|
p += '/tcp'
|
||||||
|
return p
|
||||||
if imageInfo?.Config?.ExposedPorts?
|
if imageInfo?.Config?.ExposedPorts?
|
||||||
for own k, v of imageInfo.Config.ExposedPorts
|
for own port, _v of imageInfo.Config.ExposedPorts
|
||||||
port = k.match(/^([0-9]*)\/tcp$/)?[1]
|
if !_.find(@expose, port)
|
||||||
if port? and !_.find(@expose, port)
|
|
||||||
@expose.push(port)
|
@expose.push(port)
|
||||||
|
|
||||||
return @expose
|
return @expose
|
||||||
|
|
||||||
extendAndSanitiseVolumes: (imageInfo) =>
|
extendAndSanitiseVolumes: (imageInfo) =>
|
||||||
@ -553,7 +554,7 @@ module.exports = class Service
|
|||||||
portBindings["#{containerPort}/#{protocol}"] = [ { HostIp: host, HostPort: hostPort } ]
|
portBindings["#{containerPort}/#{protocol}"] = [ { HostIp: host, HostPort: hostPort } ]
|
||||||
if @expose?
|
if @expose?
|
||||||
for port in @expose
|
for port in @expose
|
||||||
exposedPorts[port + '/tcp'] = {}
|
exposedPorts[port] = {}
|
||||||
return { exposedPorts, portBindings }
|
return { exposedPorts, portBindings }
|
||||||
|
|
||||||
getBindsAndVolumes: =>
|
getBindsAndVolumes: =>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user