Skip to content
/ butane Public
forked from coreos/butane

Commit

Permalink
openshift/v4.14: Use fcos 1.5 & ignition 3.4 specs
Browse files Browse the repository at this point in the history
Stabilise openshift 4.14.0 spec on fcos 1.5 and ignition 3.4 stable
specs. The MCO is now capable of understanding Ignition 3.4.0 specs and
uses that by default.

See: openshift/machine-config-operator#3576
See: openshift/machine-config-operator#3814
  • Loading branch information
travier committed Sep 21, 2023
1 parent 186b8e8 commit 3d0e3d3
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion config/openshift/v4_14/result/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
package result

import (
"github.com/coreos/ignition/v2/config/v3_5_experimental/types"
"github.com/coreos/ignition/v2/config/v3_4/types"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion config/openshift/v4_14/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
package v4_14

import (
fcos "github.com/coreos/butane/config/fcos/v1_6_exp"
fcos "github.com/coreos/butane/config/fcos/v1_5"
)

const ROLE_LABEL_KEY = "machineconfiguration.openshift.io/role"
Expand Down
16 changes: 8 additions & 8 deletions config/openshift/v4_14/translate.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"github.com/coreos/butane/translate"

"github.com/coreos/ignition/v2/config/util"
"github.com/coreos/ignition/v2/config/v3_5_experimental/types"
"github.com/coreos/ignition/v2/config/v3_4/types"
"github.com/coreos/vcontext/path"
"github.com/coreos/vcontext/report"
)
Expand Down Expand Up @@ -113,7 +113,7 @@ func (c Config) FieldFilters() *cutil.FieldFilters {
// can be tracked back to their source in the source config. No config
// validation is performed on input or output.
func (c Config) ToMachineConfig4_14Unvalidated(options common.TranslateOptions) (result.MachineConfig, translate.TranslationSet, report.Report) {
cfg, ts, r := c.Config.ToIgn3_5Unvalidated(options)
cfg, ts, r := c.Config.ToIgn3_4Unvalidated(options)
if r.IsFatal() {
return result.MachineConfig{}, ts, r
}
Expand Down Expand Up @@ -174,11 +174,11 @@ func (c Config) ToMachineConfig4_14(options common.TranslateOptions) (result.Mac
return cfg.(result.MachineConfig), r, err
}

// ToIgn3_5Unvalidated translates the config to an Ignition config. It also
// ToIgn3_4Unvalidated translates the config to an Ignition config. It also
// returns the set of translations it did so paths in the resultant config
// can be tracked back to their source in the source config. No config
// validation is performed on input or output.
func (c Config) ToIgn3_5Unvalidated(options common.TranslateOptions) (types.Config, translate.TranslationSet, report.Report) {
func (c Config) ToIgn3_4Unvalidated(options common.TranslateOptions) (types.Config, translate.TranslationSet, report.Report) {
mc, ts, r := c.ToMachineConfig4_14Unvalidated(options)
cfg := mc.Spec.Config

Expand All @@ -194,12 +194,12 @@ func (c Config) ToIgn3_5Unvalidated(options common.TranslateOptions) (types.Conf
return cfg, ts, r
}

// ToIgn3_5 translates the config to an Ignition config. It returns a
// ToIgn3_4 translates the config to an Ignition config. It returns a
// report of any errors or warnings in the source and resultant config. If
// the report has fatal errors or it encounters other problems translating,
// an error is returned.
func (c Config) ToIgn3_5(options common.TranslateOptions) (types.Config, report.Report, error) {
cfg, r, err := cutil.Translate(c, "ToIgn3_5Unvalidated", options)
func (c Config) ToIgn3_4(options common.TranslateOptions) (types.Config, report.Report, error) {
cfg, r, err := cutil.Translate(c, "ToIgn3_4Unvalidated", options)
return cfg.(types.Config), r, err
}

Expand All @@ -208,7 +208,7 @@ func (c Config) ToIgn3_5(options common.TranslateOptions) (types.Config, report.
// translating, an error is returned.
func ToConfigBytes(input []byte, options common.TranslateBytesOptions) ([]byte, report.Report, error) {
if options.Raw {
return cutil.TranslateBytes(input, &Config{}, "ToIgn3_5", options)
return cutil.TranslateBytes(input, &Config{}, "ToIgn3_4", options)
} else {
return cutil.TranslateBytesYAML(input, &Config{}, "ToMachineConfig4_14", options)
}
Expand Down
14 changes: 7 additions & 7 deletions config/openshift/v4_14/translate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ import (
"testing"

baseutil "github.com/coreos/butane/base/util"
base "github.com/coreos/butane/base/v0_6_exp"
base "github.com/coreos/butane/base/v0_5"
"github.com/coreos/butane/config/common"
fcos "github.com/coreos/butane/config/fcos/v1_6_exp"
fcos "github.com/coreos/butane/config/fcos/v1_5"
"github.com/coreos/butane/config/openshift/v4_14/result"
confutil "github.com/coreos/butane/config/util"
"github.com/coreos/butane/translate"

"github.com/coreos/ignition/v2/config/util"
"github.com/coreos/ignition/v2/config/v3_5_experimental/types"
"github.com/coreos/ignition/v2/config/v3_4/types"
"github.com/coreos/vcontext/path"
"github.com/coreos/vcontext/report"
"github.com/stretchr/testify/assert"
Expand All @@ -52,7 +52,7 @@ func TestElidedFieldWarning(t *testing.T) {
expected.AddOnWarn(path.New("yaml", "openshift", "fips"), common.ErrFieldElided)
expected.AddOnWarn(path.New("yaml", "openshift", "kernel_type"), common.ErrFieldElided)

_, _, r := in.ToIgn3_5Unvalidated(common.TranslateOptions{})
_, _, r := in.ToIgn3_4Unvalidated(common.TranslateOptions{})
assert.Equal(t, expected, r, "report mismatch")
}

Expand Down Expand Up @@ -84,7 +84,7 @@ func TestTranslateConfig(t *testing.T) {
Spec: result.Spec{
Config: types.Config{
Ignition: types.Ignition{
Version: "3.5.0-experimental",
Version: "3.4.0",
},
},
},
Expand Down Expand Up @@ -159,7 +159,7 @@ func TestTranslateConfig(t *testing.T) {
Spec: result.Spec{
Config: types.Config{
Ignition: types.Ignition{
Version: "3.5.0-experimental",
Version: "3.4.0",
},
Storage: types.Storage{
Filesystems: []types.Filesystem{
Expand Down Expand Up @@ -304,7 +304,7 @@ func TestTranslateConfig(t *testing.T) {
Spec: result.Spec{
Config: types.Config{
Ignition: types.Ignition{
Version: "3.5.0-experimental",
Version: "3.4.0",
},
Storage: types.Storage{
Filesystems: []types.Filesystem{
Expand Down
2 changes: 1 addition & 1 deletion docs/config-openshift-v4_14.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The OpenShift configuration is a YAML document conforming to the following speci
<div id="spec-docs"></div>

* **variant** (string): used to differentiate configs for different operating systems. Must be `openshift` for this specification.
* **version** (string): the semantic version of the spec for this document. This document is for version `4.14.0` and generates Ignition configs with version `3.5.0-experimental`.
* **version** (string): the semantic version of the spec for this document. This document is for version `4.14.0` and generates Ignition configs with version `3.4.0`.
* **metadata** (object): metadata about the generated MachineConfig resource. Respected when rendering to a MachineConfig, ignored when rendering directly to an Ignition config.
* **name** (string): a unique [name](https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names) for this MachineConfig resource.
* **labels** (object): string key/value pairs to apply as [Kubernetes labels](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/) to this MachineConfig resource. `machineconfiguration.openshift.io/role` is required.
Expand Down

0 comments on commit 3d0e3d3

Please sign in to comment.