Cluster Service Deployment Managers
The call of the newDeploymentManager
function - located in provider/cluster/manager.go
- provokes a deployment specific lifecycle manager.
func newDeploymentManager(s *service, lease mtypes.LeaseID, mgroup *manifest.Group, isNewLease bool) *deploymentManager {
....
dm := &deploymentManager{
bus: s.bus,
client: s.client,
session: s.session,
state: dsDeployActive,
lease: lease,
mgroup: mgroup,
wg: sync.WaitGroup{},
updatech: make(chan *manifest.Group),
teardownch: make(chan struct{}),
log: logger,
lc: lifecycle.New(),
hostnameService: s.HostnameService(),
config: s.config,
serviceShuttingDown: s.lc.ShuttingDown(),
currentHostnames: make(map[string]struct{}),
}
...
go func() {
<-dm.lc.Done()
dm.log.Debug("sending manager into channel")
s.managerch <- dm
}()
err := s.bus.Publish(event.LeaseAddFundsMonitor{LeaseID: lease, IsNewLease: isNewLease})
if err != nil {
s.log.Error("unable to publish LeaseAddFundsMonitor event", "error", err, "lease", lease)
}
return dm
}