mirror of
https://github.com/outbackdingo/matchbox.git
synced 2026-01-27 18:19:36 +00:00
*: Add /generic docs and revert NetBoot protobuf id
* Revert NetBoot id in storage.proto for compatibility * Add URL.RawQuery to data for generic templates * Add generic directory to scripts/setup-data-dir * Add documentation for generic templates.
This commit is contained in:
committed by
Dalton Hubble
parent
95db4cba61
commit
5bac35cc54
@@ -134,6 +134,29 @@ Finds the profile matching the machine and renders the corresponding Ignition Co
|
||||
"passwd": {}
|
||||
}
|
||||
|
||||
## Generic Config
|
||||
|
||||
Finds the profile matching the machine and renders the corresponding Generic config with metadata and group selectors.
|
||||
|
||||
GET http://bootcfg.foo/generic
|
||||
|
||||
**Query Parameters**
|
||||
|
||||
| Name | Type | Description |
|
||||
|------|--------|---------------|
|
||||
| uuid | string | Hardware UUID |
|
||||
| mac | string | MAC address |
|
||||
|
||||
**Response**
|
||||
|
||||
{
|
||||
“uuid”: “”,
|
||||
“mac”: “52:54:00:a1:9c:ae”,
|
||||
“osInstalled”: true,
|
||||
“rawQuery”: “mac=52:54:00:a1:9c:ae&os=installed”
|
||||
}
|
||||
|
||||
|
||||
## Metadata
|
||||
|
||||
Finds the matching machine group and renders the selectors and metadata as a `plain/text` file.
|
||||
|
||||
@@ -37,6 +37,10 @@ Prepare `/var/lib/bootcfg` with `profile`, `groups`, `ignition`, and `cloud` sub
|
||||
│ └── hello.json
|
||||
│ └── etcd.yaml
|
||||
│ └── simple_networking.yaml
|
||||
├── generic
|
||||
│ └── config.yaml
|
||||
│ └── setup.cfg
|
||||
│ └── datacenter-1.tmpl
|
||||
├── groups
|
||||
│ └── default.json
|
||||
│ └── node1.json
|
||||
@@ -47,13 +51,14 @@ Prepare `/var/lib/bootcfg` with `profile`, `groups`, `ignition`, and `cloud` sub
|
||||
|
||||
### Profiles
|
||||
|
||||
Profiles specify a Ignition config, Cloud-Config, and network boot config.
|
||||
Profiles specify a Ignition config, Cloud-Config, and network boot config. Generic configs can be used as well.
|
||||
|
||||
{
|
||||
"id": "etcd",
|
||||
"name": "CoreOS with etcd2"
|
||||
"cloud_id": "",
|
||||
"ignition_id": "etcd.yaml",
|
||||
"generic_id": "some-service.cfg",
|
||||
"boot": {
|
||||
"kernel": "/assets/coreos/899.6.0/coreos_production_pxe.vmlinuz",
|
||||
"initrd": ["/assets/coreos/899.6.0/coreos_production_pxe_image.cpio.gz"],
|
||||
@@ -72,9 +77,9 @@ To use cloud-config, set the `cloud-config-url` kernel option to reference the `
|
||||
|
||||
To use Ignition, set the `coreos.config.url` kernel option to reference the `bootcfg` [Ignition endpoint](api.md#ignition-config), which will render the `ignition_id` file. Be sure to add the `coreos.first_boot` option as well.
|
||||
|
||||
### Configs
|
||||
#### Configs
|
||||
|
||||
Ignition templates can be JSON or YAML files (rendered as JSON). Cloud-Config templates can be a script or YAML file. Both may contain [Go template](https://golang.org/pkg/text/template/) elements which will be executed with machine Group [metadata](#groups-and-metadata). For details and examples:
|
||||
Profiles can reference various templated configs. Ignition templates can be JSON or YAML files (rendered as JSON). Cloud-Config templates can be a script or YAML file. Generic configs can be provided in any format. Each template may contain [Go template](https://golang.org/pkg/text/template/) elements which will be executed with machine Group [metadata](#groups-and-metadata). For details and examples:
|
||||
|
||||
* [Ignition Config](ignition.md)
|
||||
* [Cloud-Config](cloud-config.md)
|
||||
|
||||
@@ -43,6 +43,7 @@ func genericHandler(srv server.Server) ContextHandler {
|
||||
return
|
||||
}
|
||||
}
|
||||
data["query"] = req.URL.RawQuery
|
||||
for key, value := range group.Selector {
|
||||
data[strings.ToLower(key)] = value
|
||||
}
|
||||
|
||||
@@ -64,10 +64,10 @@ type Profile struct {
|
||||
IgnitionId string `protobuf:"bytes,3,opt,name=ignition_id,json=ignitionId" json:"ignition_id,omitempty"`
|
||||
// cloud config id
|
||||
CloudId string `protobuf:"bytes,4,opt,name=cloud_id,json=cloudId" json:"cloud_id,omitempty"`
|
||||
// generic config id
|
||||
GenericId string `protobuf:"bytes,5,opt,name=generic_id,json=genericId" json:"generic_id,omitempty"`
|
||||
// support network boot / PXE
|
||||
Boot *NetBoot `protobuf:"bytes,6,opt,name=boot" json:"boot,omitempty"`
|
||||
Boot *NetBoot `protobuf:"bytes,5,opt,name=boot" json:"boot,omitempty"`
|
||||
// generic config id
|
||||
GenericId string `protobuf:"bytes,6,opt,name=generic_id,json=genericId" json:"generic_id,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Profile) Reset() { *m = Profile{} }
|
||||
@@ -111,27 +111,27 @@ func init() {
|
||||
}
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 338 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x94, 0x52, 0xcd, 0x4a, 0xc3, 0x40,
|
||||
0x10, 0x26, 0x4d, 0xd2, 0x9f, 0x69, 0x2b, 0x32, 0x88, 0xac, 0x05, 0x6d, 0xe9, 0x41, 0x7a, 0xca,
|
||||
0xa1, 0x5e, 0xb4, 0xde, 0x14, 0x11, 0x2f, 0x22, 0xf1, 0x01, 0x24, 0x4d, 0xc6, 0xb2, 0x34, 0xdd,
|
||||
0x2d, 0xdb, 0xad, 0xd0, 0xb7, 0xf2, 0x79, 0x7c, 0x1a, 0x77, 0x37, 0x9b, 0x52, 0xf1, 0xa2, 0xb7,
|
||||
0xf9, 0x7e, 0x32, 0xf3, 0xed, 0x4c, 0xa0, 0xbf, 0xd1, 0x52, 0x65, 0x0b, 0x4a, 0xd6, 0x4a, 0x6a,
|
||||
0x89, 0x1d, 0x0f, 0xd7, 0xf3, 0xf1, 0x57, 0x00, 0xf1, 0xa3, 0x92, 0xdb, 0x35, 0x1e, 0x41, 0x83,
|
||||
0x17, 0x2c, 0x18, 0x05, 0x93, 0x4e, 0x6a, 0x2a, 0x44, 0x88, 0x44, 0xb6, 0x22, 0xd6, 0x70, 0x8c,
|
||||
0xab, 0x91, 0x41, 0xcb, 0x74, 0x78, 0xe7, 0x25, 0xb1, 0xd0, 0xd1, 0x35, 0xc4, 0x19, 0xb4, 0x37,
|
||||
0x54, 0x52, 0x6e, 0x1a, 0xb3, 0x68, 0x14, 0x4e, 0xba, 0xd3, 0x8b, 0x64, 0x3f, 0x25, 0x71, 0x13,
|
||||
0x92, 0x57, 0x6f, 0x78, 0x10, 0x5a, 0xed, 0xd2, 0xbd, 0x1f, 0x07, 0xd0, 0x5e, 0x91, 0xce, 0x8a,
|
||||
0x4c, 0x67, 0x2c, 0x36, 0x6d, 0x7b, 0xe9, 0x1e, 0x0f, 0x6e, 0xa1, 0xff, 0xe3, 0x33, 0x3c, 0x86,
|
||||
0x70, 0x49, 0x3b, 0x9f, 0xd3, 0x96, 0x78, 0x02, 0xf1, 0x47, 0x56, 0x6e, 0xeb, 0xa4, 0x15, 0x98,
|
||||
0x35, 0xae, 0x83, 0xf1, 0x67, 0x00, 0xad, 0x17, 0x1f, 0xf0, 0x2f, 0xcf, 0x1b, 0x42, 0x97, 0x2f,
|
||||
0x04, 0xd7, 0x5c, 0x8a, 0x37, 0x63, 0xae, 0x9e, 0x08, 0x35, 0xf5, 0x54, 0xe0, 0x19, 0xb4, 0xf3,
|
||||
0x52, 0x6e, 0x0b, 0xab, 0x46, 0xd5, 0x02, 0x1c, 0x36, 0xd2, 0x39, 0xc0, 0x82, 0x04, 0x29, 0x9e,
|
||||
0x5b, 0x31, 0x76, 0x62, 0xc7, 0x33, 0x46, 0xbe, 0x84, 0x68, 0x2e, 0xa5, 0x66, 0x4d, 0x23, 0x74,
|
||||
0xa7, 0x78, 0xb0, 0x9b, 0x67, 0xd2, 0x77, 0x46, 0x49, 0x9d, 0xee, 0x22, 0x7b, 0x06, 0x4f, 0xa1,
|
||||
0xb9, 0x24, 0x25, 0xa8, 0xf4, 0xb1, 0x3d, 0xb2, 0x3c, 0x37, 0x91, 0x54, 0x61, 0xc2, 0x87, 0x96,
|
||||
0xaf, 0x10, 0xde, 0x40, 0x2b, 0x5f, 0x15, 0x25, 0x17, 0xf6, 0x3a, 0xf6, 0x04, 0xc3, 0xdf, 0x63,
|
||||
0x92, 0xfb, 0xca, 0x51, 0xdd, 0xa0, 0xf6, 0x0f, 0x66, 0xd0, 0x3b, 0x14, 0xfe, 0xb3, 0xe5, 0x79,
|
||||
0xd3, 0xfd, 0x54, 0x57, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xf3, 0xd3, 0xaa, 0xb8, 0x65, 0x02,
|
||||
0x00, 0x00,
|
||||
// 341 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x94, 0x52, 0xcd, 0x4e, 0xf3, 0x30,
|
||||
0x10, 0x54, 0x9a, 0xf4, 0x6f, 0xdb, 0x7e, 0xfa, 0xb4, 0x42, 0x28, 0x54, 0x82, 0x56, 0x3d, 0xa0,
|
||||
0x9e, 0x72, 0x28, 0x17, 0x28, 0x37, 0x10, 0x42, 0xbd, 0x20, 0x14, 0x1e, 0x00, 0xa5, 0xf1, 0x52,
|
||||
0x59, 0x4d, 0xed, 0xca, 0x75, 0x91, 0xfa, 0x56, 0x3c, 0x0f, 0x4f, 0x83, 0xed, 0x38, 0x51, 0x11,
|
||||
0x17, 0xb8, 0xed, 0xcc, 0x8e, 0xc7, 0xb3, 0x5e, 0xc3, 0x60, 0xa7, 0xa5, 0xca, 0x56, 0x94, 0x6c,
|
||||
0x95, 0xd4, 0x12, 0xbb, 0x1e, 0x6e, 0x97, 0x93, 0xcf, 0x00, 0x9a, 0x8f, 0x4a, 0xee, 0xb7, 0xf8,
|
||||
0x0f, 0x1a, 0x9c, 0xc5, 0xc1, 0x38, 0x98, 0x76, 0x53, 0x53, 0x21, 0x42, 0x24, 0xb2, 0x0d, 0xc5,
|
||||
0x0d, 0xc7, 0xb8, 0x1a, 0x63, 0x68, 0x1b, 0x87, 0x37, 0x5e, 0x50, 0x1c, 0x3a, 0xba, 0x82, 0x38,
|
||||
0x87, 0xce, 0x8e, 0x0a, 0xca, 0x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, 0x7d, 0xa9, 0x28, 0x77, 0x50, 0xe9, 0x87, 0x73, 0xe8, 0x1f, 0x37, 0xfe,
|
||||
0xf2, 0xca, 0xcb, 0x96, 0xfb, 0x54, 0x57, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xd2, 0x0d, 0x6c,
|
||||
0x68, 0x65, 0x02, 0x00, 0x00,
|
||||
}
|
||||
|
||||
@@ -25,10 +25,10 @@ message Profile {
|
||||
string ignition_id = 3;
|
||||
// cloud config id
|
||||
string cloud_id = 4;
|
||||
// generic config id
|
||||
string generic_id = 5;
|
||||
// support network boot / PXE
|
||||
NetBoot boot = 6;
|
||||
NetBoot boot = 5;
|
||||
// generic config id
|
||||
string generic_id = 6;
|
||||
}
|
||||
|
||||
// NetBoot describes network or PXE boot settings for a machine.
|
||||
|
||||
@@ -36,3 +36,4 @@ make_bootcfg_directory "${datadir}/profiles" 2770
|
||||
make_bootcfg_directory "${datadir}/groups" 2770
|
||||
make_bootcfg_directory "${datadir}/ignition" 2770
|
||||
make_bootcfg_directory "${datadir}/cloud" 2770
|
||||
make_bootcfg_directory "${datadir}/generic" 2770
|
||||
|
||||
Reference in New Issue
Block a user