BT

InfoQ Homepage News Puppet Relay Provides Event-Driven Automation for Common Workflows

Puppet Relay Provides Event-Driven Automation for Common Workflows

This item in japanese

Bookmarks

Puppet has announced the beta release of Relay, their event driven automation platform. Relay allows for automating processes as code. There are a number of pre-written workflows and there is support for creating additional workflows. Relay has a number of integrations available for use in workflows including AWS, Kubernetes, Azure, PagerDuty, and GitHub.

Relay is designed to automate both if-this-then-that style tasks as well as multi-step, branching, parallelized processes. This could be a task such as deleting an unused Azure disk or responding to a PagerDuty alert by creating the necessary tickets in Jira and opening a room in Slack.

Within a workflow there are triggers and steps. Triggers are event handlers that initialize workflow runs. Triggers can be activated manually, on a schedule, or via an external source. Steps are the parts of the automation workflow run by Relay. Parameters and secrets are passed in as part of the step run.

For example, Relay could be used to review EC2 instances and terminate any without a particular tag. In this workflow, any EC2 instance in a given account that is not tagged with a termination date or lifetime after 4 minutes, or has expired or invalid lifetime tags will be terminated. In this case, the workflow could be run on a schedule by setting the following trigger block using the appropriate cron style syntax:

triggers:
- name: schedule
  source:
    type: schedule
    schedule: '0 * * * *'
  binding:
    parameters:
      region: us-east-1
      dryRun: true
      lifetimeTag: lifetime
      terminationDateTag: termination_date

Steps are containers allowing for each step to run in isolation and with flexibility. Any OCI-compliant container can be used. Adding the Relay tools in at build time will provide access to the metadata service. As an alternative, if the task can be written in a shell or Python script, the relaysh/core image could be used. This image is an Alpine-based image that the Relay team maintains and is pre-loaded with the Relay SDK. There are relaysh/core:latest and relaysh/core:latest-python images available.

For example, setting up a step to execute a python script on the relaysh/core image would look like this:

steps:
- name: filter-instances
  image: relaysh/core:latest-python
  spec:
    terminationDateTag: !Parameter terminationDateTag
    lifetimeTag: !Parameter lifetimeTag
    instances: !Output {from: describe-instances, name: instances}
  inputFile: https://raw.githubusercontent.com/puppetlabs/relay-workflows/master/ec2-reaper/filter-instances.py

The spec map defines keys and values that will be available within the step. The Relay !Parameter type allows for looking up the value of a global parameter and provides it to the container. !Secret can be used to access encrypted values. There are also utility functions such as !Merge and !Concat that allow for performing logic within the workflows.

There are a number of pre-made workflows that are available. Puppet is also looking for community contributions to improve Relay and extend with additional integrations. There is also a Slack channel available for further discussions regarding Relay.

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT

Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
Country/Zone:
State/Province/Region:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.