|
|
|
@ -24,11 +24,12 @@ type NodeGroup struct {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type Node struct {
|
|
|
|
|
Name string
|
|
|
|
|
Endpoint string
|
|
|
|
|
Platforms []specs.Platform
|
|
|
|
|
Flags []string
|
|
|
|
|
DriverOpts map[string]string
|
|
|
|
|
Name string
|
|
|
|
|
Endpoint string
|
|
|
|
|
Platforms []specs.Platform
|
|
|
|
|
Flags []string
|
|
|
|
|
DriverOpts map[string]string
|
|
|
|
|
SecurityOpts map[string]string
|
|
|
|
|
|
|
|
|
|
Files map[string][]byte
|
|
|
|
|
}
|
|
|
|
@ -48,7 +49,7 @@ func (ng *NodeGroup) Leave(name string) error {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (ng *NodeGroup) Update(name, endpoint string, platforms []string, endpointsSet bool, actionAppend bool, flags []string, configFile string, do map[string]string) error {
|
|
|
|
|
func (ng *NodeGroup) Update(name, endpoint string, platforms []string, endpointsSet bool, actionAppend bool, flags []string, configFile string, do map[string]string, so map[string]string) error {
|
|
|
|
|
if ng.Dynamic {
|
|
|
|
|
return errors.New("dynamic node group does not support Update")
|
|
|
|
|
}
|
|
|
|
@ -91,6 +92,10 @@ func (ng *NodeGroup) Update(name, endpoint string, platforms []string, endpoints
|
|
|
|
|
n.DriverOpts = do
|
|
|
|
|
needsRestart = true
|
|
|
|
|
}
|
|
|
|
|
if so != nil {
|
|
|
|
|
n.SecurityOpts = so
|
|
|
|
|
needsRestart = true
|
|
|
|
|
}
|
|
|
|
|
if configFile != "" {
|
|
|
|
|
for k, v := range files {
|
|
|
|
|
n.Files[k] = v
|
|
|
|
@ -118,12 +123,13 @@ func (ng *NodeGroup) Update(name, endpoint string, platforms []string, endpoints
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
n := Node{
|
|
|
|
|
Name: name,
|
|
|
|
|
Endpoint: endpoint,
|
|
|
|
|
Platforms: pp,
|
|
|
|
|
Flags: flags,
|
|
|
|
|
DriverOpts: do,
|
|
|
|
|
Files: files,
|
|
|
|
|
Name: name,
|
|
|
|
|
Endpoint: endpoint,
|
|
|
|
|
Platforms: pp,
|
|
|
|
|
Flags: flags,
|
|
|
|
|
DriverOpts: do,
|
|
|
|
|
SecurityOpts: so,
|
|
|
|
|
Files: files,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ng.Nodes = append(ng.Nodes, n)
|
|
|
|
@ -156,6 +162,10 @@ func (n *Node) Copy() *Node {
|
|
|
|
|
for k, v := range n.DriverOpts {
|
|
|
|
|
driverOpts[k] = v
|
|
|
|
|
}
|
|
|
|
|
securityOpts := map[string]string{}
|
|
|
|
|
for k, v := range n.SecurityOpts {
|
|
|
|
|
securityOpts[k] = v
|
|
|
|
|
}
|
|
|
|
|
files := map[string][]byte{}
|
|
|
|
|
for k, v := range n.Files {
|
|
|
|
|
vv := []byte{}
|
|
|
|
@ -163,12 +173,13 @@ func (n *Node) Copy() *Node {
|
|
|
|
|
files[k] = vv
|
|
|
|
|
}
|
|
|
|
|
return &Node{
|
|
|
|
|
Name: n.Name,
|
|
|
|
|
Endpoint: n.Endpoint,
|
|
|
|
|
Platforms: platforms,
|
|
|
|
|
Flags: flags,
|
|
|
|
|
DriverOpts: driverOpts,
|
|
|
|
|
Files: files,
|
|
|
|
|
Name: n.Name,
|
|
|
|
|
Endpoint: n.Endpoint,
|
|
|
|
|
Platforms: platforms,
|
|
|
|
|
Flags: flags,
|
|
|
|
|
DriverOpts: driverOpts,
|
|
|
|
|
SecurityOpts: securityOpts,
|
|
|
|
|
Files: files,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|