github.com/iqoqo/nomad@v0.11.3-0.20200911112621-d7021c74d101/client/allocrunner/networking.go (about) 1 package allocrunner 2 3 import ( 4 "context" 5 6 "github.com/hashicorp/nomad/nomad/structs" 7 "github.com/hashicorp/nomad/plugins/drivers" 8 ) 9 10 // NetworkConfigurator sets up and tears down the interfaces, routes, firewall 11 // rules, etc for the configured networking mode of the allocation. 12 type NetworkConfigurator interface { 13 Setup(context.Context, *structs.Allocation, *drivers.NetworkIsolationSpec) error 14 Teardown(context.Context, *structs.Allocation, *drivers.NetworkIsolationSpec) error 15 } 16 17 // hostNetworkConfigurator is a noop implementation of a NetworkConfigurator for 18 // when the alloc join's a client host's network namespace and thus does not 19 // require further configuration 20 type hostNetworkConfigurator struct{} 21 22 func (h *hostNetworkConfigurator) Setup(context.Context, *structs.Allocation, *drivers.NetworkIsolationSpec) error { 23 return nil 24 } 25 func (h *hostNetworkConfigurator) Teardown(context.Context, *structs.Allocation, *drivers.NetworkIsolationSpec) error { 26 return nil 27 }