-
Notifications
You must be signed in to change notification settings - Fork 381
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve k0s-managed containerd config detection
The previous detection method was to read the whole file and search each line for the magic string "# k0s_managed=true". This seems excessive and unexpected, as it will catch any substring, even if it is not at the beginning of the file, the start of a line, or even inside a comment. It would even have caught this as part of a TOML string value. Change this behavior by expecting the first line of the file to be exactly this magic string. All files generated by k0s will have exactly that first line. Also return any previously swallowed errors back to the caller. Add more test cases to ensure that the generated default config is recognized as being managed by k0s, and that a file not starting with the magic line is recognized as not being managed by k0s. Signed-off-by: Tom Wieczorek <[email protected]>
- Loading branch information
Showing
2 changed files
with
42 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters