cloudfoundry/bbl-state-resource

Name: bbl-state-resource

Owner: Cloud Foundry

Description: a concourse resource for manipulating bbl states

Created: 2018-02-16 00:55:22.0

Updated: 2018-05-13 03:59:20.0

Pushed: 2018-04-09 21:19:46.0

Homepage:

Size: 5089

Language: Go

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

the bbl state dir concourse resource

This is a concourse resource for provisioning bosh directors and using bbl to manipulate cloud-stored bbl-states.

It's built to play nice with bosh-deployment-resource and pool-resource.

to bring this in to your concourse pipeline:

urce_types:
me: bbl-state-resource
pe: docker-image
urce:
repository: cfinfrastructure/bbl-state-resource
Source Configuration
Example:
urces:
me: bbl-state
pe: bbl-state-resource
urce:
bucket: bbl-state
iaas: gcp
gcp_region: us-east-1
gcp_service_account_key: {{bbl_gcp_service_account_key}}
Parameters:

bucket: required: the name of the bucket where you'd like your state-dir tarballs to be stored.

iaas: required: gcp, for now, but we'll take aws soon. This is the iaas where you want your new bosh directors.

lb_type: optional: cf or concourse, denotes the varietals of the load balancers you'd like to deploy with your director

lb_domain: optional: for cf, the system domain, for concourse, the web domain. NOTE: randomly named bosh directors will share a single domain at the moment and that will not go well. these features don't mix.

gcp_service_account_key: required: your gcp service account key, formatted as JSON.

gcp_region: required: the gcp region where you'd like your environments.

Behaviour
put: Deploy, upgrade, and destroy BOSH directors and its containing environment

There are two primary modes of operation for bbl-state puts:

  1. By default, without a name configured, we'll generate random environment names for each put: { command: up }.
  2. If you've configured a name, name_file, or a state_dir, the resource will manipulate that environment.
Examples:
:
me: bbl-up-a-specifically-named-environment
an:
put: bbl-state
params:
  command: up
  name: my-lonely-bosh-director

me: bbl-up-a-randomly-named-environment
an:
put: bbl-state
params:
  command: up

me: bbl-update-that-randomly-named-env
an:
get: bbl-state
passed: [bbl-up-a-randomly-named-environment]
put: bbl-state
params:
  command: up
  name_file: bbl-state/name

me: bbl-delete-that-env-you-just-updated
an:
get: bbl-state-resource
passed: [bbl-update-that-env-from-before]
put: bbl-state
params:
  command: down
  state_dir: bbl-state
Parameters:

command: required: up, down, destroy, rotate, or cleanup-leftovers. Any top-level command available to bbl.

args: optional: a yaml hash containing additional flags as key-value pairs. these might be load balancer options or filter: env-name for leftovers. note that these use dashes, not underscores.

name: optional: the name of the environment you'd like to manipulate. overrides name_file and state_dir.

name_file: optional: a file you'd like to load name from, useful if you're manipulating an env stored in a pool-resource. overrides state_dir.

state_dir: optional: an already-fetched bbl state directory containing the state for the environment you'd like to manipulate.

get: Download bbl states

gets download bbl-states, directories generated by bbl that contain information about a BOSH director and its associated iaas environment.

Examples:
:
me: get-from-previous-put-and-add-it-to-a-pool
an:
get: bbl-state
trigger: true
passed: [bbl-up-a-randomly-named-environment]
put: concourse-pool-of-bbl-states
params:
  add: bbl-state

me: delete-a-random-unclaimed-env-nightly
an:
get: time-resource-nightly
trigger: true
put: lock
resource: concourse-pool-of-bbl-states
params:
  acquire: true
put: bbl-state
params:
  name_file: lock/name
  command: down
on_success:
  put: lock
  resource: concourse-pool-of-bbl-states
  params:
    remove: lock
Parameters:

none! names, checksums, and timestamps are encoded in our concourse versions, so we've got to fetch those specific ones.

note: gets don't have access to the file system for dynamic configuration, anyways, so name_files and state_dirs can't be reached. If you want to get a specific state-dir, you'll have to use concourse primitives like passed to filter things down or do a put with a noop-ish bbl command like env-id.

Special outputs that you wouldn't find in a normal bbl-state include:

  1. bbl-state/name, which contains the environment name
  2. bbl-state/metadata, which is useful for plugging in to concourse/pool-resource

TODO: additionally format target-dir/bdr-source-configuration + metadata for use by bosh-deployment-resource, and document.

Development:

things happen via the Makefile:

make help


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.