fix: atomicWriteFile falls back to direct write on bind mounts

Rename fails with EBUSY on Docker bind-mounted files (e.g. controller.yaml).
Fall back to os.WriteFile when os.Rename fails.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-26 14:13:23 +01:00
parent eec1afae23
commit 8f49bcc4cc
2 changed files with 5 additions and 1 deletions
+2 -1
View File
@@ -1032,7 +1032,8 @@ func atomicWriteFile(path string, data []byte, perm os.FileMode) error {
}
if err := os.Rename(tmp, path); err != nil {
os.Remove(tmp)
return err
// Rename fails on bind-mounted files (EBUSY). Fall back to direct write.
return os.WriteFile(path, data, perm)
}
return nil
}