harmony/adr/001-rust.md

51 lines
3.1 KiB
Markdown

# Architecture Decision Record: Use of Rust as Primary Programming Language
Proposed by : Jean-Gabriel Gill-Couture
Date : September 1st 2024
## Status
Proposed
## Context
We are developing an infrastructure orchestrator aimed at provisioning production-grade Kubernetes clusters on bare metal. This involves complex operations such as network setup, hardware inventory management, and cluster bootstrapping. The choice of programming language is crucial for the project's success.
## Decision
We have decided to use Rust as the primary programming language for this project.
## Rationale
1. Team Expertise: Our team has the highest proficiency in Rust compared to other languages.
2. Developer Experience: Rust's tooling ecosystem provides an excellent developer experience, which can significantly enhance productivity.
3. Industry Trend: Rust is gaining rapid adoption and endorsement from major entities such as the US government and Microsoft, particularly for low-level system work.
4. Performance and Safety: Rust offers a unique combination of performance and memory safety, which is crucial for system-level programming.
5. Flexibility: While some libraries (e.g., for IPMI) may not be available in Rust, we can easily interface with small programs written in Go or Python without significant productivity loss.
## Consequences
Positive:
- High performance and memory safety in our core system.
- Improved developer productivity due to team expertise and good tooling.
- Future-proofing our technology stack by using a rising language in the industry.
Negative:
- May need to write bindings or interfaces for some hardware management libraries not available in Rust.
- Potential learning curve for new team members not familiar with Rust.
## Alternatives Considered
- Go: Good for systems programming but less familiar to our team.
- Python: Excellent library support but less suitable for low-level system work.
- C++: Powerful but lacks the memory safety guarantees of Rust.
## Author notes
I was previously digging into various libraries for low-level management to help me decide which language and tech stack to choose. When testing with Rust, it was obvious that the ecosystem is not very mature but also clear to me that it feels much more like the program I am trying to build which is fast, robust and easy to use. For example, the redfish library worked, was able to connect to my various hosts but failed to deserialize the returning payload. This is the kind of problem I would likely not be facing with Go or Python, but down the road when it inevitably happens, Rust makes it so much easier to understand, fix and create a robust solution for it.
All in all, I settled down on Rust because :
- I know it best
- The tools provide a great DX
- The language is rapidly rising and gaining endorsement from major entities such as US government, Google, Facebook, Microsoft and many others for low level work
- The missing libraries for IPMI and such are not that big of a deal : we can always write small programs in go or python that expose an api and interact with them from my Rust program without loosing too much productivity