Skip to content

refactor: refactor and hardening IO operations#84

Merged
bcho merged 6 commits intomainfrom
hbc/io
Feb 13, 2026
Merged

refactor: refactor and hardening IO operations#84
bcho merged 6 commits intomainfrom
hbc/io

Conversation

@bcho
Copy link
Member

@bcho bcho commented Feb 13, 2026

This pull request refactors the installation logic for several core components (CNI, containerd, Kubernetes binaries, and kubelet) to use new utility functions for file handling and atomic writes, and to streamline the download and extraction of remote tarballs. The changes improve reliability, maintainability, and atomicity of file operations during installation.

Key changes include:

Refactoring file operations and atomic writes:

  • Replaced various manual temp file creation, copying, and permission-setting logic with the new utilio.WriteFile function for writing configuration, service, and kubeconfig files atomically and with correct permissions in kubelet_installer.go and containerd_installer.go. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]

Streamlining remote tarball downloads and extraction:

  • Replaced the previous approach of downloading tarballs to disk and extracting them with system commands by using the new utilio.DecompressTarGzFromRemote function, which streams and extracts files directly from remote sources for CNI, containerd, and Kubernetes binaries. This reduces disk usage and simplifies error handling. [1] [2] [3]

Installer method signature updates:

  • Updated installer methods to accept a context.Context parameter, allowing for better cancellation and timeout handling during installation steps. [1] [2] [3] [4]

Dependency and import changes:

  • Added a dependency on github.com/google/renameio/v2 in go.mod to support atomic file writing, and imported the new utilio package in affected files. [1] [2] [3] [4] [5]

These changes collectively improve robustness and maintainability of the installation process across multiple system components.

@bcho bcho marked this pull request as ready for review February 13, 2026 09:12
@bcho bcho merged commit da8cf89 into main Feb 13, 2026
16 checks passed
@bcho bcho deleted the hbc/io branch February 13, 2026 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants