Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CosmosDB Mongo database and collection resources #1870

Merged

Conversation

babbageclunk
Copy link
Member

@babbageclunk babbageclunk commented Oct 10, 2021

What this PR does / why we need it:
This adds the resources DatabaseAccountsMongodbDatabase and DatabaseAccountsMongodbDatabasesCollection which enable managing Mongo databases and collections respectively.

Special notes for your reviewer:
Seems like a lot but because of the joys of code-gen and recorded requests it's really just 10 lines of config change and 161 lines of tests.

(Also I did some driveby fixes to pipeline stage descriptions.)

How does this PR make you feel:
gif

If applicable:

  • this PR contains documentation
  • this PR contains tests

babbageclunk and others added 6 commits October 10, 2021 15:09
Adds the charmingly named DatabaseAccountsMongodbDatabasesCollection.

Marked the MongoDBCollectionResource.Id field as not being a resource
reference - as far as I can tell it's the name of the collection
within the mongo database.
These should be in a similar form to commit messages to match how
they're used in the output.
For some reason Mongo database tags aren't coming back in the status
of the resource - I haven't worked out yet whether they're on the ARM
resource.
@babbageclunk babbageclunk force-pushed the feature/cosmosdb-mongo-collection branch from bc42213 to 22fa618 Compare October 10, 2021 02:39
@babbageclunk babbageclunk marked this pull request as ready for review October 10, 2021 02:52
tc.CreateResourceAndWait(&db)
defer tc.DeleteResourceAndWait(&db)

// TODO: for reasons I don't understand tags set on the database
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like there's no way to specify tags on databases from az, but the SDK supports it (presumably going off the same sources we are).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably the thing that @matthchr noticed, where the ResourceBase has Tags but not everything supports Tags so they are ignored.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I had a feeling it might be something like that. I'll remove that section then.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, that's it exactly @Porges. There's a bug here #1730. I think the Azure resource manager schema folks agreed this was a bug, but it's likely that the best fix is just to move to use Swagger (which when I looked at the resources I had found with this problem correctly did not have tags defined on the resource).

@Porges
Copy link
Member

Porges commented Oct 10, 2021

It’s a good game

@codecov-commenter
Copy link

codecov-commenter commented Oct 10, 2021

Codecov Report

Merging #1870 (04aa76c) into master (78ee016) will decrease coverage by 0.23%.
The diff coverage is 56.98%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1870      +/-   ##
==========================================
- Coverage   62.67%   62.44%   -0.24%     
==========================================
  Files         323      329       +6     
  Lines       68780    70462    +1682     
==========================================
+ Hits        43108    44000     +892     
- Misses      22245    22931     +686     
- Partials     3427     3531     +104     
Impacted Files Coverage Δ
.../codegen/pipeline/add_cross_resource_references.go 25.36% <0.00%> (-0.77%) ⬇️
...ge/database_accounts_mongodb_database_types_gen.go 4.00% <4.00%> (ø)
...accounts_mongodb_databases_collection_types_gen.go 5.26% <5.26%> (ø)
...15/database_accounts_mongodb_database_types_gen.go 58.51% <58.51%> (ø)
...accounts_mongodb_databases_collection_types_gen.go 60.69% <60.69%> (ø)
..._accounts_mongodb_databases__spec_arm_types_gen.go 100.00% <100.00%> (ø)
...ngodb_databases_collections__spec_arm_types_gen.go 100.00% <100.00%> (ø)
...enerator/codegen/pipeline/add_status_conditions.go 87.50% <100.00%> (ø)
...ator/codegen/pipeline/collapse_cross_group_refs.go 76.00% <100.00%> (ø)
...odegen/pipeline/make_status_properties_optional.go 38.70% <100.00%> (ø)
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 78ee016...04aa76c. Read the comment docs.

@babbageclunk babbageclunk merged commit 53a0d47 into Azure:master Oct 10, 2021
@babbageclunk babbageclunk deleted the feature/cosmosdb-mongo-collection branch October 10, 2021 22:56
@@ -7,7 +7,7 @@ spec:
location: westcentralus
owner:
name: aso-sample-rg
kind: GlobalDocumentDB
kind: MongoDB
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old one was also valid, right? Or was it the "Default" and so specifying it is sorta pointless and enables nothing extra?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, it wouldn't let me create mongo databases/collections unless I set the kind to MongoDB.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants