improve logging in proxy
- always info-log when we encounter an 'interesting' container - s/CIDR/WEAVE_CIDR - some other minor tweaks
This commit is contained in:
1 parent
fe36da2041
commit
f7f0369bff
3 files changed
+10
-4
No files matched your search
@@ -5,8 +5,10 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/fsouza/go-dockerclient"
|
"github.com/fsouza/go-dockerclient"
|
||||||
|
. "github.com/weaveworks/weave/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
type createContainerInterceptor struct {
|
type createContainerInterceptor struct {
|
||||||
@@ -33,7 +35,8 @@ func (i *createContainerInterceptor) InterceptRequest(r *http.Request) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, ok := weaveCIDRsFromConfig(container.Config); ok {
|
if cidrs, ok := weaveCIDRsFromConfig(container.Config); ok {
|
||||||
|
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 {
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -4,8 +4,10 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/fsouza/go-dockerclient"
|
"github.com/fsouza/go-dockerclient"
|
||||||
|
. "github.com/weaveworks/weave/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
type createExecInterceptor struct {
|
type createExecInterceptor struct {
|
||||||
@@ -35,7 +37,8 @@ func (i *createExecInterceptor) InterceptRequest(r *http.Request) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, ok := weaveCIDRsFromConfig(container.Config); ok {
|
if cidrs, ok := weaveCIDRsFromConfig(container.Config); ok {
|
||||||
|
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...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,12 +28,12 @@ func (i *startContainerInterceptor) InterceptResponse(r *http.Response) error {
|
|||||||
Debug.Print("No Weave CIDR, ignoring")
|
Debug.Print("No Weave CIDR, ignoring")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
Info.Printf("Container %s was started with CIDR \"%s\"", container.ID, strings.Join(cidrs, " "))
|
Info.Printf("Attaching container %s with WEAVE_CIDR \"%s\" to weave network", container.ID, strings.Join(cidrs, " "))
|
||||||
args := []string{"attach"}
|
args := []string{"attach"}
|
||||||
args = append(args, cidrs...)
|
args = append(args, cidrs...)
|
||||||
args = append(args, container.ID)
|
args = append(args, container.ID)
|
||||||
if _, err := callWeave(args...); err != nil {
|
if _, err := callWeave(args...); err != nil {
|
||||||
Warning.Printf("Attaching container %s to weave failed: %v", container.ID, err)
|
Warning.Printf("Attaching container %s to weave network failed: %v", container.ID, err)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Reference in new issue
Block a user