Skip to content

Instantly share code, notes, and snippets.

@r7vme
Last active April 19, 2017 16:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save r7vme/0b2159024a8eec49233e871d7a020b3a to your computer and use it in GitHub Desktop.
Save r7vme/0b2159024a8eec49233e871d7a020b3a to your computer and use it in GitHub Desktop.
blueprint-matchbox-machine-list.md

Matchbox machine registry

TBD

Problem description

Currenly Matchbox doesn't provide any machine discovery mechanism. Matchbox operators should manually create groups with appropriate mac address selectors.

Proposed change

As a Matchbox operator i want to have:

  • machine discovery mechanism
  • ability to assign profiles to machines

Alternatives

TBD

Implementation

New Machine model

{
  "id": "node1",
  "name": "etcd Node 1",
  "profile": "etcd3",
  "mac": "52:54:00:a1:9c:ae",
  "metadata": {
    "foo": "bar"
  }
}

Id and mac mandatory.

gRPC changes

gRPC:

  • MachinePut
  • MachineGet
  • MachineList

CLI commands for machine

bootcmd machine list
bootcmd machine create --file $FILE
bootcmd machine get $MACHINE_ID
bootcmd machine register-as-group $MACHINE_ID --group-template $FILE

register-as-group - locally compiles text/template with mac address of machine and executes "bootcmd group create"

TODO: How to handle profile?

HTTP changes

HTTP:

  • /discover

Example request to HTTP /discover:

curl -H "Content-Type: application/json" \
     -X POST \
     -d '{"id":"${uuid}","name":"machine1", "mac": "11:22:33:44:aa:bb"}' \
     http://matchbox.foo:8080/discover

Discovery mechanism

Matchbox started with default group called "discovery". So every unknown machine will boot into "discovery" group. Discovery group boots CoreOS with special "discovery" ignition. Discovery inginition has oneshot systemd unit. This unit will make a requiest to Matchbox discovery url.

Assignee(s)

Roman Sokolkov rsokolkov@gmail.com

Work Items

  1. Introduce new model called "Machine" DONE
  2. Add new "machine" gRPC api endpoints DONE
  3. Add new "machine" cli commands DONE
  4. Add new "dicovery" HTTP endpoint DONE
  5. Define discovery mechanism DONE

Dependencies

TBD

Testing

Please discuss how the changed document will be tested.

Future improvements

  • Add created and updated timestampts for machines

References

TBD

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment