diff --git a/pkg/asset/manifests/mco.go b/pkg/asset/manifests/mco.go index 33884b851fa..d5ee036b12b 100644 --- a/pkg/asset/manifests/mco.go +++ b/pkg/asset/manifests/mco.go @@ -52,8 +52,11 @@ func awsBootImages(ic *types.InstallConfig) (cpImg bool, wImg bool) { cpImg = true } - if w := ic.Compute; len(w) > 0 && w[0].Platform.AWS != nil && w[0].Platform.AWS.AMIID != "" { - wImg = true + // On AWS, we need to check both compute and edge compute machine pool. + for _, computeMP := range ic.Compute { + if awsPlatform := computeMP.Platform.AWS; awsPlatform != nil && awsPlatform.AMIID != "" { + wImg = true + } } return } diff --git a/pkg/asset/manifests/mco_test.go b/pkg/asset/manifests/mco_test.go index 92d8ea720fd..da31cdeca48 100644 --- a/pkg/asset/manifests/mco_test.go +++ b/pkg/asset/manifests/mco_test.go @@ -40,6 +40,11 @@ func TestGenerateMCO(t *testing.T) { installConfig: icBuild.build(icBuild.withAWSComputeAMI()), expectedMCO: mcoBuild.build(mcoBuild.withComputeBootImageMgmtDisabled()), }, + { + name: "aws with a custom edge compute image disables mco management", + installConfig: icBuild.build(icBuild.withAWSEdgeComputeAMI()), + expectedMCO: mcoBuild.build(mcoBuild.withComputeBootImageMgmtDisabled()), + }, { name: "gcp with a custom compute image disables mco management", installConfig: icBuild.build(icBuild.withGCPComputeAMI()), @@ -126,6 +131,27 @@ func (b icBuildNamespace) withAWSComputeAMI() icOption { } } +func (b icBuildNamespace) withAWSEdgeComputeAMI() icOption { + return func(ic *types.InstallConfig) { + b.forAWS()(ic) + ic.Compute = []types.MachinePool{ + { + Platform: types.MachinePoolPlatform{ + AWS: &aws.MachinePool{}, + }, + }, + { + Name: "edge", + Platform: types.MachinePoolPlatform{ + AWS: &aws.MachinePool{ + AMIID: "ami-xxxxxxxxxxxxx", + }, + }, + }, + } + } +} + func (b icBuildNamespace) withGCPComputeAMI() icOption { return func(ic *types.InstallConfig) { b.forGCP()(ic)