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 Paramaterize to provider interface #16174

Merged
merged 1 commit into from May 15, 2024
Merged

Conversation

Frassle
Copy link
Member

@Frassle Frassle commented May 10, 2024

Description

This is the bare bones changes required to update the provider interface for parametrization. Nothing in the engine, sdks, cli, or codegen makes use of these new methods yet.

But providers team can start building on top of this interface. Note that this is subject to change, while this is likely the right design for parametrised providers there is a chance that we need to edit this interface before GA release.

Checklist

  • I have run make tidy to update any new dependencies
  • I have run make lint to verify my code passes the lint check
    • I have formatted my code using gofumpt
  • I have added tests that prove my fix is effective or that my feature works
  • I have run make changelog and committed the changelog/pending/<file> documenting my change
  • Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version

@Frassle Frassle added the impact/no-changelog-required This issue doesn't require a CHANGELOG update label May 10, 2024
@Frassle Frassle marked this pull request as ready for review May 10, 2024 19:08
@Frassle Frassle requested a review from a team as a code owner May 10, 2024 19:08
@pulumi-bot
Copy link
Contributor

pulumi-bot commented May 10, 2024

Changelog

[uncommitted] (2024-05-15)

@Frassle Frassle requested a review from iwahbe May 11, 2024 09:03
Copy link
Member

@iwahbe iwahbe left a comment

Choose a reason for hiding this comment

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

Thanks for getting this in!

proto/pulumi/provider.proto Outdated Show resolved Hide resolved
proto/pulumi/provider.proto Outdated Show resolved Hide resolved
proto/pulumi/provider.proto Outdated Show resolved Hide resolved
@justinvp justinvp mentioned this pull request May 13, 2024
12 tasks
@Frassle Frassle force-pushed the fraser/providerSchemaParam branch 2 times, most recently from b09b25e to acd01ae Compare May 14, 2024 10:06
@iwahbe
Copy link
Member

iwahbe commented May 14, 2024

As part of merging, I would really like to see the contract semantics as comments in provider.proto. Understanding many of our previous gRPC calls is difficult because they require implicit knowledge as to what they do. Right now, the comment on Parameterize reads:

// Parameterize takes either a string array of command line inputs or a value embedded from sdk generation.
rpc Parameterize(ParameterizeRequest) returns (ParameterizeResponse) {}

This is an ok description for ParameterizeRequest but doesn't tell us how Parameterize is actually used. At the very least, the description of Parameterize should include that:

  • If Parameterize is called, it will be called exactly once and will be the first gRPC method called. If it's legal to call GetSchema() to get an initial schema before calling parameterize, we need to say that (because right now I assume it's not).
  • Parameterize can be called with either CLI args or a pre-computed value. It is assumed that if a provider p where p.Parameterize(ARGS) yields VALUE, that p given p.Parameterize(ARGS) will behave the same as p given p.Parameterize(VALUE). -- An alternative design could be p.Parameterize(ARGS) only permits p.GetSchema(), and p.Parameterize(VALUE) must be called to acccess runtime methods (Create, Read, etc).
  • A parameterized provider should embed VALUE in the schema it returns at SOME field. I'm not sure where SOME is (or if it exists yet).

These descriptions can change over time, but they should reflect the current understanding of how these methods are used. We have historically struggled with documenting our gRPC methods clearly and this is a good opportunity to fix that.

@Frassle
Copy link
Member Author

Frassle commented May 14, 2024

As part of merging, I would really like to see the contract semantics as comments in

Can do, I'm still trying to work out how we're going to handle multiple versions of the same sub-package at the moment. I think we need it for CRDs and I think it requires the CRUD methods to be updated as well.

@Frassle Frassle force-pushed the fraser/providerSchemaParam branch from acd01ae to c4d475e Compare May 15, 2024 15:00
@Frassle Frassle enabled auto-merge May 15, 2024 15:00
@Frassle Frassle added this pull request to the merge queue May 15, 2024
github-merge-queue bot pushed a commit that referenced this pull request May 15, 2024
<!--- 
Thanks so much for your contribution! If this is your first time
contributing, please ensure that you have read the
[CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md)
documentation.
-->

# Description

<!--- Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context. -->

This is the bare bones changes required to update the provider interface
for parametrization. Nothing in the engine, sdks, cli, or codegen makes
use of these new methods yet.

But providers team can start building on top of this interface. Note
that this is subject to change, while this is _likely_ the right design
for parametrised providers there is a chance that we need to edit this
interface before GA release.

## Checklist

- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
  - [ ] I have formatted my code using `gofumpt`

<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [ ] I have added tests that prove my fix is effective or that my
feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [x] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
@Frassle Frassle removed this pull request from the merge queue due to a manual request May 15, 2024
@Frassle Frassle force-pushed the fraser/providerSchemaParam branch from c4d475e to 4b0e684 Compare May 15, 2024 15:50
@Frassle Frassle enabled auto-merge May 15, 2024 15:50
@Frassle Frassle added this pull request to the merge queue May 15, 2024
Merged via the queue into master with commit ab7acdb May 15, 2024
50 of 56 checks passed
@Frassle Frassle deleted the fraser/providerSchemaParam branch May 15, 2024 17:24
Comment on lines +31 to +32
// Providers can be parameterized with either multiple extension packages (which don't define their own provider
// resources), or with a replacement package (which does define its own provider resource).
Copy link
Member

Choose a reason for hiding this comment

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

How does the engine know if a provider is being parameterized by an extension package or a replacement provider? As I understand it, the engine will need to treat extended and replaced providers very differently.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeh it will be part of the register resource call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact/no-changelog-required This issue doesn't require a CHANGELOG update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants