mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 10:25:42 +03:00
Adds a new Prerun and Postrun hooks to manage set up of network namespaces on linux. Work still needs to be done to make the code platform agnostic and support Docker style network initalization.
29 lines
434 B
Plaintext
29 lines
434 B
Plaintext
package allocrunner
|
|
|
|
import "github.com/hashicorp/nomad/nomad/structs"
|
|
|
|
type networkHook struct {
|
|
|
|
// alloc set by new func
|
|
alloc *structs.Allocation
|
|
|
|
networks []*structs.NetworkResource
|
|
}
|
|
|
|
func newNetworkHook() *networkHook {
|
|
|
|
return nil
|
|
}
|
|
|
|
func (n *networkHook) Name() string {
|
|
return "network"
|
|
}
|
|
|
|
func (n *networkHook) Prerun() error {
|
|
if len(n.networks) == 0 || n.networks[0].Mode == "host" {
|
|
return nil
|
|
}
|
|
|
|
return nil
|
|
}
|