Clusterfuck
Clusterfuck is a library for setting up a networked cluster of servers to test failure conditions against. It's a library to fuck with clusters.
Currently it ships with a DSL for EBGP leaf-spine architectures, but has a generic backend that allows configuring any topology.
It's currently using Virtualbox for probably no good reason other than
network_lab
, which this works derives from, used it. VMWare will be
investigated in the future.
Usage
Install the vagrant-clusterfuck
Vagrant plugin:
$ vagrant plugin install vagrant-clusterfuck
Create a cluster.rb
file to define your cluster (see below). This must be a separate file,
because it needs to be loaded in your test environment which does not implement
the Vagrant DSL.
In your Vagrantfile
, build your cluster:
cluster = Clusterfuck::Cluster[:test]
cluster[:host1].build(config) do |box|
box.vm.provision :shell, inline: "echo 1 > /tmp/test"
end
cluster[:host2].build(config)
For a complete example, see the Vagrantfile
and cluster.rb
in this
repository.
$ vagrant up --provider virtualbox
When making changes to cluster.rb
and Vagrantfile
make sure to reload and
reprovision the cluster:
$ vagrant reload --provision
Building Clusters
Defining a cluster consists of two steps:
- Creating instances. You must specify which VMs your topology requires.
- Layer 2 network. You must specify the relationships between the VMs, that is, the layer 2 network of which nodes belong to the same subnets and can thus directly communicate with each other.
Please see ./cluster.rb
for an annotated example. In the future we may build
DSLs on top of the low-level graph DSL.