Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*: Ign spec 3 upgrade #1873

Merged
merged 2 commits into from Jul 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions go.sum
Expand Up @@ -131,6 +131,7 @@ github.com/coreos/vcontext v0.0.0-20190529201340-22b159166068 h1:y2aHj7QqyAJ6YBB
github.com/coreos/vcontext v0.0.0-20190529201340-22b159166068/go.mod h1:E+6hug9bFSe0KZ2ZAzr8M9F5JlArJjv5D1JS7KSkPKE=
github.com/coreos/vcontext v0.0.0-20191017033345-260217907eb5 h1:DjoHHi6+9J7DGYPvBdmszKZLY+ucx2bnA77jf8KIk9M=
github.com/coreos/vcontext v0.0.0-20191017033345-260217907eb5/go.mod h1:E+6hug9bFSe0KZ2ZAzr8M9F5JlArJjv5D1JS7KSkPKE=
github.com/coreos/vcontext v0.0.0-20200225161404-ee043618d38d h1:Nu473BdYOxcnhFfPrl1ihpCtxI/VZr2IfhVIHDGP43Y=
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down
42 changes: 21 additions & 21 deletions lib/resourceapply/machineconfig_test.go
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"testing"

igntypes "github.com/coreos/ignition/config/v2_2/types"
ign3types "github.com/coreos/ignition/v2/config/v3_1/types"
"github.com/davecgh/go-spew/spew"
mcfgv1 "github.com/openshift/machine-config-operator/pkg/apis/machineconfiguration.openshift.io/v1"
"github.com/openshift/machine-config-operator/pkg/generated/clientset/versioned/fake"
Expand Down Expand Up @@ -177,10 +177,10 @@ func TestApplyMachineConfig(t *testing.T) {
ObjectMeta: metav1.ObjectMeta{Name: "foo"},
Spec: mcfgv1.MachineConfigSpec{
Config: runtime.RawExtension{
Raw: helpers.MarshalOrDie(&igntypes.Config{
Passwd: igntypes.Passwd{
Users: []igntypes.PasswdUser{{
HomeDir: "/home/dummy",
Raw: helpers.MarshalOrDie(&ign3types.Config{
Passwd: ign3types.Passwd{
Users: []ign3types.PasswdUser{{
HomeDir: helpers.StrToPtr("/home/dummy"),
}},
},
}),
Expand All @@ -203,10 +203,10 @@ func TestApplyMachineConfig(t *testing.T) {
ObjectMeta: metav1.ObjectMeta{Name: "foo", Labels: map[string]string{"extra": "leave-alone"}},
Spec: mcfgv1.MachineConfigSpec{
Config: runtime.RawExtension{
Raw: helpers.MarshalOrDie(&igntypes.Config{
Passwd: igntypes.Passwd{
Users: []igntypes.PasswdUser{{
HomeDir: "/home/dummy",
Raw: helpers.MarshalOrDie(&ign3types.Config{
Passwd: ign3types.Passwd{
Users: []ign3types.PasswdUser{{
HomeDir: helpers.StrToPtr("/home/dummy"),
}},
},
}),
Expand All @@ -224,10 +224,10 @@ func TestApplyMachineConfig(t *testing.T) {
ObjectMeta: metav1.ObjectMeta{Name: "foo", Labels: map[string]string{"extra": "leave-alone"}},
Spec: mcfgv1.MachineConfigSpec{
Config: runtime.RawExtension{
Raw: helpers.MarshalOrDie(&igntypes.Config{
Passwd: igntypes.Passwd{
Users: []igntypes.PasswdUser{{
HomeDir: "/home/dummy-prev",
Raw: helpers.MarshalOrDie(&ign3types.Config{
Passwd: ign3types.Passwd{
Users: []ign3types.PasswdUser{{
HomeDir: helpers.StrToPtr("/home/dummy-prev"),
}},
},
}),
Expand All @@ -239,10 +239,10 @@ func TestApplyMachineConfig(t *testing.T) {
ObjectMeta: metav1.ObjectMeta{Name: "foo"},
Spec: mcfgv1.MachineConfigSpec{
Config: runtime.RawExtension{
Raw: helpers.MarshalOrDie(&igntypes.Config{
Passwd: igntypes.Passwd{
Users: []igntypes.PasswdUser{{
HomeDir: "/home/dummy",
Raw: helpers.MarshalOrDie(&ign3types.Config{
Passwd: ign3types.Passwd{
Users: []ign3types.PasswdUser{{
HomeDir: helpers.StrToPtr("/home/dummy"),
}},
},
}),
Expand All @@ -265,10 +265,10 @@ func TestApplyMachineConfig(t *testing.T) {
ObjectMeta: metav1.ObjectMeta{Name: "foo", Labels: map[string]string{"extra": "leave-alone"}},
Spec: mcfgv1.MachineConfigSpec{
Config: runtime.RawExtension{
Raw: helpers.MarshalOrDie(&igntypes.Config{
Passwd: igntypes.Passwd{
Users: []igntypes.PasswdUser{{
HomeDir: "/home/dummy",
Raw: helpers.MarshalOrDie(&ign3types.Config{
Passwd: ign3types.Passwd{
Users: []ign3types.PasswdUser{{
HomeDir: helpers.StrToPtr("/home/dummy"),
}},
},
}),
Expand Down
8 changes: 4 additions & 4 deletions pkg/controller/bootstrap/bootstrap_test.go
Expand Up @@ -9,7 +9,7 @@ import (
"strings"
"testing"

igntypes "github.com/coreos/ignition/config/v2_2/types"
ign3types "github.com/coreos/ignition/v2/config/v3_1/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/vincent-petithory/dataurl"
Expand Down Expand Up @@ -149,8 +149,8 @@ func TestBootstrapRun(t *testing.T) {
require.NoError(t, err)

// Ensure that generated registries.conf corresponds to the testdata ImageContentSourcePolicy
var registriesConfig *igntypes.File
ignCfg, err := ctrlcommon.IgnParseWrapper(mc.Spec.Config.Raw)
var registriesConfig *ign3types.File
ignCfg, err := ctrlcommon.ParseAndConvertConfig(mc.Spec.Config.Raw)
require.NoError(t, err)
for i := range ignCfg.Storage.Files {
f := &ignCfg.Storage.Files[i]
Expand All @@ -159,7 +159,7 @@ func TestBootstrapRun(t *testing.T) {
}
}
require.NotNil(t, registriesConfig)
dataURL, err := dataurl.DecodeString(registriesConfig.Contents.Source)
dataURL, err := dataurl.DecodeString(*registriesConfig.Contents.Source)
require.NoError(t, err)
// Only a minimal presence check; more comprehensive tests that the contents correspond to the ICSP semantics are
// maintained in pkg/controller/continer-runtime-config.
Expand Down
Expand Up @@ -13,8 +13,7 @@ spec:
security:
tls: {}
timeouts: {}
version: 2.2.0
networkd: {}
version: 3.1.0
passwd:
users:
- name: core
Expand Down
Expand Up @@ -13,8 +13,7 @@ spec:
security:
tls: {}
timeouts: {}
version: 2.2.0
networkd: {}
version: 3.1.0
passwd:
users:
- name: core
Expand Down