Skip to content

Refactor user data bootstrapping logic for Flex#26

Merged
anson627 merged 2 commits into
mainfrom
hbc/flex-new-version
Mar 3, 2026
Merged

Refactor user data bootstrapping logic for Flex#26
anson627 merged 2 commits into
mainfrom
hbc/flex-new-version

Conversation

@bcho
Copy link
Copy Markdown
Member

@bcho bcho commented Mar 3, 2026

This pull request introduces a major refactor and feature expansion to the Flex node bootstrap configuration, focusing on making the user data generation more flexible, robust, and testable. The key improvements include the adoption of a functional options pattern for configuration, support for multiple CPU architectures, improved validation, and enhanced test coverage.

User Data Generation Refactor and Flexibility

  • Refactored the flex.UserData API to use a functional options pattern, allowing callers to specify options like GPU support, Kubernetes version, architecture, and kubeadm config in a more extensible and readable way. This replaces the previous positional-argument approach and makes the API easier to extend in the future. [1] [2]
  • Added input validation for supported architectures (amd64, arm64) and non-empty Kubernetes versions, with clear error messages for invalid inputs.
  • Updated all call sites to use the new options-based API, improving clarity and maintainability. [1] [2] [3]

Multi-Architecture and Bootstrap Improvements

  • Added a new flag (--arch) to the CLI for specifying the CPU architecture, defaulting to amd64. The generated bootstrap script and binary download URLs now dynamically use the selected architecture, enabling support for both amd64 and arm64 nodes. [1] [2] [3]
  • The bootstrap script is now generated from a Go template, making it easier to maintain and extend for different architectures and versions. [1] [2] [3]

Testing and Validation Enhancements

  • Added comprehensive unit tests for the new UserData options, covering default behavior, architecture selection, invalid inputs, and Kubernetes version handling. This ensures correctness and prevents regressions.

These changes collectively improve the flexibility, safety, and maintainability of Flex node bootstrapping, and lay the groundwork for future enhancements.

References:
[1] [2] [3] [4] [5] [6] [7] [8]

@anson627 anson627 merged commit 1c79809 into main Mar 3, 2026
9 checks passed
@bcho bcho deleted the hbc/flex-new-version branch March 4, 2026 18:22
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