Microsoft Launches Brigade: An Event-Driven Scripting Tool for Kubernetes
Microsoft has been working hard to ensure that these days, when developers and engineers lift up their gaze unto the cloud native heavens, the sky they see is Azure.
To this end, Microsoft has been populating the container space with open source tools that make containerized workloads faster to adopt, easier to use — and, increasingly, reliably automated. So far, 2017 has seen Microsoft acquire Deis, which developed Helm. Helm is a package manager to install and manage the lifecycle of Kubernetes applications, as well as an efficient tool for finding, using and sharing K8s tools and software. The company also introduced Draft, a tool for streamlining application development and deployment by monitoring the live-code, pre-commit “inner loop” of the developer’s workflow to detect the application language and write a simple Dockerfile and Helm chart into the source tree.
Using Kubernetes, Brigade makes it easy to build applications by chaining together containers.
Now the same team has introduced Brigade, a framework for scripting together workflow tasks to be executed inside of containers. The Kubernetes-native tool allows devs to build an ordered workflow of K8s containers in any magnitude, from one to multitudes, that then idles while listening for arbitrary trigger events. When triggered, Brigade comes charging in.
In other words, Brigade functions as a structured pipeline where users define a sequence of tasks, which Brigade then runs as specified to completion whenever a designated trigger event occurs.
At a glance, Brigade:
- is Kubernetes-native, with one-line installation.
- Supports projects and a customizable event model.
- Enables arbitrarily complex (parallel or synchronous) pipelines.
- Executes functions in containers.
- Fully supports Kubernetes volumes, pods, role-based access control (RBAC), and secrets.
Containers to the left of them, Containers to the right of them, boldly they ride and well…
At the simplest level, Brigade listens for a trigger and then emits an event. Whichever scripts have been registered to handle that event are then executed inside a Kubernetes cluster. The tool is fully customizable — with “Just a little bit of coding”, according to the release announcement — but conveniently ships with a library of predefined events for common scenarios such as handling GitHub and DockerHub webhooks.
Large-scale libraries, however, are something the builders of Brigade avoided by design. Their ingenious approach, inspired by shell scripts, is to chain containers into scripts for Kubernetes: instead of accessing modules from a built-in library, Brigade uses containers themselves as the building blocks for scripting and then executing an event-driven task. According to Microsoft, this means a serious power up for the Kubernetes platform by making it easy to build applications by chaining together containers.
Theirs not to reason why, theirs but to do or die…
A Brigade-handled event begins by creating one, or many, “Jobs.” (“Jobs” are Brigade’s terminology for a single step or task in the user-defined process). A Brigade script can execute any number of jobs in parallel (the default) or a defined sequence. The “chaining” aspect means that the output returned by any one job can be captured, modified, and passed into another job.
Here is a simple script demonstrating how Brigade loads a basic Linux container and executes a command within it:
A new job is created, starting with the off-the-shelf Alpine Linux 3.5 Docker container, and then a simple echo command runs inside the container.
Still using simple containers, but this time with some workflow, take a look at:
The script declares three jobs — hello, goodbye, and helloAgain. It then creates a pipeline that executes by running hello and goodbye in parallel and then, when those complete, running helloAgain. It’s a very simple example but demonstrates how direct and simple it is to construct a workflow pipeline in Brigade.
The early days of container technology focused on scaling and managing long-running services. With Brigade, short-term tasks such as batch processing, code quality testing and event-driven program flow now get the container treatment too.
Read you some poetry: The Charge of the Light Brigade, by Alfred, Lord Tennyson.