Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Move container attachment from sh to Go #2307

Merged
merged 14 commits into from
May 26, 2016
Merged

Conversation

bboreham
Copy link
Contributor

@bboreham bboreham commented May 23, 2016

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 for ethtool 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.

@bboreham bboreham added this to the 1.6.0 milestone May 23, 2016
@bboreham bboreham self-assigned this May 23, 2016
@bboreham bboreham force-pushed the issues/1940-remove-proxy-attach-dep branch 2 times, most recently from b2a3401 to 65d9873 Compare May 23, 2016 13:57
@bboreham bboreham changed the title WIP: Move container attachment from sh to Go Move container attachment from sh to Go May 23, 2016
@bboreham bboreham removed their assignment May 23, 2016
@brb brb self-assigned this May 23, 2016
@@ -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.

@bboreham bboreham force-pushed the issues/1940-remove-proxy-attach-dep branch from 65d9873 to 1be4bac Compare May 23, 2016 14:38

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.

@bboreham bboreham force-pushed the issues/1940-remove-proxy-attach-dep branch from 4b5e78d to dbb53a2 Compare May 23, 2016 17:46
}

func findPid(containerID string) (int, error) {
c, err := docker.NewVersionedClientFromEnv("1.18")

This comment was marked as abuse.

@bboreham bboreham force-pushed the issues/1940-remove-proxy-attach-dep branch from 09bceba to 180fa24 Compare May 24, 2016 10:24
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.

}
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.

This comment was marked as abuse.

This comment was marked as abuse.

@bboreham bboreham force-pushed the issues/1940-remove-proxy-attach-dep branch 3 times, most recently from ae81b08 to 92025bb Compare May 25, 2016 15:18
@bboreham bboreham force-pushed the issues/1940-remove-proxy-attach-dep branch from 92025bb to 6dd109a Compare May 25, 2016 16:35
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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants