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

[proxy] should not attempt weavewait in on weave container's execs #1152

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion proxy/create_exec_interceptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ func (i *createExecInterceptor) InterceptRequest(r *http.Request) error {
return err
}

if cidrs, ok := i.proxy.weaveCIDRsFromConfig(container.Config); ok {
_, hasWeaveWait := container.Volumes["/w"]
cidrs, hasCIDRs := i.proxy.weaveCIDRsFromConfig(container.Config)
if hasCIDRs && hasWeaveWait {
Log.Infof("Exec in container %s with WEAVE_CIDR \"%s\"", container.ID, strings.Join(cidrs, " "))
cmd := append(weaveWaitEntrypoint, "-s")
options.Cmd = append(cmd, options.Cmd...)
Expand Down
6 changes: 5 additions & 1 deletion test/610_proxy_wait_for_weave_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ entrypoint() {
}

start_suite "Proxy waits for weave to be ready before running container commands"
weave_on $HOST1 launch-proxy
weave_on $HOST1 launch
BASE_IMAGE=busybox
# Ensure the base image does not exist, so that it will be pulled
! docker_on $HOST1 inspect --format=" " $BASE_IMAGE >/dev/null 2>&1 || docker_on $HOST1 rmi $BASE_IMAGE
Expand All @@ -22,4 +22,8 @@ assert "entrypoint c2" "$(entrypoint $COMMITTED_IMAGE)"
# Check weave IP is first ip returned, so java (etc) prefer weave.
assert "proxy docker_on $HOST1 run -e 'WEAVE_CIDR=10.2.1.1/24' $BASE_IMAGE hostname -i | cut -d' ' -f1" "10.2.1.1"

# Check exec works on containers without weavewait
docker_on $HOST1 run -dit --name c3 $SMALL_IMAGE /bin/sh
assert_raises "proxy docker_on $HOST1 exec c3 true"

end_suite