resource

command
v0.0.0-...-a355528 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2017 License: Apache-2.0 Imports: 11 Imported by: 0

README

InfraKit Resource Plugin

The Resource plugin works in conjuction with Instance plugins to manage collections of interdependent, named resources. Dependencies are expressed with the resource "name" template function, the output of which is the ID of the named resource.

Running

Begin by building plugin binaries.

The plugin may be started without any arguments and will default to using unix socket in ~/.infrakit/plugins for communications with the CLI and other plugins:

$ build/infrakit-resource
INFO[0000] Listening at: ~/.infrakit/plugins/resource

Working with the Resource Plugin

Start the resource plugin as show above.

Start the instance-file plugin:

$ mkdir -p instances
$ build/infrakit-instance-file --dir instances
INFO[0000] Listening at: ~/.infrakit/plugins/instance-file
INFO[0000] PID file at ~/.infrakit/plugins/instance-file.pid

Save the following in a file named resources.json.

{
  "ID": "Fancy Resources",
  "Properties": {
    "Resources": [
      {
        "ID": "A",
        "Plugin": "instance-file",
        "Properties": {}
      },
      {
        "ID": "B",
        "Plugin": "instance-file",
        "Properties": {
          "Note": "Depends on {{ resource `A` }}"
        }
      }
    ]
  }
}

Commit resources.json:

$ build/infrakit resource commit file:$PWD/resources.json
INFO[0000] Reading template from file:~/resources.json
Committed Fancy Resources:
Provisioned A (instance-9021654729849995625)
Provisioned B (instance-2978607024592968517)

Verify the presence of A's ID in B:

$ jq .Spec.Properties.Note instances/instance-2978607024592968517
"Depends on instance-9021654729849995625"

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL