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

MULTIARCH-4569: aws: support multi-arch nodes #8698

Merged
merged 3 commits into from
Jul 19, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/asset/cluster/openstack/openstack.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ func PreTerraform(ctx context.Context, tfvarsFile *asset.File, installConfig *in
// upload the corresponding image to Glance if rhcosImage contains a
// URL. If rhcosImage contains a name, then that points to an existing
// Glance image.
if imageName, isURL := rhcos.GenerateOpenStackImageName(string(*rhcosImage), clusterID.InfraID); isURL {
if err := preprovision.UploadBaseImage(ctx, installConfig.Config.Platform.OpenStack.Cloud, string(*rhcosImage), imageName, clusterID.InfraID, installConfig.Config.Platform.OpenStack.ClusterOSImageProperties); err != nil {
if imageName, isURL := rhcos.GenerateOpenStackImageName(rhcosImage.ControlPlane, clusterID.InfraID); isURL {
if err := preprovision.UploadBaseImage(ctx, installConfig.Config.Platform.OpenStack.Cloud, rhcosImage.ControlPlane, imageName, clusterID.InfraID, installConfig.Config.Platform.OpenStack.ClusterOSImageProperties); err != nil {
return err
}
}
Expand Down
14 changes: 7 additions & 7 deletions pkg/asset/cluster/tfvars/tfvars.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ func (t *TerraformVariables) Generate(ctx context.Context, parents asset.Parents
for i, m := range workers {
workerConfigs[i] = m.Spec.Template.Spec.ProviderSpec.Value.Object.(*machinev1beta1.AWSMachineProviderConfig) //nolint:errcheck // legacy, pre-linter
}
osImage := strings.SplitN(string(*rhcosImage), ",", 2)
osImage := strings.SplitN(rhcosImage.ControlPlane, ",", 2)
osImageID := osImage[0]
osImageRegion := installConfig.Config.AWS.Region
if len(osImage) == 2 {
Expand Down Expand Up @@ -416,7 +416,7 @@ func (t *TerraformVariables) Generate(ctx context.Context, parents asset.Parents
BaseDomainResourceGroupName: installConfig.Config.Azure.BaseDomainResourceGroupName,
MasterConfigs: masterConfigs,
WorkerConfigs: workerConfigs,
ImageURL: string(*rhcosImage),
ImageURL: rhcosImage.ControlPlane,
ImageRelease: rhcosRelease.GetAzureReleaseVersion(),
PreexistingNetwork: preexistingnetwork,
Publish: installConfig.Config.Publish,
Expand Down Expand Up @@ -730,7 +730,7 @@ func (t *TerraformVariables) Generate(ctx context.Context, parents asset.Parents
CISInstanceCRN: cisCRN,
DNSInstanceID: dnsID,
EndpointsJSONFile: endpointsJSONFile,
ImageURL: string(*rhcosImage),
ImageURL: rhcosImage.ControlPlane,
MasterConfigs: masterConfigs,
MasterDedicatedHosts: masterDedicatedHosts,
NetworkResourceGroupName: installConfig.Config.Platform.IBMCloud.NetworkResourceGroupName,
Expand All @@ -756,7 +756,7 @@ func (t *TerraformVariables) Generate(ctx context.Context, parents asset.Parents
installConfig,
mastersAsset,
workersAsset,
string(*rhcosImage),
rhcosImage.ControlPlane,
clusterID,
bootstrapIgn,
)
Expand Down Expand Up @@ -828,7 +828,7 @@ func (t *TerraformVariables) Generate(ctx context.Context, parents asset.Parents
installConfig.Config.Platform.Ovirt.StorageDomainID,
installConfig.Config.Platform.Ovirt.NetworkName,
installConfig.Config.Platform.Ovirt.VNICProfileID,
string(*rhcosImage),
rhcosImage.ControlPlane,
clusterID.InfraID,
masters[0].Spec.ProviderSpec.Value.Object.(*ovirtprovider.OvirtMachineProviderSpec),
installConfig.Config.Platform.Ovirt.AffinityGroups,
Expand Down Expand Up @@ -966,7 +966,7 @@ func (t *TerraformVariables) Generate(ctx context.Context, parents asset.Parents
return err
}

osImage := strings.SplitN(string(*rhcosImage), "/", 2)
osImage := strings.SplitN(rhcosImage.ControlPlane, "/", 2)
data, err = powervstfvars.TFVars(
powervstfvars.TFVarsSources{
MasterConfigs: masterConfigs,
Expand Down Expand Up @@ -1015,7 +1015,7 @@ func (t *TerraformVariables) Generate(ctx context.Context, parents asset.Parents
controlPlaneConfigs[i] = c.Spec.ProviderSpec.Value.Object.(*machinev1.NutanixMachineProviderConfig) //nolint:errcheck // legacy, pre-linter
}

imgURI := string(*rhcosImage)
imgURI := rhcosImage.ControlPlane
if installConfig.Config.Nutanix.ClusterOSImage != "" {
imgURI = installConfig.Config.Nutanix.ClusterOSImage
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/asset/ignition/bootstrap/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ func (a *Common) getTemplateData(dependencies asset.Parents, bootstrapInPlace bo
EtcdCluster: strings.Join(etcdEndpoints, ","),
Proxy: &proxy.Config.Status,
Registries: registries,
BootImage: string(*rhcosImage),
BootImage: rhcosImage.ControlPlane,
PlatformData: platformData,
ClusterProfile: clusterProfile,
BootstrapInPlace: bootstrapInPlaceConfig,
Expand Down
8 changes: 4 additions & 4 deletions pkg/asset/machines/clusterapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func (c *ClusterAPI) Generate(ctx context.Context, dependencies asset.Parents) e

mpool := defaultAWSMachinePoolPlatform("master")

osImage := strings.SplitN(string(*rhcosImage), ",", 2)
osImage := strings.SplitN(rhcosImage.ControlPlane, ",", 2)
osImageID := osImage[0]
if len(osImage) == 2 {
osImageID = "" // the AMI will be generated later on
Expand Down Expand Up @@ -298,7 +298,7 @@ func (c *ClusterAPI) Generate(ctx context.Context, dependencies asset.Parents) e
installConfig,
clusterID.InfraID,
&pool,
string(*rhcosImage),
rhcosImage.ControlPlane,
)
if err != nil {
return fmt.Errorf("failed to create master machine objects %w", err)
Expand All @@ -311,7 +311,7 @@ func (c *ClusterAPI) Generate(ctx context.Context, dependencies asset.Parents) e
installConfig,
clusterID.InfraID,
&pool,
string(*rhcosImage),
rhcosImage.ControlPlane,
)
if err != nil {
return fmt.Errorf("failed to create bootstrap machine objects %w", err)
Expand Down Expand Up @@ -394,7 +394,7 @@ func (c *ClusterAPI) Generate(ctx context.Context, dependencies asset.Parents) e
mpool.Set(pool.Platform.OpenStack)
pool.Platform.OpenStack = &mpool

imageName, _ := rhcosutils.GenerateOpenStackImageName(string(*rhcosImage), clusterID.InfraID)
imageName, _ := rhcosutils.GenerateOpenStackImageName(rhcosImage.ControlPlane, clusterID.InfraID)

for _, role := range []string{"master", "bootstrap"} {
openStackMachines, err := openstack.GenerateMachines(
Expand Down
10 changes: 5 additions & 5 deletions pkg/asset/machines/master.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ func (m *Master) Generate(ctx context.Context, dependencies asset.Parents) error

mpool := defaultAWSMachinePoolPlatform("master")

osImage := strings.SplitN(string(*rhcosImage), ",", 2)
osImage := strings.SplitN(rhcosImage.ControlPlane, ",", 2)
osImageID := osImage[0]
if len(osImage) == 2 {
osImageID = "" // the AMI will be generated later on
Expand Down Expand Up @@ -257,7 +257,7 @@ func (m *Master) Generate(ctx context.Context, dependencies asset.Parents) error
mpool.Zones = azs
}
pool.Platform.GCP = &mpool
machines, controlPlaneMachineSet, err = gcp.Machines(clusterID.InfraID, ic, &pool, string(*rhcosImage), "master", masterUserDataSecretName)
machines, controlPlaneMachineSet, err = gcp.Machines(clusterID.InfraID, ic, &pool, rhcosImage.ControlPlane, "master", masterUserDataSecretName)
if err != nil {
return errors.Wrap(err, "failed to create master machine objects")
}
Expand Down Expand Up @@ -319,7 +319,7 @@ func (m *Master) Generate(ctx context.Context, dependencies asset.Parents) error
mpool.Set(pool.Platform.OpenStack)
pool.Platform.OpenStack = &mpool

imageName, _ := rhcosutils.GenerateOpenStackImageName(string(*rhcosImage), clusterID.InfraID)
imageName, _ := rhcosutils.GenerateOpenStackImageName(rhcosImage.ControlPlane, clusterID.InfraID)

machines, controlPlaneMachineSet, err = openstack.Machines(ctx, clusterID.InfraID, ic, &pool, imageName, "master", masterUserDataSecretName)
if err != nil {
Expand Down Expand Up @@ -378,7 +378,7 @@ func (m *Master) Generate(ctx context.Context, dependencies asset.Parents) error
return err
}
useImageGallery := installConfig.Azure.CloudName != azuretypes.StackCloud
machines, controlPlaneMachineSet, err = azure.Machines(clusterID.InfraID, ic, &pool, string(*rhcosImage), "master", masterUserDataSecretName, capabilities, useImageGallery)
machines, controlPlaneMachineSet, err = azure.Machines(clusterID.InfraID, ic, &pool, rhcosImage.ControlPlane, "master", masterUserDataSecretName, capabilities, useImageGallery)
if err != nil {
return errors.Wrap(err, "failed to create master machine objects")
}
Expand Down Expand Up @@ -430,7 +430,7 @@ func (m *Master) Generate(ctx context.Context, dependencies asset.Parents) error
mpool.Set(pool.Platform.Ovirt)
pool.Platform.Ovirt = &mpool

imageName, _ := rhcosutils.GenerateOpenStackImageName(string(*rhcosImage), clusterID.InfraID)
imageName, _ := rhcosutils.GenerateOpenStackImageName(rhcosImage.ControlPlane, clusterID.InfraID)

machines, err = ovirt.Machines(clusterID.InfraID, ic, &pool, imageName, "master", masterUserDataSecretName)
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions pkg/asset/machines/master_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ spec:
},
},
}),
(*rhcos.Image)(pointer.StringPtr("test-image")),
rhcos.MakeAsset("test-image"),
(*rhcos.Release)(pointer.StringPtr("412.86.202208101040-0")),
&machine.Master{
File: &asset.File{
Expand Down Expand Up @@ -223,7 +223,7 @@ func TestControlPlaneIsNotModified(t *testing.T) {
InfraID: "test-infra-id",
},
installConfig,
(*rhcos.Image)(pointer.StringPtr("test-image")),
rhcos.MakeAsset("test-image"),
(*rhcos.Release)(pointer.StringPtr("412.86.202208101040-0")),
&machine.Master{
File: &asset.File{
Expand Down Expand Up @@ -292,7 +292,7 @@ func TestBaremetalGeneratedAssetFiles(t *testing.T) {
InfraID: "test-infra-id",
},
installConfig,
(*rhcos.Image)(pointer.StringPtr("test-image")),
rhcos.MakeAsset("test-image"),
(*rhcos.Release)(pointer.StringPtr("412.86.202208101040-0")),
&machine.Master{
File: &asset.File{
Expand Down
16 changes: 10 additions & 6 deletions pkg/asset/machines/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ func (w *Worker) Generate(ctx context.Context, dependencies asset.Parents) error
}
mpool := defaultAWSMachinePoolPlatform(pool.Name)

osImage := strings.SplitN(string(*rhcosImage), ",", 2)
osImage := strings.SplitN(rhcosImage.Compute, ",", 2)
osImageID := osImage[0]
if len(osImage) == 2 {
osImageID = "" // the AMI will be generated later on
Expand Down Expand Up @@ -399,7 +399,11 @@ func (w *Worker) Generate(ctx context.Context, dependencies asset.Parents) error
}

if mpool.InstanceType == "" {
instanceTypes := awsdefaults.InstanceTypes(installConfig.Config.Platform.AWS.Region, installConfig.Config.ControlPlane.Architecture, configv1.HighlyAvailableTopologyMode)
arch := installConfig.Config.ControlPlane.Architecture
Prashanth684 marked this conversation as resolved.
Show resolved Hide resolved
if len(installConfig.Config.Compute) > 0 {
arch = installConfig.Config.Compute[0].Architecture
}
instanceTypes := awsdefaults.InstanceTypes(installConfig.Config.Platform.AWS.Region, arch, configv1.HighlyAvailableTopologyMode)
switch pool.Name {
case types.MachinePoolEdgeRoleName:
ok := awsSetPreferredInstanceByEdgeZone(ctx, instanceTypes, installConfig.AWS, zones)
Expand Down Expand Up @@ -488,7 +492,7 @@ func (w *Worker) Generate(ctx context.Context, dependencies asset.Parents) error
}

useImageGallery := ic.Platform.Azure.CloudName != azuretypes.StackCloud
sets, err := azure.MachineSets(clusterID.InfraID, ic, &pool, string(*rhcosImage), "worker", workerUserDataSecretName, capabilities, useImageGallery)
sets, err := azure.MachineSets(clusterID.InfraID, ic, &pool, rhcosImage.Compute, "worker", workerUserDataSecretName, capabilities, useImageGallery)
if err != nil {
return errors.Wrap(err, "failed to create worker machine objects")
}
Expand Down Expand Up @@ -523,7 +527,7 @@ func (w *Worker) Generate(ctx context.Context, dependencies asset.Parents) error
mpool.Zones = azs
}
pool.Platform.GCP = &mpool
sets, err := gcp.MachineSets(clusterID.InfraID, ic, &pool, string(*rhcosImage), "worker", workerUserDataSecretName)
sets, err := gcp.MachineSets(clusterID.InfraID, ic, &pool, rhcosImage.Compute, "worker", workerUserDataSecretName)
if err != nil {
return errors.Wrap(err, "failed to create worker machine objects")
}
Expand Down Expand Up @@ -565,7 +569,7 @@ func (w *Worker) Generate(ctx context.Context, dependencies asset.Parents) error
mpool.Set(pool.Platform.OpenStack)
pool.Platform.OpenStack = &mpool

imageName, _ := rhcosutils.GenerateOpenStackImageName(string(*rhcosImage), clusterID.InfraID)
imageName, _ := rhcosutils.GenerateOpenStackImageName(rhcosImage.Compute, clusterID.InfraID)

sets, err := openstack.MachineSets(ctx, clusterID.InfraID, ic, &pool, imageName, "worker", workerUserDataSecretName)
if err != nil {
Expand Down Expand Up @@ -615,7 +619,7 @@ func (w *Worker) Generate(ctx context.Context, dependencies asset.Parents) error
mpool.Set(pool.Platform.Ovirt)
pool.Platform.Ovirt = &mpool

imageName, _ := rhcosutils.GenerateOpenStackImageName(string(*rhcosImage), clusterID.InfraID)
imageName, _ := rhcosutils.GenerateOpenStackImageName(rhcosImage.Compute, clusterID.InfraID)

sets, err := ovirt.MachineSets(clusterID.InfraID, ic, &pool, imageName, "worker", workerUserDataSecretName)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions pkg/asset/machines/worker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ spec:
},
},
}),
(*rhcos.Image)(pointer.StringPtr("test-image")),
rhcos.MakeAsset("test-image"),
(*rhcos.Release)(pointer.StringPtr("412.86.202208101040-0")),
&machine.Worker{
File: &asset.File{
Expand Down Expand Up @@ -222,7 +222,7 @@ func TestComputeIsNotModified(t *testing.T) {
InfraID: "test-infra-id",
},
installConfig,
(*rhcos.Image)(pointer.StringPtr("test-image")),
rhcos.MakeAsset("test-image"),
(*rhcos.Release)(pointer.StringPtr("412.86.202208101040-0")),
&machine.Worker{
File: &asset.File{
Expand Down
2 changes: 1 addition & 1 deletion pkg/asset/manifests/clusterapi/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func (c *Cluster) Generate(_ context.Context, dependencies asset.Parents) error
}
case powervstypes.Name:
var err error
osImage := strings.SplitN(string(*rhcosImage), "/", 2)
osImage := strings.SplitN(rhcosImage.ControlPlane, "/", 2)
out, err = powervs.GenerateClusterAssets(installConfig, clusterID, osImage[0], osImage[1])
if err != nil {
return fmt.Errorf("failed to generate PowerVS manifests %w", err)
Expand Down
2 changes: 1 addition & 1 deletion pkg/asset/manifests/openshift.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ func (o *Openshift) Generate(ctx context.Context, dependencies asset.Parents) er
case baremetaltypes.Name:
bmTemplateData := baremetalTemplateData{
Baremetal: installConfig.Config.Platform.BareMetal,
ProvisioningOSDownloadURL: string(*rhcosImage),
ProvisioningOSDownloadURL: rhcosImage.ControlPlane,
}
assetData["99_baremetal-provisioning-config.yaml"] = applyTemplateData(baremetalConfig.Files()[0].Data, bmTemplateData)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/asset/rhcos/bootstrap_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (i *BootstrapImage) Generate(ctx context.Context, p asset.Parents) error {
return fmt.Errorf("%s: No qemu build found", st.FormatPrefix(archName))
default:
// other platforms use the same image for all nodes
*i = BootstrapImage(string(*rhcosImage))
*i = BootstrapImage(rhcosImage.ControlPlane)
return nil
}
}
34 changes: 26 additions & 8 deletions pkg/asset/rhcos/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ import (
// Image is location of RHCOS image.
// This stores the location of the image based on the platform.
// eg. on AWS this contains ami-id, on Livirt this can be the URI for QEMU image etc.
type Image string
type Image struct {
ControlPlane string
Compute string
}

var _ asset.Asset = (*Image)(nil)

Expand All @@ -52,27 +55,35 @@ func (i *Image) Dependencies() []asset.Asset {
func (i *Image) Generate(ctx context.Context, p asset.Parents) error {
if oi, ok := os.LookupEnv("OPENSHIFT_INSTALL_OS_IMAGE_OVERRIDE"); ok && oi != "" {
logrus.Warn("Found override for OS Image. Please be warned, this is not advised")
*i = Image(oi)
*i = *MakeAsset(oi)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so in the override case - the same image would be used for cp/computes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. If we need to support 2 image overrides, then we'd have to either require the OPENSHIFT_INSTALL_OS_IMAGE to have both images (e.g, separated by ,) or we'd have to introduce a new env var for compute images.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe a change to the installer doc mentioning this is also needed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have docs for that env var as it's not officially supported.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Prashanth684 can you envision a situation where we'd need to override both controlplane and compute images with distinct values for multi-arch clusters? I'd rather not touch this env var as it's used by agent and powervs (at least not in this PR).

Copy link
Contributor

@Prashanth684 Prashanth684 Jul 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather not touch this env var as it's used by agent and powervs

it makes sense to address separately. Do they use it for installation - if so we have to make sure that it works or that we don't allow them to provision a cluster with multi-arch computes on day 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agent: used when generating the base ISO: https://github.com/openshift/installer/blob/master/pkg/asset/agent/image/baseiso.go#L149-L151

powervs: it seems it's abusing the envvar: https://github.com/openshift/installer/blob/master/pkg/asset/installconfig/powervs/platform.go#L19-L24

we don't allow them to provision a cluster with multi-arch computes on day 0

The only way to bypass the heterogeneous validation in the installer is by setting the feature gate: d9e5e66

That only happens for AWS with this PR.

return nil
}

ic := &installconfig.InstallConfig{}
p.Get(ic)
config := ic.Config
osimage, err := osImage(ctx, config)
osimageControlPlane, err := osImage(ctx, config, config.ControlPlane.Architecture)
if err != nil {
return err
}
arch := config.ControlPlane.Architecture
if len(config.Compute) > 0 {
arch = config.Compute[0].Architecture
}
osimageCompute, err := osImage(ctx, config, arch)
if err != nil {
return err
}
*i = Image(osimage)
*i = Image{osimageControlPlane, osimageCompute}
return nil
}

//nolint:gocyclo
func osImage(ctx context.Context, config *types.InstallConfig) (string, error) {
func osImage(ctx context.Context, config *types.InstallConfig, nodeArch types.Architecture) (string, error) {
ctx, cancel := context.WithTimeout(ctx, 30*time.Second)
defer cancel()

archName := arch.RpmArch(string(config.ControlPlane.Architecture))
archName := arch.RpmArch(string(nodeArch))

st, err := rhcos.FetchCoreOSBuild(ctx)
if err != nil {
Expand All @@ -88,7 +99,7 @@ func osImage(ctx context.Context, config *types.InstallConfig) (string, error) {
return config.Platform.AWS.AMIID, nil
}
region := config.Platform.AWS.Region
if !rhcos.AMIRegions(config.ControlPlane.Architecture).Has(region) {
if !rhcos.AMIRegions(nodeArch).Has(region) {
const globalResourceRegion = "us-east-1"
logrus.Debugf("No AMI found in %s. Using AMI from %s.", region, globalResourceRegion)
region = globalResourceRegion
Expand Down Expand Up @@ -155,7 +166,6 @@ func osImage(ctx context.Context, config *types.InstallConfig) (string, error) {
// FindArtifactURL just create the URL here.
artifact := a.Formats["ova"].Disk
u, err := url.Parse(artifact.Location)

if err != nil {
return "", err
}
Expand Down Expand Up @@ -212,3 +222,11 @@ func osImage(ctx context.Context, config *types.InstallConfig) (string, error) {
return "", fmt.Errorf("invalid platform %v", config.Platform.Name())
}
}

// MakeAsset returns an Image asset with the given os image.
func MakeAsset(osImage string) *Image {
return &Image{
ControlPlane: osImage,
Compute: osImage,
}
}
2 changes: 1 addition & 1 deletion pkg/infrastructure/aws/clusterapi/ami.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

// copyAMIToRegion copies the AMI to the region configured in the installConfig if needed.
func copyAMIToRegion(ctx context.Context, installConfig *installconfig.InstallConfig, infraID string, rhcosImage *rhcos.Image) (string, error) {
osImage := strings.SplitN(string(*rhcosImage), ",", 2)
osImage := strings.SplitN(rhcosImage.ControlPlane, ",", 2)
amiID, amiRegion := osImage[0], osImage[1]

logrus.Infof("Copying AMI %s to region %s", amiID, installConfig.AWS.Region)
Expand Down
2 changes: 1 addition & 1 deletion pkg/infrastructure/nutanix/clusterapi/clusterapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (p Provider) PreProvision(ctx context.Context, in infracapi.PreProvisionInp

// upload the rhcos image.
imgName := nutanixtypes.RHCOSImageName(in.InfraID)
imgURI := string(*in.RhcosImage)
imgURI := in.RhcosImage.ControlPlane
imgReq := &nutanixclientv3.ImageIntentInput{}
imgSpec := &nutanixclientv3.Image{
Name: &imgName,
Expand Down
Loading