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 <[email protected]>
  • Loading branch information
Iceber authored and klihub committed Jun 4, 2024
1 parent f2e5923 commit 4b3258a
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 @@ -346,12 +346,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 4b3258a

Please sign in to comment.