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 75ad210
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion pkg/adaptation/adaptation.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,12 +334,27 @@ 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, pods []*PodSandbox, containers []*Container) ([]*ContainerUpdate, error) {
var updates []*ContainerUpdate
for _, plugin := range plugins {
us, err := plugin.synchronize(ctx, pods, containers)
if err != nil {
return nil, fmt.Errorf("failed to sync NRI Plugin %q: %w", plugin.name(), err)
}
updates = append(updates, us...)
}
return updates, nil
}
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 75ad210

Please sign in to comment.