Skip to content

Commit

Permalink
sync sandboxes and containers after starting the pre-installed plugins
Browse files Browse the repository at this point in the history
Signed-off-by: Iceber Gu <wei.cai-nat@daocloud.io>
  • Loading branch information
Iceber committed May 18, 2023
1 parent 2a8b655 commit 6f7af44
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion pkg/adaptation/adaptation.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,12 +334,26 @@ func (r *Adaptation) startPlugins() (retErr error) {
}

if err := p.start(r.name, r.version); err != nil {
return err
return fmt.Errorf("failed to start NRI Plugin %q: %w", name, err)
}

plugins = append(plugins, p)
}

syncPlugins := func(ctx context.Context, sandboxes []*PodSandbox, containers []*Container) (updates []*ContainerUpdate, _ error) {
for _, plugin := range plugins {
us, err := plugin.synchronize(ctx, sandboxes, containers)
if err != nil {
return nil, fmt.Errorf("failed to sync NRI Plugin %q: %w", plugin.name(), err)
}
updates = append(updates, us...)
}
return
}
if err := r.syncFn(noCtx, syncPlugins); err != nil {
return fmt.Errorf("failed to synchronize NRI Plugins: %w", err)
}

r.plugins = plugins
r.sortPlugins()

Expand Down

0 comments on commit 6f7af44

Please sign in to comment.