From f5184afced06d8ae461fc8bd62421ffdc5cb7317 Mon Sep 17 00:00:00 2001 From: niule Date: Sun, 11 Jan 2026 18:53:06 +0000 Subject: [PATCH] support ignition spec v3.5.0 --- CHANGES.md | 2 ++ matchbox/http/ignition.go | 2 +- matchbox/http/ignition_test.go | 12 ++++++------ 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index e2c78b686..9a246b10f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,6 +4,8 @@ Notable changes between releases. ## Latest +* Support Ignition spec [v3.5.0](https://coreos.github.io/ignition/configuration-v3_5/) + ## v0.11.0 * Update butane from v0.17.0 to v0.18.0 ([#1079](https://github.com/poseidon/matchbox/pull/1079)) diff --git a/matchbox/http/ignition.go b/matchbox/http/ignition.go index 760172c1a..350a38860 100644 --- a/matchbox/http/ignition.go +++ b/matchbox/http/ignition.go @@ -7,7 +7,7 @@ import ( butane "github.com/coreos/butane/config" "github.com/coreos/butane/config/common" - ignition "github.com/coreos/ignition/v2/config/v3_4" + ignition "github.com/coreos/ignition/v2/config/v3_5" "github.com/sirupsen/logrus" "github.com/poseidon/matchbox/matchbox/server" diff --git a/matchbox/http/ignition_test.go b/matchbox/http/ignition_test.go index 3378848e5..782bafcf2 100644 --- a/matchbox/http/ignition_test.go +++ b/matchbox/http/ignition_test.go @@ -15,8 +15,8 @@ import ( fake "github.com/poseidon/matchbox/matchbox/storage/testfakes" ) -func TestIgnitionHandler_v3_4(t *testing.T) { - const content = `{"ignition":{"config":{"replace":{"verification":{}}},"proxy":{},"security":{"tls":{}},"timeouts":{},"version":"3.4.0"},"kernelArguments":{},"passwd":{"users":[{"name":"core","sshAuthorizedKeys":["key"]}]},"storage":{},"systemd":{"units":[{"enabled":false,"name":"docker.service"}]}}` +func TestIgnitionHandler_v3_5(t *testing.T) { + const content = `{"ignition":{"config":{"replace":{"verification":{}}},"proxy":{},"security":{"tls":{}},"timeouts":{},"version":"3.5.0"},"kernelArguments":{},"passwd":{"users":[{"name":"core","sshAuthorizedKeys":["key"]}]},"storage":{},"systemd":{"units":[{"enabled":false,"name":"docker.service"}]}}` profile := &storagepb.Profile{ Id: fake.Group.Profile, IgnitionId: "file.ign", @@ -43,7 +43,7 @@ func TestIgnitionHandler_v3_4(t *testing.T) { func TestIgnitionHandler_v3_1(t *testing.T) { const ign31 = `{"ignition":{"config":{"replace":{"verification":{}}},"proxy":{},"security":{"tls":{}},"timeouts":{},"version":"3.1.0"},"kernelArguments":{},"passwd":{"users":[{"name":"core","sshAuthorizedKeys":["key"]}]},"storage":{},"systemd":{"units":[{"enabled":false,"name":"docker.service"}]}}` - const ign34 = `{"ignition":{"config":{"replace":{"verification":{}}},"proxy":{},"security":{"tls":{}},"timeouts":{},"version":"3.4.0"},"kernelArguments":{},"passwd":{"users":[{"name":"core","sshAuthorizedKeys":["key"]}]},"storage":{},"systemd":{"units":[{"enabled":false,"name":"docker.service"}]}}` + const ign35 = `{"ignition":{"config":{"replace":{"verification":{}}},"proxy":{},"security":{"tls":{}},"timeouts":{},"version":"3.5.0"},"kernelArguments":{},"passwd":{"users":[{"name":"core","sshAuthorizedKeys":["key"]}]},"storage":{},"systemd":{"units":[{"enabled":false,"name":"docker.service"}]}}` profile := &storagepb.Profile{ Id: fake.Group.Profile, IgnitionId: "file.ign", @@ -66,11 +66,11 @@ func TestIgnitionHandler_v3_1(t *testing.T) { req, _ := http.NewRequestWithContext(ctx, "GET", "/", nil) h.ServeHTTP(w, req) // assert that: - // - older Ignition v3.x converted to compatible latest version (e.g. v3.3) + // - older Ignition v3.x converted to compatible latest version (e.g. v3.5) // - serve Ignition JSON assert.Equal(t, http.StatusOK, w.Code) assert.Equal(t, jsonContentType, w.Header().Get(contentType)) - assert.Equal(t, ign34, w.Body.String()) + assert.Equal(t, ign35, w.Body.String()) } func TestIgnitionHandler_MissingIgnition(t *testing.T) { @@ -100,7 +100,7 @@ systemd: enabled: true contents: {{.request.raw_query}} ` - expectedIgnition := `{"ignition":{"config":{"replace":{"verification":{}}},"proxy":{},"security":{"tls":{}},"timeouts":{},"version":"3.4.0"},"kernelArguments":{},"passwd":{},"storage":{},"systemd":{"units":[{"contents":"10.2.0.0/16","enabled":true,"name":"a1b2c3d4.service"},{"contents":"foo=some-param\u0026bar=b","enabled":true,"name":"some-param.service"}]}}` + expectedIgnition := `{"ignition":{"config":{"replace":{"verification":{}}},"proxy":{},"security":{"tls":{}},"timeouts":{},"version":"3.5.0"},"kernelArguments":{},"passwd":{},"storage":{},"systemd":{"units":[{"contents":"10.2.0.0/16","enabled":true,"name":"a1b2c3d4.service"},{"contents":"foo=some-param\u0026bar=b","enabled":true,"name":"some-param.service"}]}}` store := &fake.FixedStore{ Profiles: map[string]*storagepb.Profile{