-
Notifications
You must be signed in to change notification settings - Fork 673
Move container attachment from sh to Go #2307
Conversation
b2a3401
to
65d9873
Compare
@@ -70,3 +70,9 @@ | |||
[submodule "vendor/github.com/pkg/profile"] | |||
path = vendor/github.com/pkg/profile | |||
url = https://github.com/pkg/profile | |||
[submodule "vendor/github.com/bboreham/arping"] |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
65d9873
to
1be4bac
Compare
|
||
copy(request.Name[:], name) | ||
|
||
socket, err := syscall.Socket(syscall.AF_INET, syscall.SOCK_DGRAM, 0) |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
4b5e78d
to
dbb53a2
Compare
} | ||
|
||
func findPid(containerID string) (int, error) { | ||
c, err := docker.NewVersionedClientFromEnv("1.18") |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
09bceba
to
180fa24
Compare
if err := common.WithNetNS(ns, func() error { | ||
_, err := netlink.LinkByName(ifName) | ||
return err | ||
}); err != nil { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
} | ||
name, peerName := vethPrefix+"pl"+id, vethPrefix+"pg"+id | ||
_, err = CreateAndAttachVeth(name, peerName, bridgeName, mtu, func(veth netlink.Link) error { | ||
common.EthtoolTXOff(peerName) // TODO: do we want to do this under fastdp? |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
ae81b08
to
92025bb
Compare
Also move netlink and netns code from common to net Creates interface if not already there Adds addresses Move the set link 'up' to after addresses are added
Detect the bridge type in the same way the weave script does.
92025bb
to
6dd109a
Compare
return cleanup(`failed to attach %s to device "%s": %s`, name, bridgeName, err) | ||
} | ||
default: | ||
return cleanup(`invalid bridge configuration`) |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
Part of #1940
Most of this is refactoring/enhancing the current plugin code to be closer to the script; see also #639 for
arping
and #1726 forethtool tx off
.The plugin previously leaked a veth if something went wrong configuring it.
This PR does not mean the proxy can avoid shelling out when attaching a container. Still to do: allocate IP addresses, rewrite hosts file, add to DNS.