diff --git a/pkg/asset/machines/clusterapi.go b/pkg/asset/machines/clusterapi.go index 093cf662de2..5b661ca175b 100644 --- a/pkg/asset/machines/clusterapi.go +++ b/pkg/asset/machines/clusterapi.go @@ -157,6 +157,9 @@ func (c *ClusterAPI) Generate(ctx context.Context, dependencies asset.Parents) e if err != nil { logrus.Warn(errors.Wrap(err, "failed to filter zone list")) } + // Sort the zones by lexical order to ensure CAPI and MAPI machines + // are distributed to zones in the same order. + slices.Sort(mpool.Zones) } tags, err := aws.CapaTagsFromUserTags(clusterID.InfraID, installConfig.Config.Platform.AWS.UserTags) diff --git a/pkg/asset/machines/master.go b/pkg/asset/machines/master.go index caeedb850d4..b8a456e79f6 100644 --- a/pkg/asset/machines/master.go +++ b/pkg/asset/machines/master.go @@ -240,6 +240,9 @@ func (m *Master) Generate(ctx context.Context, dependencies asset.Parents) error if err != nil { logrus.Warn(errors.Wrap(err, "failed to filter zone list")) } + // Sort the zones by lexical order to ensure CAPI and MAPI machines + // are distributed to zones in the same order. + slices.Sort(mpool.Zones) } pool.Platform.AWS = &mpool