cleanup plugin subprocesses on server exit
Signed-off-by: Steve Kriss <steve@heptio.com>pull/483/head
parent
09c20b51e6
commit
20f56e9868
|
@ -224,6 +224,9 @@ func newServer(namespace, baseName, pluginDir string, logger *logrus.Logger) (*s
|
|||
}
|
||||
|
||||
func (s *server) run() error {
|
||||
defer s.pluginManager.CleanupClients()
|
||||
s.handleShutdownSignals()
|
||||
|
||||
if err := s.ensureArkNamespace(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -240,8 +243,6 @@ func (s *server) run() error {
|
|||
|
||||
s.watchConfig(originalConfig)
|
||||
|
||||
s.handleShutdownSignals()
|
||||
|
||||
if err := s.initBackupService(config); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -415,3 +415,9 @@ func (_m *MockManager) GetObjectStore(name string) (cloudprovider.ObjectStore, e
|
|||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// CleanupClients provides a mock function
|
||||
func (_m *MockManager) CleanupClients() {
|
||||
_ = _m.Called()
|
||||
return
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@ func baseConfig() *plugin.ClientConfig {
|
|||
return &plugin.ClientConfig{
|
||||
HandshakeConfig: Handshake,
|
||||
AllowedProtocols: []plugin.Protocol{plugin.ProtocolGRPC},
|
||||
Managed: true,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -123,6 +124,9 @@ type Manager interface {
|
|||
// CloseRestoreItemActions terminates the plugin sub-processes that
|
||||
// are hosting RestoreItemAction plugins for the given restore name.
|
||||
CloseRestoreItemActions(restoreName string) error
|
||||
|
||||
// CleanupClients kills all plugin subprocesses.
|
||||
CleanupClients()
|
||||
}
|
||||
|
||||
type manager struct {
|
||||
|
@ -411,3 +415,7 @@ func closeAll(store *clientStore, kind PluginKind, scope string) error {
|
|||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *manager) CleanupClients() {
|
||||
plugin.CleanupClients()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue