mirror of
https://github.com/outbackdingo/matchbox.git
synced 2026-01-27 10:19:35 +00:00
api: Read cloud-config-url cmdline entry from boot config json
This commit is contained in:
@@ -12,7 +12,7 @@ chain ipxe?uuid=${uuid}
|
||||
`
|
||||
|
||||
var ipxeTemplate = template.Must(template.New("ipxe boot").Parse(`#!ipxe
|
||||
kernel {{.Kernel}} cloud-config-url=http://172.17.0.2:8080/cloud?uuid=${uuid}{{range $key, $value := .Cmdline}} {{if $value}}{{$key}}={{$value}}{{else}}{{$key}}{{end}}{{end}}
|
||||
kernel {{.Kernel}}{{range $key, $value := .Cmdline}} {{if $value}}{{$key}}={{$value}}{{else}}{{$key}}{{end}}{{end}}
|
||||
initrd {{ range $element := .Initrd }}{{$element}}{{end}}
|
||||
boot
|
||||
`))
|
||||
|
||||
@@ -14,6 +14,7 @@ func pixiecoreHandler(store Store) http.Handler {
|
||||
macAddr, err := parseMAC(filepath.Base(req.URL.Path))
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
// pixiecore only provides MAC addresses
|
||||
attrs := MachineAttrs{MAC: macAddr}
|
||||
|
||||
@@ -37,7 +37,7 @@ func (s *Server) HTTPHandler() http.Handler {
|
||||
mux.Handle("/boot.ipxe", ipxeInspect())
|
||||
mux.Handle("/ipxe", ipxeHandler(s.store))
|
||||
// Pixiecore
|
||||
mux.Handle("/pixiecore/v1/boot", pixiecoreHandler(s.store))
|
||||
mux.Handle("/pixiecore/v1/boot/", pixiecoreHandler(s.store))
|
||||
// cloud configs
|
||||
mux.Handle("/cloud", cloudHandler(s.store))
|
||||
// Kernel and Initrd Images
|
||||
|
||||
@@ -50,8 +50,8 @@ func main() {
|
||||
capnslog.SetFormatter(capnslog.NewPrettyFormatter(os.Stdout, false))
|
||||
|
||||
config := &api.Config{
|
||||
ImagePath: *imagesPath,
|
||||
Store: api.NewFileStore(http.Dir(*dataPath)),
|
||||
ImagePath: *imagesPath,
|
||||
}
|
||||
|
||||
// API server
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
"kernel": "/images/stable/coreos_production_pxe.vmlinuz",
|
||||
"initrd": ["/images/stable/coreos_production_pxe_image.cpio.gz"],
|
||||
"cmdline": {
|
||||
"cloud-config-url": "http://172.17.0.2:8080/cloud?uuid=${uuid}",
|
||||
"coreos.autologin": ""
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
docker run -p 8080:8080 --name=bootcfg --rm -v $PWD/data:/data -v $PWD/images:/images dghubble/bootcfg:latest -address=0.0.0.0:8080 -data-path=/data
|
||||
docker run -p 8080:8080 --name=bootcfg --rm -v $PWD/data:/data -v $PWD/images:/images dghubble/bootcfg:latest -address=0.0.0.0:8080
|
||||
@@ -1,8 +1,8 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
CHANNEL="stable"
|
||||
VERSION="current"
|
||||
DEST=${PWD}/images/$CHANNEL
|
||||
VERSION="835.9.0"
|
||||
DEST=${PWD}/images/coreos/$VERSION
|
||||
|
||||
mkdir -p $DEST
|
||||
echo "Downloading CoreOS kernel and initrd"
|
||||
|
||||
Reference in New Issue
Block a user