Merge pull request #1310 from weaveworks/improve_proxy_ignore_messages
Improve log messages for when the proxy ignores a container
This commit is contained in:
commit
74883c5da8
4 files changed
+6
-6
No files matched your search
@@ -54,7 +54,7 @@ func (i *createContainerInterceptor) InterceptRequest(r *http.Request) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if cidrs, err := i.proxy.weaveCIDRsFromConfig(container.Config, container.HostConfig); err != nil {
|
if cidrs, err := i.proxy.weaveCIDRsFromConfig(container.Config, container.HostConfig); err != nil {
|
||||||
Log.Infof("Ignoring container due to %s", err)
|
Log.Infof("Leaving container alone because %s", err)
|
||||||
} else {
|
} else {
|
||||||
Log.Infof("Creating container with WEAVE_CIDR \"%s\"", strings.Join(cidrs, " "))
|
Log.Infof("Creating container with WEAVE_CIDR \"%s\"", strings.Join(cidrs, " "))
|
||||||
if container.HostConfig == nil {
|
if container.HostConfig == nil {
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ func (i *createExecInterceptor) InterceptRequest(r *http.Request) error {
|
|||||||
_, hasWeaveWait := container.Volumes["/w"]
|
_, hasWeaveWait := container.Volumes["/w"]
|
||||||
cidrs, err := i.proxy.weaveCIDRsFromConfig(container.Config, container.HostConfig)
|
cidrs, err := i.proxy.weaveCIDRsFromConfig(container.Config, container.HostConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Log.Infof("Ignoring container %s due to %s", container.ID, err)
|
Log.Infof("Leaving container %s alone because %s", container.ID, err)
|
||||||
} else if hasWeaveWait {
|
} else if hasWeaveWait {
|
||||||
Log.Infof("Exec in container %s with WEAVE_CIDR \"%s\"", container.ID, strings.Join(cidrs, " "))
|
Log.Infof("Exec in container %s with WEAVE_CIDR \"%s\"", container.ID, strings.Join(cidrs, " "))
|
||||||
cmd := append(weaveWaitEntrypoint, "-s")
|
cmd := append(weaveWaitEntrypoint, "-s")
|
||||||
|
|||||||
+3
-3
@@ -28,8 +28,8 @@ var (
|
|||||||
containerStartRegexp = regexp.MustCompile("^(/v[0-9\\.]*)?/containers/[^/]*/(re)?start$")
|
containerStartRegexp = regexp.MustCompile("^(/v[0-9\\.]*)?/containers/[^/]*/(re)?start$")
|
||||||
execCreateRegexp = regexp.MustCompile("^(/v[0-9\\.]*)?/containers/[^/]*/exec$")
|
execCreateRegexp = regexp.MustCompile("^(/v[0-9\\.]*)?/containers/[^/]*/exec$")
|
||||||
|
|
||||||
ErrWeaveCIDRNone = errors.New("WEAVE_CIDR=none")
|
ErrWeaveCIDRNone = errors.New("the container was created with the '-e WEAVE_CIDR=none' option")
|
||||||
ErrNoDefaultIPAM = errors.New("--no-default-ipalloc option")
|
ErrNoDefaultIPAM = errors.New("the container was created without specifying an IP address with '-e WEAVE_CIDR=...' and the proxy was started with the '--no-default-ipalloc' option")
|
||||||
)
|
)
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
@@ -230,7 +230,7 @@ func (proxy *Proxy) weaveCIDRsFromConfig(config *docker.Config, hostConfig *dock
|
|||||||
netMode = hostConfig.NetworkMode
|
netMode = hostConfig.NetworkMode
|
||||||
}
|
}
|
||||||
if netMode == "host" || strings.HasPrefix(netMode, "container:") {
|
if netMode == "host" || strings.HasPrefix(netMode, "container:") {
|
||||||
return nil, fmt.Errorf("--net option: %q", netMode)
|
return nil, fmt.Errorf("the container was created with the '--net=%s'", netMode)
|
||||||
}
|
}
|
||||||
for _, e := range config.Env {
|
for _, e := range config.Env {
|
||||||
if strings.HasPrefix(e, "WEAVE_CIDR=") {
|
if strings.HasPrefix(e, "WEAVE_CIDR=") {
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ func (i *startContainerInterceptor) InterceptResponse(r *http.Response) error {
|
|||||||
|
|
||||||
cidrs, err := i.proxy.weaveCIDRsFromConfig(container.Config, container.HostConfig)
|
cidrs, err := i.proxy.weaveCIDRsFromConfig(container.Config, container.HostConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Log.Infof("Ignoring container %s due to %s", container.ID, err)
|
Log.Infof("Leaving container %s alone because %s", container.ID, err)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
Log.Infof("Attaching container %s with WEAVE_CIDR \"%s\" to weave network", container.ID, strings.Join(cidrs, " "))
|
Log.Infof("Attaching container %s with WEAVE_CIDR \"%s\" to weave network", container.ID, strings.Join(cidrs, " "))
|
||||||
|
|||||||
Reference in new issue
Block a user