Merge branch '0.11'

This commit is contained in:
Paul Bellamy committed 2015-05-27 13:52:13 +01:00
commit b9d666d4a5
4 files changed
+13 -5

No files matched your search

+2 -1
View File
@@ -15,6 +15,7 @@ type createContainerInterceptor struct {
client *docker.Client client *docker.Client
withDNS bool withDNS bool
dockerBridgeIP string dockerBridgeIP string
withIPAM bool
} }
type createContainerRequestBody struct { type createContainerRequestBody struct {
@@ -35,7 +36,7 @@ func (i *createContainerInterceptor) InterceptRequest(r *http.Request) error {
return err return err
} }
if cidrs, ok := weaveCIDRsFromConfig(container.Config); ok { if cidrs, ok := weaveCIDRsFromConfig(container.Config); ok || i.withIPAM {
Info.Printf("Creating container with WEAVE_CIDR \"%s\"", strings.Join(cidrs, " ")) Info.Printf("Creating container with WEAVE_CIDR \"%s\"", strings.Join(cidrs, " "))
container.HostConfig.VolumesFrom = append(container.HostConfig.VolumesFrom, "weaveproxy") container.HostConfig.VolumesFrom = append(container.HostConfig.VolumesFrom, "weaveproxy")
if err := i.setWeaveWaitEntrypoint(container.Config); err != nil { if err := i.setWeaveWaitEntrypoint(container.Config); err != nil {
+3 -2
View File
@@ -11,7 +11,8 @@ import (
) )
type createExecInterceptor struct { type createExecInterceptor struct {
client *docker.Client client *docker.Client
withIPAM bool
} }
type createExecRequestBody struct { type createExecRequestBody struct {
@@ -37,7 +38,7 @@ func (i *createExecInterceptor) InterceptRequest(r *http.Request) error {
return err return err
} }
if cidrs, ok := weaveCIDRsFromConfig(container.Config); ok { if cidrs, ok := weaveCIDRsFromConfig(container.Config); ok || i.withIPAM {
Info.Printf("Exec in container %s with WEAVE_CIDR \"%s\"", container.ID, strings.Join(cidrs, " ")) Info.Printf("Exec in container %s with WEAVE_CIDR \"%s\"", container.ID, strings.Join(cidrs, " "))
options.Cmd = append(weaveWaitEntrypoint, options.Cmd...) options.Cmd = append(weaveWaitEntrypoint, options.Cmd...)
} }
+2 -2
View File
@@ -68,11 +68,11 @@ func (proxy *Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request) {
path := r.URL.Path path := r.URL.Path
switch { switch {
case containerCreateRegexp.MatchString(path): case containerCreateRegexp.MatchString(path):
proxy.serveWithInterceptor(&createContainerInterceptor{proxy.client, proxy.withDNS, proxy.dockerBridgeIP}, w, r) proxy.serveWithInterceptor(&createContainerInterceptor{proxy.client, proxy.withDNS, proxy.dockerBridgeIP, proxy.withIPAM}, w, r)
case containerStartRegexp.MatchString(path): case containerStartRegexp.MatchString(path):
proxy.serveWithInterceptor(&startContainerInterceptor{proxy.client, proxy.withDNS, proxy.withIPAM}, w, r) proxy.serveWithInterceptor(&startContainerInterceptor{proxy.client, proxy.withDNS, proxy.withIPAM}, w, r)
case execCreateRegexp.MatchString(path): case execCreateRegexp.MatchString(path):
proxy.serveWithInterceptor(&createExecInterceptor{proxy.client}, w, r) proxy.serveWithInterceptor(&createExecInterceptor{proxy.client, proxy.withIPAM}, w, r)
case strings.HasPrefix(path, "/weave"): case strings.HasPrefix(path, "/weave"):
w.WriteHeader(http.StatusOK) w.WriteHeader(http.StatusOK)
default: default:
@@ -26,4 +26,10 @@ run_container "grep ^1$ /sys/class/net/ethwe/carrier"
build_image false '["/bin/false"]' '' build_image false '["/bin/false"]' ''
run_container "--entrypoint='grep' false ^1$ /sys/class/net/ethwe/carrier" run_container "--entrypoint='grep' false ^1$ /sys/class/net/ethwe/carrier"
weave_on $HOST1 launch -iprange 10.2.2.0/24
docker_on $HOST1 kill weaveproxy
weave_on $HOST1 launch-proxy --with-ipam
assert_raises "proxy docker_on $HOST1 run check-ethwe-up"
end_suite end_suite