ec1

module
v0.0.0-...-b9dfbaf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 4, 2025 License: Apache-2.0

README

EC1: A CloudStack Alternative in Go

EC1 is a lightweight, Go-based alternative to Apache CloudStack – providing VM and network orchestration without the legacy bloat. It uses modern Go libraries, ConnectRPC (a gRPC + Protocol Buffers framework), and simple Go services for a lean cloud management experience.

Overview

This project is a proof-of-concept (POC) demonstrating that we can manage virtual machines (including nested VMs and networking) with minimal complexity using modern Go libraries.

Architecture:

  • Management Server: Central orchestration component that manages VM lifecycle across hosts
  • Agent: Runs on each host to execute VM operations using the local hypervisor
  • Hypervisors: Support for Apple Virtualization.framework (macOS) and KVM (Linux)

Features

  • Multi-host VM orchestration with nested virtualization
  • Support for different hypervisors (macOS virtualization and KVM)
  • Networking with port forwarding
  • Simple API based on ConnectRPC (gRPC)
  • Complete infrastructure as code, written in Go

Demo

The demo showcases a full end-to-end nested virtualization flow:

  1. Start a Management Server on macOS
  2. Start a local Agent on macOS
  3. Create a QCOW2 image for a Linux VM
  4. Start a Linux VM on macOS using Apple's Virtualization.framework
  5. Set up an EC1 Agent inside the Linux VM
  6. Use the Linux Agent to start a nested VM
  7. Run a web server in the nested VM
  8. Access the web server from the host
Running the Demo

Prerequisites:

  • macOS (with support for Virtualization.framework)
  • Go 1.21 or later
  • QEMU and related tools (brew install qemu)

To run the full demo:

# Run the complete demo
./go run ./cmd/demo --action demo

# To clean up previous runs
./go run ./cmd/demo --action demo --clean

# To run individual steps
./go run ./cmd/demo --action start-mgt
./go run ./cmd/demo --action start-agent
./go run ./cmd/demo --action create-image
./go run ./cmd/demo --action start-linux-vm --disk images/alpine.qcow2
./go run ./cmd/demo --action start-nested-vm

Project Structure

  • cmd/: Command line tools
    • demo/: Demo steps and entry point
    • mgt/: Management server
    • agent/: Agent implementation
  • pkg/: Core packages
    • hypervisor/: Hypervisor implementations (Apple, KVM)
    • management/: Management server implementation
    • agent/: Agent service implementation
  • proto/: Protocol Buffer definitions
  • gen/: Generated code from Protocol Buffers

Development

This project is developed as a proof-of-concept to demonstrate cloud management capabilities with Go. It is not intended for production use at this stage but provides a foundation for a more complete implementation.

License

See LICENSE file.

Directories

Path Synopsis
cmd
harpoond command
manifest-prune command
gen
proto/golang/harpoon/v1
Code generated by protoc-gen-go-ttrpc.
Code generated by protoc-gen-go-ttrpc.
pkg
ext/iox
Package iox provides IO utilities.
Package iox provides IO utilities.
libkrun/example command
oci
streamexec/executor
Package executor defines interfaces and implementations for command execution
Package executor defines interfaces and implementations for command execution
streamexec/protocol
Package protocol defines interfaces and implementations for command streaming protocols
Package protocol defines interfaces and implementations for command streaming protocols
streamexec/transport
Package transport defines interfaces and implementations for communication transports
Package transport defines interfaces and implementations for communication transports
vmm
vmm/vf
Package vf converts a config.VirtualMachine configuration to native virtualization framework datatypes.
Package vf converts a config.VirtualMachine configuration to native virtualization framework datatypes.
vmnet
package vment provides the helper process connecting virtual machines to the vmnet network.
package vment provides the helper process connecting virtual machines to the vmnet network.
tools module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL