cri,nri: block NRI plugin sync. during event processing.
Block the synchronization of registering NRI plugins during CRI events to avoid the plugin ending up in an inconsistent starting state after initial sync (missing pods, containers or missed events for some pods or containers). Signed-off-by: Krisztian Litkey <krisztian.litkey@intel.com>
This commit is contained in:
@@ -81,6 +81,9 @@ type API interface {
|
||||
|
||||
// RemoveContainer relays container removal events to NRI.
|
||||
RemoveContainer(context.Context, PodSandbox, Container) error
|
||||
|
||||
// BlockPluginSync blocks plugin synchronization until it is Unblock()ed.
|
||||
BlockPluginSync() *PluginSyncBlock
|
||||
}
|
||||
|
||||
type State int
|
||||
@@ -435,6 +438,15 @@ func (l *local) RemoveContainer(ctx context.Context, pod PodSandbox, ctr Contain
|
||||
return err
|
||||
}
|
||||
|
||||
type PluginSyncBlock = nri.PluginSyncBlock
|
||||
|
||||
func (l *local) BlockPluginSync() *PluginSyncBlock {
|
||||
if !l.IsEnabled() {
|
||||
return nil
|
||||
}
|
||||
return l.nri.BlockPluginSync()
|
||||
}
|
||||
|
||||
func (l *local) syncPlugin(ctx context.Context, syncFn nri.SyncCB) error {
|
||||
l.Lock()
|
||||
defer l.Unlock()
|
||||
|
||||
Reference in New Issue
Block a user