Could we deploy a canister on a specified subnet?

Yes, you can use the CMC’s create_canister function. If you specify no subnet_selection field then you land on a random subnet, otherwise you can either choose the type or target a specific one

3 Likes

Thanks for the quick response. We want to create canisters on different subnet using our one main platform_orchestrator. I will try using CMC canister to create canister on different subnet from platform_orchestrator. Is there a way to locally test this scenario using pocket-ic?

I think I found a way looking at the documentation. To test the scenario I would have to load CMC canister using pocket ic and then test my functions as shown in the example. Correct me if I am wrong here

let ledger_canister_id = Principal::from_text("ryjl3-tyaaa-aaaaa-aaaba-cai").unwrap();
pic.create_canister_with_id(..., ledger_canister_id).unwrap();
pic.install_canister(ledger_canister_id, ...);

You’re not wrong that you can install NNS canisters like this, but they are really annoying to set up properly. And I don’t know myself how you properly set up the real CMC to target different subnets and I also don’t know if it works properly on pocket ic. What I would suggest is that you use the fake CMC in this repository and use this to check if you make the right calls. (It’s not part of the releases right now, but I need it to be added there myself so I should get around to that this week)

1 Like