Skip to content

Commit

Permalink
openshift/v4.16: Stabilize 4.16.0 spec
Browse files Browse the repository at this point in the history
  • Loading branch information
yasminvalim committed May 29, 2024
1 parent 97b9123 commit 0c9a587
Show file tree
Hide file tree
Showing 19 changed files with 52 additions and 218 deletions.
4 changes: 2 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import (
openshift4_13 "github.com/coreos/butane/config/openshift/v4_13"
openshift4_14 "github.com/coreos/butane/config/openshift/v4_14"
openshift4_15 "github.com/coreos/butane/config/openshift/v4_15"
openshift4_16_exp "github.com/coreos/butane/config/openshift/v4_16_exp"
openshift4_16 "github.com/coreos/butane/config/openshift/v4_16"
openshift4_8 "github.com/coreos/butane/config/openshift/v4_8"
openshift4_9 "github.com/coreos/butane/config/openshift/v4_9"
r4e1_0 "github.com/coreos/butane/config/r4e/v1_0"
Expand Down Expand Up @@ -77,7 +77,7 @@ func init() {
RegisterTranslator("openshift", "4.13.0", openshift4_13.ToConfigBytes)
RegisterTranslator("openshift", "4.14.0", openshift4_14.ToConfigBytes)
RegisterTranslator("openshift", "4.15.0", openshift4_15.ToConfigBytes)
RegisterTranslator("openshift", "4.16.0-experimental", openshift4_16_exp.ToConfigBytes)
RegisterTranslator("openshift", "4.16.0", openshift4_16.ToConfigBytes)
RegisterTranslator("r4e", "1.0.0", r4e1_0.ToIgn3_3Bytes)
RegisterTranslator("r4e", "1.1.0", r4e1_1.ToIgn3_4Bytes)
RegisterTranslator("r4e", "1.2.0-experimental", r4e1_2_exp.ToIgn3_5Bytes)
Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.)

package v4_16_exp
package v4_16

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
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@
// See the License for the specific language governing permissions and
// limitations under the License.)

package v4_16_exp
package v4_16

import (
"net/url"
"strings"

"github.com/coreos/butane/config/common"
"github.com/coreos/butane/config/openshift/v4_16_exp/result"
"github.com/coreos/butane/config/openshift/v4_16/result"
cutil "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"
)
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_16Unvalidated(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_16(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_16Unvalidated(options)
cfg := mc.Spec.Config

Expand All @@ -194,21 +194,21 @@ 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
}

// ToConfigBytes translates from a v4.16 Butane config to a v4.16 MachineConfig or a v3.5.0 Ignition config. It returns a report of any errors or
// ToConfigBytes translates from a v4.16 Butane config to a v4.16 MachineConfig or a v3.4.0 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 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{}, "ToIgn4", options)
} else {
return cutil.TranslateBytesYAML(input, &Config{}, "ToMachineConfig4_16", options)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@
// See the License for the specific language governing permissions and
// limitations under the License.)

package v4_16_exp
package v4_16

import (
"fmt"
"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"
"github.com/coreos/butane/config/openshift/v4_16_exp/result"
fcos "github.com/coreos/butane/config/fcos/v1_5"
"github.com/coreos/butane/config/openshift/v4_16/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
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.)

package v4_16_exp
package v4_16

import (
"github.com/coreos/butane/config/common"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.)

package v4_16_exp
package v4_16

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion docs/config-openshift-v4_10.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# config/doc. Do not edit.
title: OpenShift v4.10.0
parent: Configuration specifications
nav_order: 147
nav_order: 148
---

# OpenShift Specification v4.10.0
Expand Down
2 changes: 1 addition & 1 deletion docs/config-openshift-v4_11.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# config/doc. Do not edit.
title: OpenShift v4.11.0
parent: Configuration specifications
nav_order: 146
nav_order: 147
---

# OpenShift Specification v4.11.0
Expand Down
2 changes: 1 addition & 1 deletion docs/config-openshift-v4_12.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# config/doc. Do not edit.
title: OpenShift v4.12.0
parent: Configuration specifications
nav_order: 145
nav_order: 146
---

# OpenShift Specification v4.12.0
Expand Down
2 changes: 1 addition & 1 deletion docs/config-openshift-v4_13.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# config/doc. Do not edit.
title: OpenShift v4.13.0
parent: Configuration specifications
nav_order: 144
nav_order: 145
---

# OpenShift Specification v4.13.0
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 @@ -3,7 +3,7 @@
# config/doc. Do not edit.
title: OpenShift v4.14.0
parent: Configuration specifications
nav_order: 143
nav_order: 144
---

# OpenShift Specification v4.14.0
Expand Down
2 changes: 1 addition & 1 deletion docs/config-openshift-v4_15.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# config/doc. Do not edit.
title: OpenShift v4.15.0
parent: Configuration specifications
nav_order: 142
nav_order: 143
---

# OpenShift Specification v4.15.0
Expand Down
Loading

0 comments on commit 0c9a587

Please sign in to comment.