docker: support group allocated ports and host_networks (#8623)

* docker: support group allocated ports

* docker: add new ports driver config to specify which group ports are mapped

* docker: update port mapping docs
This commit is contained in:
Nick Ethier
2020-08-11 18:30:22 -04:00
committed by GitHub
parent 8272654dab
commit c11dbcd001
11 changed files with 534 additions and 316 deletions

View File

@@ -334,6 +334,7 @@ func (tc *TaskConfig) EncodeConcreteDriverConfig(t interface{}) error {
type Resources struct {
NomadResources *structs.AllocatedTaskResources
LinuxResources *LinuxResources
Ports *structs.AllocatedPorts
}
func (r *Resources) Copy() *Resources {
@@ -347,6 +348,11 @@ func (r *Resources) Copy() *Resources {
if r.LinuxResources != nil {
res.LinuxResources = r.LinuxResources.Copy()
}
if r.Ports != nil {
ports := structs.AllocatedPorts(append(make([]structs.AllocatedPortMapping, 0, len(*r.Ports)), *r.Ports...))
res.Ports = &ports
}
return res
}