Skip to content

Commit 59a3a10

Browse files
authored
Merge pull request #66 from plumgrid/metadata_option
Add metaconfig flag
2 parents b283012 + 00a66d4 commit 59a3a10

3 files changed

Lines changed: 17 additions & 8 deletions

File tree

config.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@ default_domain = default_domain
1010
scope = local
1111
# enable arping on container IFup
1212
auto_arp
13+
14+
# Automatic container tracking for docker
15+
push_metaconfig

plugin/driver/config.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,13 @@ import (
2121
)
2222

2323
var (
24-
vip string
25-
username string
26-
password string
27-
default_vd string
28-
scope string
29-
auto_arp bool = false
24+
vip string
25+
username string
26+
password string
27+
default_vd string
28+
scope string
29+
auto_arp bool = false
30+
push_metaconfig bool = false
3031
)
3132

3233
// Read configuration file
@@ -55,5 +56,6 @@ func ReadConfig() {
5556
} else {
5657
scope = lib_section.ValueOf("scope")
5758
auto_arp = lib_section.Exists("auto_arp")
59+
push_metaconfig = lib_section.Exists("push_metaconfig")
5860
}
5961
}

plugin/driver/driver.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,9 @@ func (driver *driver) joinEndpoint(w http.ResponseWriter, r *http.Request) {
345345
Gateway: gatewayIP,
346346
}
347347

348-
AddMetaconfig(domainid, bridgeID, j.SandboxKey[22:], endID, mac)
348+
if push_metaconfig {
349+
AddMetaconfig(domainid, bridgeID, j.SandboxKey[22:], endID, mac)
350+
}
349351

350352
objectResponse(w, res)
351353
Log.Infof("Join endpoint %s:%s to %s", j.NetworkID, j.EndpointID, j.SandboxKey)
@@ -419,7 +421,9 @@ func (driver *driver) leaveEndpoint(w http.ResponseWriter, r *http.Request) {
419421
errorResponse(w, "Unable to off-board container from PLUMgrid")
420422
}
421423

422-
RemoveMetaconfig(domainid, bridgeID, l.EndpointID)
424+
if push_metaconfig {
425+
RemoveMetaconfig(domainid, bridgeID, l.EndpointID)
426+
}
423427

424428
emptyResponse(w)
425429
Log.Infof("Leave %s:%s", l.NetworkID, l.EndpointID)

0 commit comments

Comments
 (0)