Adding existing subnets to space fails
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Canonical Juju |
Fix Released
|
High
|
Unassigned |
Bug Description
Adding an existing subnet to a space fails with "subnet already exists" error on AWS.
Steps to replicate:
1. Create a new subnet in a VPC (lets say subnet-1234)
2. Bootstrap a controller with `juju bootstrap aws/us-west-2 controller --config vpc-id="myvpc" --to="subnet=
3. Once the bootstrap completes, create a space `juju add-space public`
4. Add the subnet to the space `juju add-subnet subnet-1234 public`
This results in an error `ERROR cannot add subnet: adding subnet "subnet-1234": subnet "subnet-1234" already exists`
Expected results:
I should be able to add existing subnets to spaces I create, otherwise there is no way for me to use juju in an existing infrastructure.
Workarounds:
1. I can start a controller in an existing subnet and then create new subnets for juju to use. If the subnet doesn't exist during the bootstrap process, I am able to add it to a space.
2. It seems that if I destroy the default model created by the bootstrap process, it deletes all the spaces and subnets, so then I can define a new model and add subnets and spaces to it.
While the second workaround solves my problem, it seems awkward and redundant to have to delete the default model. If bootstrap creates the default model, you would expect it to be fully usable.
References:
Here are the posts I created about the issue on stackoverflow and askubuntu
Here is the blog post about deploying k8s cluster into an existing infrastructure that I was following when I discovered this issue
description: | updated |
Changed in juju-core: | |
status: | New → Triaged |
importance: | Undecided → High |
After some more experimentation, it turns out that even after destroying the default model and creating a new one it is impossible to add existing subnets using add-subnet. It is possible though to add subnets as part of the add-space command. So, there are two workarounds.
1. Create your model or bootstrap your controller before you create subnets.
2. Add subnets to the space as the argument to add-space command
This is inconvenient for obvious reasons, in the first workaround you cannot use existing subnets and in the second workaround you have to be very sure which subnets you want to add to which space, since there is no way to change that later and there is no way to remove defined spaces.