weave launch-proxy accepts --no-multicast-route
This commit is contained in:
1 parent
367b73e6e3
commit
ce25f58639
6 files changed
+36
-12
No files matched your search
@@ -6,6 +6,7 @@ LABEL works.weave.role=system
|
|||||||
WORKDIR /home/weave
|
WORKDIR /home/weave
|
||||||
VOLUME /w
|
VOLUME /w
|
||||||
VOLUME /w-noop
|
VOLUME /w-noop
|
||||||
|
VOLUME /w-nomcast
|
||||||
ENTRYPOINT ["/home/weave/sigproxy", "/home/weave/weave"]
|
ENTRYPOINT ["/home/weave/sigproxy", "/home/weave/weave"]
|
||||||
|
|
||||||
RUN apk add --update \
|
RUN apk add --update \
|
||||||
@@ -22,4 +23,5 @@ ADD ./weave ./sigproxy ./weaveproxy ./symlink /home/weave/
|
|||||||
ADD ./netcheck ./docker_tls_args /usr/bin/
|
ADD ./netcheck ./docker_tls_args /usr/bin/
|
||||||
ADD ./weavewait /w/w
|
ADD ./weavewait /w/w
|
||||||
ADD ./weavewait_noop /w-noop/w
|
ADD ./weavewait_noop /w-noop/w
|
||||||
|
ADD ./weavewait_nomcast /w-nomcast/w
|
||||||
ADD ./docker.tgz /
|
ADD ./docker.tgz /
|
||||||
@@ -40,6 +40,7 @@ func main() {
|
|||||||
mflag.BoolVar(&c.TLSConfig.Verify, []string{"#tlsverify", "-tlsverify"}, false, "Use TLS and verify the remote")
|
mflag.BoolVar(&c.TLSConfig.Verify, []string{"#tlsverify", "-tlsverify"}, false, "Use TLS and verify the remote")
|
||||||
mflag.BoolVar(&c.WithDNS, []string{"-with-dns", "w"}, false, "instruct created containers to always use weaveDNS as their nameserver")
|
mflag.BoolVar(&c.WithDNS, []string{"-with-dns", "w"}, false, "instruct created containers to always use weaveDNS as their nameserver")
|
||||||
mflag.BoolVar(&c.WithoutDNS, []string{"-without-dns"}, false, "instruct created containers to never use weaveDNS as their nameserver")
|
mflag.BoolVar(&c.WithoutDNS, []string{"-without-dns"}, false, "instruct created containers to never use weaveDNS as their nameserver")
|
||||||
|
mflag.BoolVar(&c.NoMulticastRoute, []string{"-no-multicast-route"}, false, "do not add a multicast route via the weave interface when attaching containers")
|
||||||
mflag.Parse()
|
mflag.Parse()
|
||||||
|
|
||||||
if justVersion {
|
if justVersion {
|
||||||
|
|||||||
@@ -53,8 +53,14 @@ func (i *createContainerInterceptor) InterceptRequest(r *http.Request) error {
|
|||||||
Log.Infof("Leaving container alone because %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 err := addVolume(hostConfig, i.proxy.weaveWaitVolume, "/w", "ro"); err != nil {
|
if i.proxy.NoMulticastRoute {
|
||||||
return err
|
if err := addVolume(hostConfig, i.proxy.weaveWaitNomcastVolume, "/w", "ro"); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if err := addVolume(hostConfig, i.proxy.weaveWaitVolume, "/w", "ro"); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if err := i.setWeaveWaitEntrypoint(container); err != nil {
|
if err := i.setWeaveWaitEntrypoint(container); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
+16
-8
@@ -60,6 +60,7 @@ type Config struct {
|
|||||||
Version string
|
Version string
|
||||||
WithDNS bool
|
WithDNS bool
|
||||||
WithoutDNS bool
|
WithoutDNS bool
|
||||||
|
NoMulticastRoute bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type wait struct {
|
type wait struct {
|
||||||
@@ -71,13 +72,14 @@ type wait struct {
|
|||||||
type Proxy struct {
|
type Proxy struct {
|
||||||
sync.Mutex
|
sync.Mutex
|
||||||
Config
|
Config
|
||||||
client *docker.Client
|
client *docker.Client
|
||||||
dockerBridgeIP string
|
dockerBridgeIP string
|
||||||
hostnameMatchRegexp *regexp.Regexp
|
hostnameMatchRegexp *regexp.Regexp
|
||||||
weaveWaitVolume string
|
weaveWaitVolume string
|
||||||
weaveWaitNoopVolume string
|
weaveWaitNoopVolume string
|
||||||
normalisedAddrs []string
|
weaveWaitNomcastVolume string
|
||||||
waiters map[*http.Request]*wait
|
normalisedAddrs []string
|
||||||
|
waiters map[*http.Request]*wait
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewProxy(c Config) (*Proxy, error) {
|
func NewProxy(c Config) (*Proxy, error) {
|
||||||
@@ -146,7 +148,10 @@ func (proxy *Proxy) findWeaveWaitVolumes() error {
|
|||||||
if proxy.weaveWaitVolume, err = proxy.findVolume("/w"); err != nil {
|
if proxy.weaveWaitVolume, err = proxy.findVolume("/w"); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
proxy.weaveWaitNoopVolume, err = proxy.findVolume("/w-noop")
|
if proxy.weaveWaitNoopVolume, err = proxy.findVolume("/w-noop"); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
proxy.weaveWaitNomcastVolume, err = proxy.findVolume("/w-nomcast")
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -430,6 +435,9 @@ func (proxy *Proxy) attach(container *docker.Container, orDie bool) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if proxy.NoMulticastRoute {
|
||||||
|
args = append(args, "--no-multicast-route")
|
||||||
|
}
|
||||||
if orDie {
|
if orDie {
|
||||||
args = append(args, "--or-die")
|
args = append(args, "--or-die")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,8 +41,14 @@ func (i *startContainerInterceptor) InterceptRequest(r *http.Request) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if err := addVolume(hostConfig, i.proxy.weaveWaitVolume, "/w", "ro"); err != nil {
|
if i.proxy.NoMulticastRoute {
|
||||||
return err
|
if err := addVolume(hostConfig, i.proxy.weaveWaitNomcastVolume, "/w", "ro"); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if err := addVolume(hostConfig, i.proxy.weaveWaitVolume, "/w", "ro"); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if dnsDomain := i.proxy.getDNSDomain(); dnsDomain != "" {
|
if dnsDomain := i.proxy.getDNSDomain(); dnsDomain != "" {
|
||||||
if err := i.proxy.setWeaveDNS(hostConfig, container.Config.Hostname, dnsDomain); err != nil {
|
if err := i.proxy.setWeaveDNS(hostConfig, container.Config.Hostname, dnsDomain); err != nil {
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ weave launch-router [--password <password>] [--nickname <nickname>]
|
|||||||
[--no-discovery] [--init-peer-count <count>] <peer> ...
|
[--no-discovery] [--init-peer-count <count>] <peer> ...
|
||||||
weave launch-proxy [-H <endpoint>] [--with-dns | --without-dns]
|
weave launch-proxy [-H <endpoint>] [--with-dns | --without-dns]
|
||||||
[--no-default-ipalloc] [--no-rewrite-hosts]
|
[--no-default-ipalloc] [--no-rewrite-hosts]
|
||||||
|
[--no-multicast-route]
|
||||||
[--hostname-from-label <labelkey>]
|
[--hostname-from-label <labelkey>]
|
||||||
[--hostname-match <regexp>]
|
[--hostname-match <regexp>]
|
||||||
[--hostname-replacement <replacement>]
|
[--hostname-replacement <replacement>]
|
||||||
|
|||||||
Reference in new issue
Block a user