Skip to content

Commit 8f3900c

Browse files
authored
Merge pull request #5601 from twz123/win-containerd-exe-replacement
Ignore replacement errors for containerd executables on Windows
2 parents ca34e25 + d36bcb6 commit 8f3900c

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

pkg/component/worker/containerd/component.go

+12-2
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,19 @@ var _ manager.Component = (*Component)(nil)
9999
func (c *Component) Init(ctx context.Context) error {
100100
g, _ := errgroup.WithContext(ctx)
101101
for _, bin := range c.binaries {
102-
b := bin
103102
g.Go(func() error {
104-
return assets.Stage(c.K0sVars.BinDir, b, constant.BinDirMode)
103+
err := assets.Stage(c.K0sVars.BinDir, bin, constant.BinDirMode)
104+
// Simply ignore the "running executable" problem on Windows for
105+
// now. Whenever there's a permission error on Windows and the
106+
// target file exists, log the error and continue.
107+
if err != nil &&
108+
runtime.GOOS == "windows" &&
109+
errors.Is(err, os.ErrPermission) &&
110+
file.Exists(filepath.Join(c.K0sVars.BinDir, bin)) {
111+
logrus.WithField("component", "containerd").WithError(err).Error("Failed to replace ", bin)
112+
return nil
113+
}
114+
return err
105115
})
106116
}
107117
if err := g.Wait(); err != nil {

0 commit comments

Comments
 (0)