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

Support Installation Specification #1684

Merged
merged 13 commits into from
Aug 9, 2021

Conversation

carolynvs
Copy link
Member

@carolynvs carolynvs commented Jul 25, 2021

What does this change

  • Move all documents and data access code into Porter
  • Funnel most access to cnab-go/claims through porter's own pkg/claims (soon to be renamed to pkg/installations). I was seeing bugs and compilation errors because it's so easy to confuse the two or accidentally use the struct from the wrong package. This makes sure that all cnab installation data stuff goes through Porter.
  • Base storage plugin protocol on mongodb
  • Remove BackingStore and all autoconnect logic. We now connect to the storage plugin just in time, connecting as needed and holding the connection until porter exits. This means that tests that access storage must call Teardown() to release the connection.
  • Change filesystem storage plugin to run an instance of mongo and write the db files to PORTER_HOME.
  • Add namespace to all documents
  • Support namespaces, e.g. porter list -n dev, PORTER_NAMESPACE and namespace config
  • Run internal plugins inside the porter process, instead of execing back into itself. Yes this means that internal plugins are treated a bit differently. The protocol is still the same though and it greatly improves debugging.

TODO FOR THIS PR

  • Rename "filesystem" plugin to "docker-mongodb" (in this PR)
  • Document the mongodb-docker plugin (In this PR)

TODO AFTER THIS PR

  • Switch from using docker CLI directly, to using the docker library (in follow-up PR)
  • Add labels to all documents (in follow-up PR)
  • Add --all-namespaces, which defaults --namespace to "*" appropriately (in folow-up PR)

What issue does it fix

Fixes #1177
First part of #1683

Notes for the reviewer

Sorry it's giant, I needed to make sure the entire thing worked end-to-end. It may work better to do the review in a couple screen sharing sessions.

Checklist

  • Unit Tests
  • Documentation
  • Schema (porter.yaml)

@carolynvs carolynvs changed the title Redo data access layer Support Installation Specification Jul 25, 2021
@carolynvs carolynvs force-pushed the swap-storage branch 2 times, most recently from cdb648b to 4c2cf8f Compare July 30, 2021 14:12
@carolynvs
Copy link
Member Author

/azp run porter-integration

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@carolynvs
Copy link
Member Author

/azp run porter-integration

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

* Change storage protocol to mimic mongo.
* Switch the filesystem plugin to use a mongo instance in a container.
* Add a mongo plugin.
* Add installation document and rename claim -> run.
* Move all storage document formats and data access into porter.

Signed-off-by: Carolyn Van Slyck <[email protected]>
If you are still using the filesystem plugin you will see the following
error:

Error: could not list installations: could not load storage plugin: unsupported internal storage plugin specified storage.porter.filesystem

Signed-off-by: Carolyn Van Slyck <[email protected]>
@carolynvs
Copy link
Member Author

/azp run porter-integration

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@carolynvs carolynvs marked this pull request as ready for review August 5, 2021 18:55
@carolynvs carolynvs mentioned this pull request Aug 6, 2021
3 tasks
Copy link
Member

@vdice vdice left a comment

Choose a reason for hiding this comment

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

👏 Impressive work, as always! These changes set Porter up to be far more performant and efficient. Majority of comments are minor and usually just typo-related.

It looks like there may be one more TODO in the description above, around documenting the mongodb-docker plugin -- does that still need to be added?

i.Status.InstallationCompleted = true
}

// TODO(carolynvs): set this before running the bundle, it should trigger the execution
Copy link
Member

Choose a reason for hiding this comment

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

I can't recall -- should this be addressed now or can defer to a follow-up?

Copy link
Member Author

Choose a reason for hiding this comment

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

That is part of #1704

pkg/claims/output.go Outdated Show resolved Hide resolved
pkg/claims/provider.go Show resolved Hide resolved
pkg/claims/provider.go Outdated Show resolved Hide resolved
pkg/claims/run.go Outdated Show resolved Hide resolved
pkg/secrets/pluginstore/store.go Outdated Show resolved Hide resolved
pkg/storage/migrations/helpers.go Outdated Show resolved Hide resolved
pkg/storage/plugin_adapter.go Outdated Show resolved Hide resolved
pkg/storage/plugins/mongodb/mongodb.go Outdated Show resolved Hide resolved
pkg/storage/pluginstore/store.go Outdated Show resolved Hide resolved
@carolynvs
Copy link
Member Author

Oh! Yes you are right, I wanted to document the plugin first before merging this PR. 👍

Our documents store PORTER'S schema for the document. If we need to
convert that document to a CNAB representation, then we will stamp the
converted document with the appropriate schema version for that spec.

Some docs don't need it at all and I've removed it.

Signed-off-by: Carolyn Van Slyck <[email protected]>
Signed-off-by: Carolyn Van Slyck <[email protected]>
Signed-off-by: Carolyn Van Slyck <[email protected]>
@carolynvs
Copy link
Member Author

I've fixed all the feedback I think. I'm going to leave the documentation for Monday and peace out for the weekend. Thanks for the review!

Signed-off-by: Carolyn Van Slyck <[email protected]>
Signed-off-by: Carolyn Van Slyck <[email protected]>
Signed-off-by: Carolyn Van Slyck <[email protected]>
Copy link
Member

@vdice vdice left a comment

Choose a reason for hiding this comment

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

One minor docs Q, otherwise LGTM!

## Plugin Configuration

To use the mongodb plugin, add the following config to porter's config file
(default location: `~/.porter/config.toml`). Replace `conn_str` with the
Copy link
Member

Choose a reason for hiding this comment

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

Replace conn_str with the connection string for your MongoDB server. should be removed, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

oops! thanks

Signed-off-by: Carolyn Van Slyck <[email protected]>
@carolynvs carolynvs merged commit dae3283 into getporter:release/v1 Aug 9, 2021
@carolynvs carolynvs deleted the swap-storage branch August 9, 2021 17:01
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.

2 participants