mirror of
https://github.com/outbackdingo/matchbox.git
synced 2026-01-27 18:19:36 +00:00
Update ignition module from v0.22.0 to v0.31.0
* Serve Ignition configs (ending in .ign/.ignition) with v2.1 or v2.2 formats (previously, configs above v2.1 produced warnings that the config was too new)
This commit is contained in:
@@ -6,6 +6,8 @@ Notable changes between releases.
|
||||
|
||||
* Build Matchbox with Go v1.11.5 for images and binaries
|
||||
* Update container image base from alpine:3.6 to alpine:3.9
|
||||
* Validate Ignition configs with the v2.2 spec (warn-only)
|
||||
* Fix warnings that v2.2 configs are too new
|
||||
|
||||
### Examples
|
||||
|
||||
|
||||
2
go.mod
2
go.mod
@@ -8,7 +8,7 @@ require (
|
||||
github.com/coreos/coreos-cloudinit v1.13.0
|
||||
github.com/coreos/go-semver v0.0.0-20170209201757-5e3acbb5668c // indirect
|
||||
github.com/coreos/go-systemd v0.0.0-20160826104600-43e4800a6165 // indirect
|
||||
github.com/coreos/ignition v0.19.0
|
||||
github.com/coreos/ignition v0.31.0
|
||||
github.com/coreos/pkg v0.0.0-20160221035341-66fe44ad037c
|
||||
github.com/coreos/yaml v0.0.0-20141224210557-6b16a5714269 // indirect
|
||||
github.com/golang/protobuf v0.0.0-20170331031902-2bba0603135d
|
||||
|
||||
4
go.sum
4
go.sum
@@ -12,8 +12,8 @@ github.com/coreos/go-semver v0.0.0-20170209201757-5e3acbb5668c h1:+wuUamXDDSjSeg
|
||||
github.com/coreos/go-semver v0.0.0-20170209201757-5e3acbb5668c/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
|
||||
github.com/coreos/go-systemd v0.0.0-20160826104600-43e4800a6165 h1:vjIPZX2iMVczdBreXAY5t+nGoR4z3rb4M1W1F1aGwsE=
|
||||
github.com/coreos/go-systemd v0.0.0-20160826104600-43e4800a6165/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
|
||||
github.com/coreos/ignition v0.19.0 h1:+vu8Tkpe5P0PYKTxhVVU9WYz7LbFNAzsCQmM5MAnTHw=
|
||||
github.com/coreos/ignition v0.19.0/go.mod h1:WJQapxzEn9DE0ryxsGvm8QnBajm/XsS/PkrDqSpz+bA=
|
||||
github.com/coreos/ignition v0.31.0 h1:e6ktS2Flcxq6SIKc1JN9NV1gQxmH2gaVwpdgtJIGep4=
|
||||
github.com/coreos/ignition v0.31.0/go.mod h1:WJQapxzEn9DE0ryxsGvm8QnBajm/XsS/PkrDqSpz+bA=
|
||||
github.com/coreos/pkg v0.0.0-20160221035341-66fe44ad037c h1:YYKUGUx+21jb01m4f292UtXWBauM5oQH6tywwQNZxdU=
|
||||
github.com/coreos/pkg v0.0.0-20160221035341-66fe44ad037c/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
|
||||
github.com/coreos/yaml v0.0.0-20141224210557-6b16a5714269 h1:/1sjrpK5Mb6IwyFOKd+u7321tXfNAsj0Ci8CivZmSlo=
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"strings"
|
||||
|
||||
ct "github.com/coreos/container-linux-config-transpiler/config"
|
||||
ignition "github.com/coreos/ignition/config"
|
||||
ignition "github.com/coreos/ignition/config/v2_2"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/coreos/matchbox/matchbox/server"
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
fake "github.com/coreos/matchbox/matchbox/storage/testfakes"
|
||||
)
|
||||
|
||||
func TestIgnitionHandler_V2JSON(t *testing.T) {
|
||||
func TestIgnitionHandler_V2_1_JSON(t *testing.T) {
|
||||
content := `{"ignition":{"version":"2.1.0","config":{}},"storage":{},"systemd":{"units":[{"name":"etcd2.service","enable":true}]},"networkd":{},"passwd":{}}`
|
||||
profile := &storagepb.Profile{
|
||||
Id: fake.Group.Profile,
|
||||
@@ -39,6 +39,31 @@ func TestIgnitionHandler_V2JSON(t *testing.T) {
|
||||
assert.Equal(t, content, w.Body.String())
|
||||
}
|
||||
|
||||
func TestIgnitionHandler_V2_2_JSON(t *testing.T) {
|
||||
content := `{"ignition":{"version":"2.2.0","config":{}},"storage":{},"systemd":{"units":[{"name":"etcd2.service","enable":true}]},"networkd":{},"passwd":{}}`
|
||||
profile := &storagepb.Profile{
|
||||
Id: fake.Group.Profile,
|
||||
IgnitionId: "file.ign",
|
||||
}
|
||||
store := &fake.FixedStore{
|
||||
Profiles: map[string]*storagepb.Profile{fake.Group.Profile: profile},
|
||||
IgnitionConfigs: map[string]string{"file.ign": content},
|
||||
}
|
||||
logger, _ := logtest.NewNullLogger()
|
||||
srv := NewServer(&Config{Logger: logger})
|
||||
c := server.NewServer(&server.Config{Store: store})
|
||||
h := srv.ignitionHandler(c)
|
||||
ctx := withGroup(context.Background(), fake.Group)
|
||||
w := httptest.NewRecorder()
|
||||
req, _ := http.NewRequest("GET", "/", nil)
|
||||
h.ServeHTTP(w, req.WithContext(ctx))
|
||||
// assert that:
|
||||
// - raw Ignition config served directly
|
||||
assert.Equal(t, http.StatusOK, w.Code)
|
||||
assert.Equal(t, jsonContentType, w.HeaderMap.Get(contentType))
|
||||
assert.Equal(t, content, w.Body.String())
|
||||
}
|
||||
|
||||
func TestIgnitionHandler_V2YAML(t *testing.T) {
|
||||
// exercise templating features, not a realistic Container Linux Config template
|
||||
content := `
|
||||
|
||||
Reference in New Issue
Block a user