Read our peerName from persistence file if necessary
Mount directories for machine ID files into weave container
This commit is contained in:
1 parent
a26fc67ded
commit
8297652204
2 files changed
+14
-6
No files matched your search
+12
-6
@@ -146,6 +146,7 @@ func main() {
|
||||
dnsConfig dnsConfig
|
||||
trustedSubnetStr string
|
||||
dbPrefix string
|
||||
hostRoot string
|
||||
discoveryEndpoint string
|
||||
token string
|
||||
advertiseAddress string
|
||||
@@ -197,6 +198,7 @@ func main() {
|
||||
mflag.StringVar(&trustedSubnetStr, []string{"-trusted-subnets"}, "", "comma-separated list of trusted subnets in CIDR notation")
|
||||
mflag.StringVar(&dbPrefix, []string{"-db-prefix"}, "/weavedb/weave", "pathname/prefix of filename to store data")
|
||||
mflag.BoolVar(&bridgeConfig.IsAWSVPC, []string{"-awsvpc"}, false, "use AWS VPC for routing")
|
||||
mflag.StringVar(&hostRoot, []string{"-host-root"}, "", "path to reach host filesystem")
|
||||
mflag.StringVar(&discoveryEndpoint, []string{"-peer-discovery-url"}, "https://cloud.weave.works/api/net", "url for peer discovery")
|
||||
mflag.StringVar(&token, []string{"-token"}, "", "token for peer discovery")
|
||||
mflag.StringVar(&advertiseAddress, []string{"-advertise-address"}, "", "address to advertise for peer discovery")
|
||||
@@ -250,6 +252,10 @@ func main() {
|
||||
Log.Errorf("While checking address assignment type of %s: %s", bridgeConfig.DockerBridgeName, err)
|
||||
}
|
||||
}
|
||||
|
||||
name := peerName(routerName, dbPrefix, hostRoot)
|
||||
|
||||
bridgeConfig.Mac = name.String()
|
||||
bridgeType, err := weavenet.CreateBridge(&bridgeConfig)
|
||||
checkFatal(err)
|
||||
Log.Println("Bridge type is", bridgeType)
|
||||
@@ -265,8 +271,6 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
name := peerName(routerName)
|
||||
|
||||
if nickName == "" {
|
||||
var err error
|
||||
nickName, err = os.Hostname()
|
||||
@@ -586,13 +590,15 @@ func determinePassword(password string) []byte {
|
||||
return []byte(password)
|
||||
}
|
||||
|
||||
func peerName(routerName string) mesh.PeerName {
|
||||
func peerName(routerName, dbPrefix, hostRoot string) mesh.PeerName {
|
||||
if routerName == "" {
|
||||
iface, err := net.InterfaceByName(weavenet.WeaveBridgeName)
|
||||
if err != nil {
|
||||
Log.Fatalf("Unable to find bridge %q", weavenet.WeaveBridgeName)
|
||||
if err == nil {
|
||||
routerName = iface.HardwareAddr.String()
|
||||
} else {
|
||||
routerName, err = weavenet.GetSystemPeerName(dbPrefix, hostRoot)
|
||||
checkFatal(err)
|
||||
}
|
||||
routerName = iface.HardwareAddr.String()
|
||||
}
|
||||
name, err := mesh.PeerNameFromUserInput(routerName)
|
||||
checkFatal(err)
|
||||
|
||||
@@ -1399,10 +1399,12 @@ launch_router() {
|
||||
--volumes-from $DB_CONTAINER_NAME \
|
||||
-v $RESOLV_CONF_DIR:/var/run/weave/etc \
|
||||
-v /run/docker/plugins:/run/docker/plugins \
|
||||
-v /etc:/host/etc -v /var/lib/dbus:/host/var/lib/dbus \
|
||||
-e WEAVE_PASSWORD \
|
||||
-e CHECKPOINT_DISABLE \
|
||||
$WEAVE_DOCKER_ARGS $IMAGE $COVERAGE_ARGS \
|
||||
--port $CONTAINER_PORT --nickname "$(hostname)" \
|
||||
--host-root=/host \
|
||||
$(router_bridge_opts) \
|
||||
--ipalloc-range "$IPRANGE" \
|
||||
--dns-effective-listen-address $DOCKER_BRIDGE_IP \
|
||||
|
||||
Reference in new issue
Block a user