Skip to content

Commit

Permalink
openshift/v4_15_exp: Update spec to 4.15.0-experimental
Browse files Browse the repository at this point in the history
  • Loading branch information
travier committed Sep 21, 2023
1 parent 0f43b1b commit a7b2550
Show file tree
Hide file tree
Showing 9 changed files with 203 additions and 18 deletions.
2 changes: 2 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (
openshift4_12 "github.com/coreos/butane/config/openshift/v4_12"
openshift4_13 "github.com/coreos/butane/config/openshift/v4_13"
openshift4_14_exp "github.com/coreos/butane/config/openshift/v4_14_exp"
openshift4_15_exp "github.com/coreos/butane/config/openshift/v4_15_exp"
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 @@ -72,6 +73,7 @@ func init() {
RegisterTranslator("openshift", "4.12.0", openshift4_12.ToConfigBytes)
RegisterTranslator("openshift", "4.13.0", openshift4_13.ToConfigBytes)
RegisterTranslator("openshift", "4.14.0-experimental", openshift4_14_exp.ToConfigBytes)
RegisterTranslator("openshift", "4.15.0-experimental", openshift4_15_exp.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
2 changes: 1 addition & 1 deletion config/openshift/v4_15_exp/schema.go
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_14_exp
package v4_15_exp

import (
fcos "github.com/coreos/butane/config/fcos/v1_6_exp"
Expand Down
20 changes: 10 additions & 10 deletions config/openshift/v4_15_exp/translate.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.)

package v4_14_exp
package v4_15_exp

import (
"net/url"
"strings"

"github.com/coreos/butane/config/common"
"github.com/coreos/butane/config/openshift/v4_14_exp/result"
"github.com/coreos/butane/config/openshift/v4_15_exp/result"
cutil "github.com/coreos/butane/config/util"
"github.com/coreos/butane/translate"

Expand Down Expand Up @@ -108,11 +108,11 @@ func (c Config) FieldFilters() *cutil.FieldFilters {
return &fieldFilters
}

// ToMachineConfig4_14Unvalidated translates the config to a MachineConfig. It also
// ToMachineConfig4_15Unvalidated translates the config to a MachineConfig. 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) ToMachineConfig4_14Unvalidated(options common.TranslateOptions) (result.MachineConfig, translate.TranslationSet, report.Report) {
func (c Config) ToMachineConfig4_15Unvalidated(options common.TranslateOptions) (result.MachineConfig, translate.TranslationSet, report.Report) {
cfg, ts, r := c.Config.ToIgn3_5Unvalidated(options)
if r.IsFatal() {
return result.MachineConfig{}, ts, r
Expand Down Expand Up @@ -165,12 +165,12 @@ func (c Config) ToMachineConfig4_14Unvalidated(options common.TranslateOptions)
return mc, ts, r
}

// ToMachineConfig4_14 translates the config to a MachineConfig. It returns a
// ToMachineConfig4_15 translates the config to a MachineConfig. 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) ToMachineConfig4_14(options common.TranslateOptions) (result.MachineConfig, report.Report, error) {
cfg, r, err := cutil.Translate(c, "ToMachineConfig4_14Unvalidated", options)
func (c Config) ToMachineConfig4_15(options common.TranslateOptions) (result.MachineConfig, report.Report, error) {
cfg, r, err := cutil.Translate(c, "ToMachineConfig4_15Unvalidated", options)
return cfg.(result.MachineConfig), r, err
}

Expand All @@ -179,7 +179,7 @@ func (c Config) ToMachineConfig4_14(options common.TranslateOptions) (result.Mac
// 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) {
mc, ts, r := c.ToMachineConfig4_14Unvalidated(options)
mc, ts, r := c.ToMachineConfig4_15Unvalidated(options)
cfg := mc.Spec.Config

// report warnings if there are any non-empty fields in Spec (other
Expand All @@ -203,14 +203,14 @@ func (c Config) ToIgn3_5(options common.TranslateOptions) (types.Config, report.
return cfg.(types.Config), r, err
}

// ToConfigBytes translates from a v4.14 Butane config to a v4.14 MachineConfig or a v3.4.0 Ignition config. It returns a report of any errors or
// ToConfigBytes translates from a v4.15 Butane config to a v4.15 MachineConfig or a v3.5.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)
} else {
return cutil.TranslateBytesYAML(input, &Config{}, "ToMachineConfig4_14", options)
return cutil.TranslateBytesYAML(input, &Config{}, "ToMachineConfig4_15", options)
}
}

Expand Down
8 changes: 4 additions & 4 deletions config/openshift/v4_15_exp/translate_test.go
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_14_exp
package v4_15_exp

import (
"fmt"
Expand All @@ -22,7 +22,7 @@ import (
base "github.com/coreos/butane/base/v0_6_exp"
"github.com/coreos/butane/config/common"
fcos "github.com/coreos/butane/config/fcos/v1_6_exp"
"github.com/coreos/butane/config/openshift/v4_14_exp/result"
"github.com/coreos/butane/config/openshift/v4_15_exp/result"
confutil "github.com/coreos/butane/config/util"
"github.com/coreos/butane/translate"

Expand Down Expand Up @@ -359,7 +359,7 @@ func TestTranslateConfig(t *testing.T) {

for i, test := range tests {
t.Run(fmt.Sprintf("translate %d", i), func(t *testing.T) {
actual, translations, r := test.in.ToMachineConfig4_14Unvalidated(common.TranslateOptions{})
actual, translations, r := test.in.ToMachineConfig4_15Unvalidated(common.TranslateOptions{})
r = confutil.TranslateReportPaths(r, translations)
baseutil.VerifyReport(t, test.in, r)
assert.Equal(t, test.out, actual, "translation mismatch")
Expand Down Expand Up @@ -587,7 +587,7 @@ func TestValidateSupport(t *testing.T) {
for _, entry := range test.entries {
expectedReport.AddOn(entry.path, entry.err, entry.kind)
}
actual, translations, r := test.in.ToMachineConfig4_14Unvalidated(common.TranslateOptions{})
actual, translations, r := test.in.ToMachineConfig4_15Unvalidated(common.TranslateOptions{})
r.Merge(fieldFilters.Verify(actual))
r = confutil.TranslateReportPaths(r, translations)
baseutil.VerifyReport(t, test.in, r)
Expand Down
2 changes: 1 addition & 1 deletion config/openshift/v4_15_exp/validate.go
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_14_exp
package v4_15_exp

import (
"github.com/coreos/butane/config/common"
Expand Down
2 changes: 1 addition & 1 deletion config/openshift/v4_15_exp/validate_test.go
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_14_exp
package v4_15_exp

import (
"fmt"
Expand Down
Loading

0 comments on commit a7b2550

Please sign in to comment.