Skip to content

Latest commit

 

History

History
140 lines (114 loc) · 4.49 KB

v2.md

File metadata and controls

140 lines (114 loc) · 4.49 KB

Schema v2

Schema v2 currently supports the following object types:

endpoint_map

An endpoint map defines conversions to be run against deployment endpoint URLs returned by Compose.io. An enterprise Compose cluster may be configured to only return an endpoint that requires VPN access even though the deployment itself has a public-facing endpoint, and you can use an endpoint map to translate from one to the other.

Format

config_version: 2
object_type: endpoint_map
endpoint_map:
  {{.KEY_ONE}}: {{.VALUE_ONE}}
  {{.KEY_TWO}}: {{.VALUE_TWO}}
  ...

Restrictions:

  • A single key cannot map to multiple values.
  • The map will resolve recursively up to 8 times before triggering a panic. I don't have cycle detection working yet and this prevents an infinite loop.

Example

Given this configuration

config_version: 2
object_type: endpoint_map
endpoint_map:
  cluster-benjdewan-01.compose.direct: haproxy-v1.public.legacy.com
  haproxy-v1.public.legacy.com: endpoint.example.net

and this returned connection string for a deployment called postgres-benjdewan-01:

postgres://admin:[email protected]:45678/compose

The output of pachelbel will be:

name: postgres-benjdewan-01
type: postgresql
connections:
  - scheme: postgres
    host: endpoint.example.net
    username: admin
    password: PASSWORD
    port: 45678
    path: /compose

deployment_client

A deployment_client object is used to return connection information for a deployment that is managed by another team.

When developing multiple services it is highly likely that some of them will share Compose deployments. For example having an orchestrator service passing jobs to workers using a single Redis queue. In a scenario like this the orchestrator service should own and manage the deployment, and the worker services should not have the ability to modify the deployment configuration during rollout, but the workers still need the connection info to utilize it.

It may help to think of a deployment_client as a read-only information request to the Compose API about a deployment that should exist, and if it doesn't an error is thrown because the deployment owner, not the client has to handle creation

NOTE: You cannot specify a deployment object and a deployment_client object with the same name in a single pachelbel provision run. Either pachelbel has the ability to create/update a deployment or it doesn't.

Format

config_version: 2
object_type: deployment_client
name: {{.NAME_OF_EXISTING_DEPLOYMENT}}
type: {{.TYPE_OF_EXISTING_DEPLOYMENT}}

Example

config_version: 2
object_type: deployment_client
name: postgres-benjdewan-01
type: postgresql

deprovision

A deprovision object is used to deprovision an existing deployment. If the deployment does not exist the deprovision object is ignored as there is no way to differentiate between a deployment that was just deprovisioned and one that never existed, so this behavior is required per pachelbel's idempotency guarantee.

NOTE: The deployment to be deprovisioned must be unique per provision run. If a separate deployment or deployment_client object references a deployment of the same name pachelbel will throw an error because you cannot deprovision and provision a deployment simultaneously.

Format

config_version: 2
object_type: deprovision
# You must specify at least one of the id or name fields to deprovision a
# deployment. If both are specified `name` is ignored as ID is assumed to
# be more correct.
id: {{.ID_OF_EXISTING_DEPLOYMENT}}
name: {{.NAME_OF_EXISTING_DEPLOYMENT}}

# timeout is the number of seconds to wait for the deprovision to complete.
# This field is optional, and the default timeout is 900 seconds (15 minutes)
timeout: 400

Examples

Deprovision a deployment with id 1234567890987654321:

config_version: 2
object_type: deprovision
id: 1234567890987654321

Deprovision a deployment with name delete-me:

config_version: 2
object_type: deprovision
name: delete-me

Deprovision a deployment with id 1234567890987654321 with the name redis-01:

config_version: 2
object_type: deprovision
id: 1234567890987654321
name: delete-me

NOTE: Because the id was specified the given name was ignored.

Deprovision a deployment named redis-01 and return immediately:

config_version: 2
object_type: deprovision
name: redis-01
timeout: 0