Skip to content

Commit e0ea23d

Browse files
committed
Rework controller to bump ign to 3.5
1 parent 4e3b117 commit e0ea23d

File tree

6 files changed

+177
-49
lines changed

6 files changed

+177
-49
lines changed

pkg/controller/common/constants.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ const (
8383

8484
// InternalMCOIgnitionVersion is the ignition version that the MCO converts everything to internally. The intent here is that
8585
// we should be able to update this constant when we bump the internal ignition version instead of having to hunt down all of
86-
// the version references and figure out "was this supposed to be explicitly 3.4.0 or just the default version which happens
87-
// to be 3.4.0 currently". Ideally if you find an explicit "3.4.0", it's supposed to be "3.4.0" version. If it's this constant,
86+
// the version references and figure out "was this supposed to be explicitly 3.5.0 or just the default version which happens
87+
// to be 3.5.0 currently". Ideally if you find an explicit "3.5.0", it's supposed to be "3.5.0" version. If it's this constant,
8888
// it's supposed to be the internal default version.
89-
InternalMCOIgnitionVersion = "3.4.0"
89+
InternalMCOIgnitionVersion = "3.5.0"
9090

9191
// MachineConfigRoleLabel is the role on MachineConfigs, used to select for pools
9292
MachineConfigRoleLabel = "machineconfiguration.openshift.io/role"

pkg/controller/common/helpers.go

+106-41
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
"github.com/coreos/ign-converter/translate/v32tov31"
2828
"github.com/coreos/ign-converter/translate/v33tov32"
2929
"github.com/coreos/ign-converter/translate/v34tov33"
30+
"github.com/coreos/ign-converter/translate/v35tov34"
3031
ign2error "github.com/coreos/ignition/config/shared/errors"
3132
ign2 "github.com/coreos/ignition/config/v2_2"
3233
ign2types "github.com/coreos/ignition/config/v2_2/types"
@@ -39,11 +40,13 @@ import (
3940
ign3_2types "github.com/coreos/ignition/v2/config/v3_2/types"
4041
translate3_3 "github.com/coreos/ignition/v2/config/v3_3/translate"
4142
ign3_3types "github.com/coreos/ignition/v2/config/v3_3/types"
43+
translate3_4 "github.com/coreos/ignition/v2/config/v3_4/translate"
44+
ign3_4types "github.com/coreos/ignition/v2/config/v3_4/types"
4245

43-
ign3 "github.com/coreos/ignition/v2/config/v3_4"
44-
ign3_4 "github.com/coreos/ignition/v2/config/v3_4"
45-
translate3 "github.com/coreos/ignition/v2/config/v3_4/translate"
46-
ign3types "github.com/coreos/ignition/v2/config/v3_4/types"
46+
ign3 "github.com/coreos/ignition/v2/config/v3_5"
47+
ign3_5 "github.com/coreos/ignition/v2/config/v3_5"
48+
translate3 "github.com/coreos/ignition/v2/config/v3_5/translate"
49+
ign3types "github.com/coreos/ignition/v2/config/v3_5/types"
4750
validate3 "github.com/coreos/ignition/v2/config/validate"
4851
"github.com/ghodss/yaml"
4952
"github.com/vincent-petithory/dataurl"
@@ -266,10 +269,9 @@ func WriteTerminationError(err error) {
266269
klog.Fatal(msg)
267270
}
268271

269-
// ConvertRawExtIgnitionToV3 ensures that the Ignition config in
270-
// the RawExtension is spec v3.2, or translates to it.
271-
func ConvertRawExtIgnitionToV3_4(inRawExtIgn *runtime.RawExtension) (runtime.RawExtension, error) {
272-
272+
// ConvertRawExtIgnitionToV3_5 ensures that the Ignition config in
273+
// the RawExtension is spec v3.5, or translates to it.
274+
func ConvertRawExtIgnitionToV3_5(inRawExtIgn *runtime.RawExtension) (runtime.RawExtension, error) {
273275
// Parse the raw extension to the MCO's current internal ignition version
274276
ignCfgV3, err := IgnParseWrapper(inRawExtIgn.Raw)
275277
if err != nil {
@@ -289,10 +291,41 @@ func ConvertRawExtIgnitionToV3_4(inRawExtIgn *runtime.RawExtension) (runtime.Raw
289291
return outRawExt, nil
290292
}
291293

294+
// ConvertRawExtIgnitionToV3_4 ensures that the Ignition config in
295+
// the RawExtension is spec v3.4, or translates to it.
296+
func ConvertRawExtIgnitionToV3_4(inRawExtIgn *runtime.RawExtension) (runtime.RawExtension, error) {
297+
rawExt, err := ConvertRawExtIgnitionToV3_5(inRawExtIgn)
298+
if err != nil {
299+
return runtime.RawExtension{}, err
300+
}
301+
302+
ignCfgV3, rptV3, errV3 := ign3.Parse(rawExt.Raw)
303+
if errV3 != nil || rptV3.IsFatal() {
304+
return runtime.RawExtension{}, fmt.Errorf("parsing Ignition config failed with error: %w\nReport: %v", errV3, rptV3)
305+
}
306+
307+
// TODO(jkyros): someday we should write a recursive chain-downconverter, but until then,
308+
// we're going to do it the hard way
309+
ignCfgV33, err := convertIgnition35to34(ignCfgV3)
310+
if err != nil {
311+
return runtime.RawExtension{}, err
312+
}
313+
314+
outIgnV33, err := json.Marshal(ignCfgV33)
315+
if err != nil {
316+
return runtime.RawExtension{}, fmt.Errorf("failed to marshal converted config: %w", err)
317+
}
318+
319+
outRawExt := runtime.RawExtension{}
320+
outRawExt.Raw = outIgnV33
321+
322+
return outRawExt, nil
323+
}
324+
292325
// ConvertRawExtIgnitionToV3_3 ensures that the Ignition config in
293326
// the RawExtension is spec v3.3, or translates to it.
294327
func ConvertRawExtIgnitionToV3_3(inRawExtIgn *runtime.RawExtension) (runtime.RawExtension, error) {
295-
rawExt, err := ConvertRawExtIgnitionToV3_4(inRawExtIgn)
328+
rawExt, err := ConvertRawExtIgnitionToV3_5(inRawExtIgn)
296329
if err != nil {
297330
return runtime.RawExtension{}, err
298331
}
@@ -304,7 +337,12 @@ func ConvertRawExtIgnitionToV3_3(inRawExtIgn *runtime.RawExtension) (runtime.Raw
304337

305338
// TODO(jkyros): someday we should write a recursive chain-downconverter, but until then,
306339
// we're going to do it the hard way
307-
ignCfgV33, err := convertIgnition34to33(ignCfgV3)
340+
ignCfgV34, err := convertIgnition35to34(ignCfgV3)
341+
if err != nil {
342+
return runtime.RawExtension{}, err
343+
}
344+
345+
ignCfgV33, err := convertIgnition34to33(ignCfgV34)
308346
if err != nil {
309347
return runtime.RawExtension{}, err
310348
}
@@ -320,10 +358,10 @@ func ConvertRawExtIgnitionToV3_3(inRawExtIgn *runtime.RawExtension) (runtime.Raw
320358
return outRawExt, nil
321359
}
322360

323-
// ConvertRawExtIgnitionToV3_3 ensures that the Ignition config in
324-
// the RawExtension is spec v3.3, or translates to it.
361+
// ConvertRawExtIgnitionToV3_2 ensures that the Ignition config in
362+
// the RawExtension is spec v3.2, or translates to it.
325363
func ConvertRawExtIgnitionToV3_2(inRawExtIgn *runtime.RawExtension) (runtime.RawExtension, error) {
326-
rawExt, err := ConvertRawExtIgnitionToV3_4(inRawExtIgn)
364+
rawExt, err := ConvertRawExtIgnitionToV3_5(inRawExtIgn)
327365
if err != nil {
328366
return runtime.RawExtension{}, err
329367
}
@@ -335,7 +373,12 @@ func ConvertRawExtIgnitionToV3_2(inRawExtIgn *runtime.RawExtension) (runtime.Raw
335373

336374
// TODO(jkyros): someday we should write a recursive chain-downconverter, but until then,
337375
// we're going to do it the hard way
338-
ignCfgV33, err := convertIgnition34to33(ignCfgV3)
376+
ignCfgV34, err := convertIgnition35to34(ignCfgV3)
377+
if err != nil {
378+
return runtime.RawExtension{}, err
379+
}
380+
381+
ignCfgV33, err := convertIgnition34to33(ignCfgV34)
339382
if err != nil {
340383
return runtime.RawExtension{}, err
341384
}
@@ -359,7 +402,7 @@ func ConvertRawExtIgnitionToV3_2(inRawExtIgn *runtime.RawExtension) (runtime.Raw
359402
// ConvertRawExtIgnitionToV3_1 ensures that the Ignition config in
360403
// the RawExtension is spec v3.1, or translates to it.
361404
func ConvertRawExtIgnitionToV3_1(inRawExtIgn *runtime.RawExtension) (runtime.RawExtension, error) {
362-
rawExt, err := ConvertRawExtIgnitionToV3_4(inRawExtIgn)
405+
rawExt, err := ConvertRawExtIgnitionToV3_5(inRawExtIgn)
363406
if err != nil {
364407
return runtime.RawExtension{}, err
365408
}
@@ -371,7 +414,12 @@ func ConvertRawExtIgnitionToV3_1(inRawExtIgn *runtime.RawExtension) (runtime.Raw
371414

372415
// TODO(jkyros): someday we should write a recursive chain-downconverter, but until then,
373416
// we're going to do it the hard way
374-
ignCfgV33, err := convertIgnition34to33(ignCfgV3)
417+
ignCfgV34, err := convertIgnition35to34(ignCfgV3)
418+
if err != nil {
419+
return runtime.RawExtension{}, err
420+
}
421+
422+
ignCfgV33, err := convertIgnition34to33(ignCfgV34)
375423
if err != nil {
376424
return runtime.RawExtension{}, err
377425
}
@@ -405,7 +453,7 @@ func ConvertRawExtIgnitionToV2_2(inRawExtIgn *runtime.RawExtension) (runtime.Raw
405453
return runtime.RawExtension{}, fmt.Errorf("parsing Ignition config spec v3.2 failed with error: %w\nReport: %v", err, rpt)
406454
}
407455

408-
converted2, err := convertIgnition34to22(ignCfg)
456+
converted2, err := convertIgnition35to22(ignCfg)
409457
if err != nil {
410458
return runtime.RawExtension{}, fmt.Errorf("failed to convert config from spec v3.2 to v2.2: %w", err)
411459
}
@@ -421,8 +469,8 @@ func ConvertRawExtIgnitionToV2_2(inRawExtIgn *runtime.RawExtension) (runtime.Raw
421469
return outRawExt, nil
422470
}
423471

424-
// convertIgnition2to3 takes an ignition spec v2.2 config and returns a v3.2 config
425-
func convertIgnition22to34(ign2config ign2types.Config) (ign3types.Config, error) {
472+
// convertIgnition2to3 takes an ignition spec v2.2 config and returns a v3.5 config
473+
func convertIgnition22to35(ign2config ign2types.Config) (ign3types.Config, error) {
426474
// only support writing to root file system
427475
fsMap := map[string]string{
428476
"root": "/",
@@ -434,18 +482,24 @@ func convertIgnition22to34(ign2config ign2types.Config) (ign3types.Config, error
434482
if err != nil {
435483
return ign3types.Config{}, fmt.Errorf("unable to convert Ignition spec v2 config to v3: %w", err)
436484
}
437-
// Workaround to get a v3.4 config as output
438-
converted3 := translate3.Translate(translate3_3.Translate(translate3_2.Translate(translate3_1.Translate(ign3_0config))))
485+
// Workaround to get a v3.5 config as output
486+
converted3 := translate3.Translate(translate3_4.Translate(translate3_3.Translate(translate3_2.Translate(translate3_1.Translate(ign3_0config)))))
439487

440488
klog.V(4).Infof("Successfully translated Ignition spec v2 config to Ignition spec v3 config: %v", converted3)
441489
return converted3, nil
442490
}
443491

444-
// convertIgnition3to2 takes an ignition spec v3.2 config and returns a v2.2 config
445-
func convertIgnition34to22(ign3config ign3types.Config) (ign2types.Config, error) {
492+
// convertIgnition3to2 takes an ignition spec v3.5 config and returns a v2.2 config
493+
func convertIgnition35to22(ign3config ign3types.Config) (ign2types.Config, error) {
446494

447495
// TODO(jkyros): that recursive down-converter is looking like a better idea all the time
448-
converted33, err := convertIgnition34to33(ign3config)
496+
497+
converted34, err := convertIgnition35to34(ign3config)
498+
if err != nil {
499+
return ign2types.Config{}, fmt.Errorf("unable to convert Ignition spec v3 config to v2: %w", err)
500+
}
501+
502+
converted33, err := convertIgnition34to33(converted34)
449503
if err != nil {
450504
return ign2types.Config{}, fmt.Errorf("unable to convert Ignition spec v3 config to v2: %w", err)
451505
}
@@ -464,24 +518,35 @@ func convertIgnition34to22(ign3config ign3types.Config) (ign2types.Config, error
464518
return converted2, nil
465519
}
466520

467-
// convertIgnition34to33 takes an ignition spec v3.4config and returns a v3.3 config
468-
func convertIgnition34to33(ign3config ign3types.Config) (ign3_3types.Config, error) {
521+
// convertIgnition35to34 takes an ignition spec v3.5 config and returns a v3.4 config
522+
func convertIgnition35to34(ign3config ign3types.Config) (ign3_4types.Config, error) {
523+
converted34, err := v35tov34.Translate(ign3config)
524+
if err != nil {
525+
return ign3_4types.Config{}, fmt.Errorf("unable to convert Ignition spec v3.5 config to v3.4: %w", err)
526+
}
527+
klog.V(4).Infof("Successfully translated Ignition spec v3.5 config to Ignition spec v3.4 config: %v", converted34)
528+
529+
return converted34, nil
530+
}
531+
532+
// convertIgnition34to33 takes an ignition spec v3.4 config and returns a v3.3 config
533+
func convertIgnition34to33(ign3config ign3_4types.Config) (ign3_3types.Config, error) {
469534
converted33, err := v34tov33.Translate(ign3config)
470535
if err != nil {
471-
return ign3_3types.Config{}, fmt.Errorf("unable to convert Ignition spec v3_2 config to v3_1: %w", err)
536+
return ign3_3types.Config{}, fmt.Errorf("unable to convert Ignition spec v3.2 config to v3.1: %w", err)
472537
}
473-
klog.V(4).Infof("Successfully translated Ignition spec v3_2 config to Ignition spec v3_1 config: %v", converted33)
538+
klog.V(4).Infof("Successfully translated Ignition spec v3.2 config to Ignition spec v3.1 config: %v", converted33)
474539

475540
return converted33, nil
476541
}
477542

478-
// convertIgnition33to32 takes an ignition spec v3.3config and returns a v3.2 config
543+
// convertIgnition33to32 takes an ignition spec v3.3 config and returns a v3.2 config
479544
func convertIgnition33to32(ign3config ign3_3types.Config) (ign3_2types.Config, error) {
480545
converted32, err := v33tov32.Translate(ign3config)
481546
if err != nil {
482-
return ign3_2types.Config{}, fmt.Errorf("unable to convert Ignition spec v3_2 config to v3_1: %w", err)
547+
return ign3_2types.Config{}, fmt.Errorf("unable to convert Ignition spec v3.3 config to v3.2: %w", err)
483548
}
484-
klog.V(4).Infof("Successfully translated Ignition spec v3_2 config to Ignition spec v3_1 config: %v", converted32)
549+
klog.V(4).Infof("Successfully translated Ignition spec v3.3 config to Ignition spec v3.2 config: %v", converted32)
485550

486551
return converted32, nil
487552
}
@@ -490,9 +555,9 @@ func convertIgnition33to32(ign3config ign3_3types.Config) (ign3_2types.Config, e
490555
func convertIgnition32to31(ign3config ign3_2types.Config) (ign3_1types.Config, error) {
491556
converted31, err := v32tov31.Translate(ign3config)
492557
if err != nil {
493-
return ign3_1types.Config{}, fmt.Errorf("unable to convert Ignition spec v3_2 config to v3_1: %w", err)
558+
return ign3_1types.Config{}, fmt.Errorf("unable to convert Ignition spec v3.2 config to v3.1: %w", err)
494559
}
495-
klog.V(4).Infof("Successfully translated Ignition spec v3_2 config to Ignition spec v3_1 config: %v", converted31)
560+
klog.V(4).Infof("Successfully translated Ignition spec v3.2 config to Ignition spec v3.1 config: %v", converted31)
496561

497562
return converted31, nil
498563
}
@@ -681,7 +746,7 @@ func SupportedExtensions() map[string][]string {
681746
// a V2 or V3 Config or an error. This wrapper is necessary since V2 and V3 use different parsers.
682747
func IgnParseWrapper(rawIgn []byte) (interface{}, error) {
683748
// ParseCompatibleVersion will parse any config <= N to version N
684-
ignCfgV3, rptV3, errV3 := ign3_4.ParseCompatibleVersion(rawIgn)
749+
ignCfgV3, rptV3, errV3 := ign3_5.ParseCompatibleVersion(rawIgn)
685750
if errV3 == nil && !rptV3.IsFatal() {
686751
return ignCfgV3, nil
687752
}
@@ -690,7 +755,7 @@ func IgnParseWrapper(rawIgn []byte) (interface{}, error) {
690755
// ErrInvalidVersion ("I can't parse it to find out what it is"), but our old 3.2 logic didn't, so this is here to make sure
691756
// our error message for invalid version is still helpful.
692757
if errV3.Error() == ign3error.ErrInvalidVersion.Error() {
693-
return ign3types.Config{}, fmt.Errorf("parsing Ignition config failed: invalid version. Supported spec versions: 2.2, 3.0, 3.1, 3.2, 3.3, 3.4")
758+
return ign3types.Config{}, fmt.Errorf("parsing Ignition config failed: invalid version. Supported spec versions: 2.2, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5")
694759
}
695760

696761
if errV3.Error() == ign3error.ErrUnknownVersion.Error() {
@@ -701,7 +766,7 @@ func IgnParseWrapper(rawIgn []byte) (interface{}, error) {
701766

702767
// If the error is still UnknownVersion it's not a 3.3/3.2/3.1/3.0 or 2.x config, thus unsupported
703768
if errV2.Error() == ign2error.ErrUnknownVersion.Error() {
704-
return ign3types.Config{}, fmt.Errorf("parsing Ignition config failed: unknown version. Supported spec versions: 2.2, 3.0, 3.1, 3.2, 3.3, 3.4")
769+
return ign3types.Config{}, fmt.Errorf("parsing Ignition config failed: unknown version. Supported spec versions: 2.2, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5")
705770
}
706771
return ign3types.Config{}, fmt.Errorf("parsing Ignition spec v2 failed with error: %v\nReport: %v", errV2, rptV2)
707772
}
@@ -725,7 +790,7 @@ func ParseAndConvertConfig(rawIgn []byte) (ign3types.Config, error) {
725790
if err != nil {
726791
return ign3types.Config{}, err
727792
}
728-
convertedIgnV3, err := convertIgnition22to34(ignconfv2)
793+
convertedIgnV3, err := convertIgnition22to35(ignconfv2)
729794
if err != nil {
730795
return ign3types.Config{}, fmt.Errorf("failed to convert Ignition config spec v2 to v3: %w", err)
731796
}
@@ -930,8 +995,8 @@ func TranspileCoreOSConfigToIgn(files, units []string) (*ign3types.Config, error
930995
return nil, fmt.Errorf("failed to transpile config to Ignition config %w\nTranslation set: %v", err, tSet)
931996
}
932997
// TODO(jkyros): do we keep just...adding translations forever as we add more versions? :)
933-
ign3_2config := translate3.Translate(translate3_3.Translate(translate3_2.Translate(translate3_1.Translate(ign3_0config))))
934-
outConfig = ign3.Merge(outConfig, ign3_2config)
998+
ign3Config := translate3.Translate(translate3_4.Translate(translate3_3.Translate(translate3_2.Translate(translate3_1.Translate(ign3_0config)))))
999+
outConfig = ign3.Merge(outConfig, ign3Config)
9351000
}
9361001

9371002
for _, contents := range units {
@@ -947,8 +1012,8 @@ func TranspileCoreOSConfigToIgn(files, units []string) (*ign3types.Config, error
9471012
if err != nil {
9481013
return nil, fmt.Errorf("failed to transpile config to Ignition config %w\nTranslation set: %v", err, tSet)
9491014
}
950-
ign3_2config := translate3.Translate(translate3_3.Translate(translate3_2.Translate(translate3_1.Translate(ign3_0config))))
951-
outConfig = ign3.Merge(outConfig, ign3_2config)
1015+
ign3Config := translate3.Translate(translate3_4.Translate(translate3_3.Translate(translate3_2.Translate(translate3_1.Translate(ign3_0config)))))
1016+
outConfig = ign3.Merge(outConfig, ign3Config)
9521017
}
9531018

9541019
return &outConfig, nil

pkg/controller/common/helpers_test.go

+11-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ func TestConvertIgnition3to2(t *testing.T) {
152152
testIgn3Config := ign3types.Config{}
153153
tempUser := ign3types.PasswdUser{Name: "core", SSHAuthorizedKeys: []ign3types.SSHAuthorizedKey{"5678", "abc"}}
154154
testIgn3Config.Passwd.Users = []ign3types.PasswdUser{tempUser}
155-
testIgn3Config.Ignition.Version = "3.4.0"
155+
testIgn3Config.Ignition.Version = InternalMCOIgnitionVersion
156156
isValid := ValidateIgnition(testIgn3Config)
157157
require.Nil(t, isValid)
158158

@@ -244,6 +244,16 @@ func TestParseAndConvert(t *testing.T) {
244244
testIgn3Config.Ignition.Version = InternalMCOIgnitionVersion
245245
assert.Equal(t, testIgn3Config, convertedIgn)
246246

247+
// Make a valid Ign 3.5 cfg
248+
testIgn3Config.Ignition.Version = "3.5.0"
249+
// turn it into a raw []byte
250+
rawIgn = helpers.MarshalOrDie(testIgn3Config)
251+
// check that it was parsed successfully back to the default version
252+
convertedIgn, err = ParseAndConvertConfig(rawIgn)
253+
require.Nil(t, err)
254+
testIgn3Config.Ignition.Version = InternalMCOIgnitionVersion
255+
assert.Equal(t, testIgn3Config, convertedIgn)
256+
247257
// Make a bad Ign3 cfg
248258
testIgn3Config.Ignition.Version = "21.0.0"
249259
rawIgn = helpers.MarshalOrDie(testIgn3Config)

pkg/server/api.go

+16-3
Original file line numberDiff line numberDiff line change
@@ -152,14 +152,24 @@ func (sh *APIHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
152152
w.WriteHeader(http.StatusNotFound)
153153
return
154154
}
155-
// we know we're at 3.4 in code.. serve directly, parsing is expensive...
155+
// we know we're at 3.5 in code... serve directly, parsing is expensive...
156156
// we're doing it during an HTTP request, and most notably before we write the HTTP headers
157157
var serveConf *runtime.RawExtension
158158

159159
switch {
160-
case reqConfigVer.Equal(*semver.New("3.4.0")):
160+
case reqConfigVer.Equal(*semver.New("3.5.0")):
161161
serveConf = conf
162162

163+
case reqConfigVer.Equal(*semver.New("3.4.0")):
164+
converted34, err := ctrlcommon.ConvertRawExtIgnitionToV3_4(conf)
165+
if err != nil {
166+
w.Header().Set("Content-Length", "0")
167+
w.WriteHeader(http.StatusInternalServerError)
168+
klog.Errorf("couldn't convert config for req: %v, error: %v", cr, err)
169+
return
170+
}
171+
serveConf = &converted34
172+
163173
case reqConfigVer.Equal(*semver.New("3.3.0")):
164174
converted33, err := ctrlcommon.ConvertRawExtIgnitionToV3_3(conf)
165175
if err != nil {
@@ -319,6 +329,7 @@ func detectSpecVersionFromAcceptHeader(acceptHeader string) (*semver.Version, er
319329
v3_2 := semver.New("3.2.0")
320330
v3_3 := semver.New("3.3.0")
321331
v3_4 := semver.New("3.4.0")
332+
v3_5 := semver.New("3.5.0")
322333

323334
var ignVersionError error
324335
headers, err := parseAcceptHeader(acceptHeader)
@@ -330,7 +341,9 @@ func detectSpecVersionFromAcceptHeader(acceptHeader string) (*semver.Version, er
330341
for _, header := range headers {
331342
if header.MIMESubtype == "vnd.coreos.ignition+json" && header.SemVer != nil {
332343
switch {
333-
case !header.SemVer.LessThan(*v3_4) && header.SemVer.LessThan(*semver.New("4.0.0")):
344+
case !header.SemVer.LessThan(*v3_5) && header.SemVer.LessThan(*semver.New("4.0.0")):
345+
return v3_5, nil
346+
case !header.SemVer.LessThan(*v3_4) && header.SemVer.LessThan(*v3_5):
334347
return v3_4, nil
335348
case !header.SemVer.LessThan(*v3_3) && header.SemVer.LessThan(*v3_4):
336349
return v3_3, nil

0 commit comments

Comments
 (0)