Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
discoverspaces: Get subnets when provider doesn't support space discovery #7067
Conversation
|
!!build!! |
wallyworld
approved these changes
Mar 3, 2017
Not 100% on the non-transactional nature of the discovery but it seems that's an existing issue
| @@ -55,7 +55,7 @@ func NewAddSubnetsCache(api NetworkBacking) *addSubnetsCache { | ||
| // up in the cache (or populates the cache if empty). | ||
| func (cache *addSubnetsCache) validateSpace(spaceTag string) (*names.SpaceTag, error) { | ||
| if spaceTag == "" { | ||
| - return nil, errors.Errorf("SpaceTag is required") | ||
| + return nil, nil |
wallyworld
Mar 3, 2017
Owner
Would be great if "" were a valid space name.
That would require a change to the names.v2 package though. But it would avoid all the special case code in this PR.
| if err != nil { | ||
| return errors.Trace(err) | ||
| } | ||
| - stateSubnets, err := facade.ListSubnets(params.SubnetsFilters{}) | ||
| + var addSubnetsArgs params.AddSubnetsParams | ||
| + collectMissingSubnets(&addSubnetsArgs, "", stateSubnetIds, subnets) |
wallyworld
Mar 3, 2017
Owner
This logic really needs to be server side - it is not transactional as is.
But it seems the existing code suffers from the same problem.....
| @@ -297,3 +296,44 @@ func (dw *discoverspacesWorker) addSubnetsFromArgs(addSubnetsArgs params.AddSubn | ||
| return nil | ||
| } | ||
| + | ||
| +func (dw *discoverspacesWorker) getStateSubnets() (set.Strings, error) { |
wallyworld
Mar 3, 2017
Owner
can we call this getModelSubnets()
let's not leak the state.State abstraction
| jc "github.com/juju/testing/checkers" | ||
| gc "gopkg.in/check.v1" | ||
| - "gopkg.in/juju/names.v2" | ||
| + //"gopkg.in/juju/names.v2" |
| - cf.addSubnetsCallback() | ||
| - } | ||
| - return cf.API.AddSubnets(args) | ||
| + coretesting.BaseSuite |
|
The one bit of syntax that I think we want to consider is that "" should be
considered a space. We'd like to try treating it as just a proper space
that happens to not have a name. So it's more about "allow a space to not
have a name" than "allow a subnet to not have a space".
John
=:->
…
|
|
That also follows through with "What subnets could this endpoint be in".
It's not all subnets it's the subnets in the space it was configured in.
Just that the space name might be "". I think that can help shape some of
the API so we're prepared for when we have concrete spaces everywhere.
John
=:->
…
|
babbageclunk
added some commits
Mar 1, 2017
|
!!build!! |
babbageclunk
added some commits
Mar 3, 2017
|
!!build!! |
|
$$merge$$ |
|
Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju |
jujubot
merged commit 7c2469e
into
juju:develop
Mar 14, 2017
babbageclunk
deleted the
babbageclunk:discover-subnets-tests
branch
Mar 20, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
babbageclunk commentedMar 3, 2017
Description of change
At the moment we only get subnets from the provider if it supports space discovery, but it would be useful to have them for providers that support networking (even if we don't have them tagged with a space). That will allow us to use them to set up ingress rules when a cross-model relation is created.
Change the discover spaces worker to collect subnets (with no associated spaces) if the provider doesn't support space discovery. Also change the AddSubnets API call to allow subnets without a space, and change the ListSubnets API method and command to handle empty space.
Rewrite the worker tests to not use
JujuConnSuite.QA steps
juju subnetsto verify that subnets have been imported in by the discoverspaces worker - they'll come back with a blank space tag.