diff --git a/hack/runtime-migrator/main.go b/hack/runtime-migrator/main.go index ca5adcef..da38ce41 100644 --- a/hack/runtime-migrator/main.go +++ b/hack/runtime-migrator/main.go @@ -206,7 +206,7 @@ func createRuntime(ctx context.Context, shoot v1beta1.Shoot, cfg migrator.Config }, Provider: v1.Provider{ Type: shoot.Spec.Provider.Type, - Workers: shoot.Spec.Provider.Workers, + Workers: adjustWorkersConfig(shoot.Spec.Provider.Workers), }, Networking: v1.Networking{ Type: shoot.Spec.Networking.Type, @@ -214,7 +214,6 @@ func createRuntime(ctx context.Context, shoot v1beta1.Shoot, cfg migrator.Config Nodes: *shoot.Spec.Networking.Nodes, Services: *shoot.Spec.Networking.Services, }, - ControlPlane: getControlPlane(shoot), }, Security: v1.Security{ Administrators: subjects, @@ -235,9 +234,28 @@ func createRuntime(ctx context.Context, shoot v1beta1.Shoot, cfg migrator.Config Conditions: nil, // deliberately left nil by our migrator to show that controller has not picked it yet }, } + + controlPlane := getControlPlane(shoot) + if controlPlane != nil { + runtime.Spec.Shoot.ControlPlane = controlPlane + } + return runtime, nil } +// The goal of this function is to make the migrator output equal to the shoot created by the converter +// As a result we can automatically verify the correctness of the migrator output +func adjustWorkersConfig(workers []v1beta1.Worker) []v1beta1.Worker { + // We need to set the following fields to nil, as they are not set by the KIM converter + for i := 0; i < len(workers); i++ { + workers[i].Machine.Architecture = nil + workers[i].SystemComponents = nil + workers[i].CRI = nil + } + + return workers +} + func getOidcConfig(shoot v1beta1.Shoot) v1beta1.OIDCConfig { var oidcConfig = v1beta1.OIDCConfig{ CABundle: nil, // deliberately left empty