Merge pull request #1586 from errordeveloper/metadata-docs

Few improvements to metadata docs
This commit is contained in:
Justin Cormack 2017-04-14 07:30:36 -05:00 committed by GitHub
commit e2aa908e87

View File

@ -1,22 +1,26 @@
# Metadata and Userdata handling # Metadata and Userdata handling
Most providers offer a mechanism to provide a OS with some additional Most providers offer two general mechanisms to provide compute instances
metadata as well as custom userdata. `Metadata` in this context is with information about the instance that cannot be discovered by any other
fixed information provided by the provider (e.g. the host means. There are usually two types of information, namely _metadata_ and
name). `Userdata` is completely custom data which a user can supply to _user-data_. Metadata is usually set by the provider (e.g. geographical
the instance. region of the datacentre, name given to the instance, external IP address,
tags and other similar information), while userdata is fully custom,
hence the name, and it is the information that user may supply to their
instances before launch (it is immutable in most providers).
The [metadata package](../pkg/metadata/) handles both metadata and The [metadata package](../pkg/metadata/) handles both metadata and
userdata for a number of providers (see below). It abstracts over the userdata for a number of providers (see below). It abstracts over
provider differences by exposing both metadata and userdata in a the provider differences by exposing both metadata and userdata in
directory hierarchy under `/var/config`. For example, sshd config a directory hierarchy under `/var/config`. For example, sshd config
files from the metadata are placed under `/var/config/ssh`. files from the metadata are placed under `/var/config/ssh`.
Userdata is assumed to be a single string and the contents will be Userdata is assumed to be a single string and the contents will be
stored under `/var/config/userdata`. If userdata is a json file, the stored under `/var/config/userdata`. If userdata is a JSON file, the
contents will be further processed, where different keys cause contents will be further processed, where different keys cause
directories to be created and the directories are populated with files. Foer example, the following userdata file: directories to be created and the directories are populated with files.
``` For example, the following userdata file:
```JSON
{ {
"ssh" : { "ssh" : {
"sshd_config" : { "sshd_config" : {
@ -66,5 +70,6 @@ GCP userdata is extracted from `/computeMetadata/v1/instance/attributes/userdata
## HyperKit ## HyperKit
HyperKit does not support metadata and userdata is passed in as a single file via a ISO9660 image. HyperKit does not distiguish metadata and userdata, it's simply
refered to as data, which is passed to the VM as a disk image
in ISO9660 format.