Categorygithub.com/jgraettinger/urkel
modulepackage
0.1.2
Repository: https://github.com/jgraettinger/urkel.git
Documentation: pkg.go.dev

# README

Urkel

Urkel is a gRPC service and client for the injection of controlled infrastructure failures within a Kubernetes envrionment.

An urkel server runs as a priviledged DaemonSet across all Kubernetes nodes. Or, if running MicroK8s, running urkel on the host outside of Kubernetes is sufficient. urkel uses its priviledge to run commands within the networking namespace of Pod containers running on that same node.

Faults are initiated on behalf of a client gRPC stream which specifies faults to install, and are kept alive so long as the gRPC client stream is still active, after which faults are fully unwound. This design gives clients precise control over a set of faults applied across an entire Kubernetes cluster, while ensuring faults are removed when clients exit (or crash). This model is well suited for crafting "chaos" tests implemented as, for example, regular test cases of the go test tool.

On the client side, the urkel package performs configuration of a Kubernetes client, provides helpers to identify sets of Pods to place under test, and includes urkel.FaultSet for dispatching faults to appropriate urkel servers within the cluster.

Example

By way of example, this Go test partitions members of an Etcd cluster in half, leaves the partition in place for a minute, and then exits.

func TestPartitionWithinEtcdCluster(t *testing.T) {
	var pods = urkel.FetchPods(t, "default", "app=etcd")

	var fs = urkel.NewFaultSet(t)
	defer fs.RemoveAll()

	fs.Partition(pods[:len(pods)/2], pods[len(pods)/2:], drop)
	time.Sleep(time.Minute)
}

# Packages

No description provided by the author

# Functions

FetchPods from Kubernetes using the given namespace and ListOptions.
No description provided by the author
NewFaultSet returns an empty FaultSet.
No description provided by the author

# Variables

No description provided by the author
No description provided by the author

# Structs

Fault is a union type indicating the variety of Fault to be applied.
FaultSet dispatches a set of removable faults to apply to a collection of Pods.
Partition traffic flows of a specific interface from a source IP range, using the given mode (either REJECT or DROP).

# Interfaces

No description provided by the author
No description provided by the author
ChaosClient is the client API for Chaos service.
ChaosServer is the server API for Chaos service.

# Type aliases

PartitionMode to use with `iptables` command; REJECT or DROP.