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

Version providers #2389

Closed
3 tasks done
lukehoban opened this issue Jan 24, 2019 · 9 comments
Closed
3 tasks done

Version providers #2389

lukehoban opened this issue Jan 24, 2019 · 9 comments
Assignees
Labels
p1 A bug severe enough to be the next item assigned to an engineer
Milestone

Comments

@lukehoban
Copy link
Member

lukehoban commented Jan 24, 2019

Today, we always load the latest version available on the machine of the requested resource provider. However, the resource provider itself can be loaded by packages at:

  1. An older version
  2. Multiple different versions within the same program execution

This leads to problems if we ever make a (intentional or not) breaking change in a resource provider, as some of the code in the program may only work correctly with the version of the provider it was authored against.

We will need to find a way to ensure that we load the specific version(s) required by the program/packages. This will likely also require that we have the ability to load multiple versions of a provider into the same deployment, and to route resource operations from the program to the right versions of the providers.

Work items:

@lukehoban lukehoban added this to the 0.21 milestone Jan 24, 2019
@pgavlin pgavlin modified the milestones: 0.21, 0.22 Jan 31, 2019
@lukehoban lukehoban added the p1 A bug severe enough to be the next item assigned to an engineer label Feb 12, 2019
@lukehoban
Copy link
Member Author

Marking as P1 in M22 as this is a critical part of being able to adopt breaking changes in providers, which may be coming from upstream for several of our core providers.

@lukehoban lukehoban reopened this Feb 12, 2019
@joeduffy
Copy link
Member

joeduffy commented Feb 13, 2019

Strange, I thought we already did this. (I definitely recall very technically deep discussions with Sean and/or Pat about how this would work in terms of RPC and checkpoint file changes, Fall of last year.) Did we just design, but not implement, it?

@lukehoban
Copy link
Member Author

@swgillespie Is there anything more planned for this in M21 after merging #2483? Could we update this issue with the steps taken so far and thoughts on what we might want to do as additional future investments? (Or close this out and open new issues?)

@swgillespie
Copy link
Contributor

swgillespie commented Mar 9, 2019

So far, we have taken #2483, which contains a fix for what was the arguably bug-like behavior of plugin loading: the plugin loader would load plugins that were "newer" than the one requested, which posed a problem if the newer plugin was not compatible with the requested version.

For M21, this was deemed sufficiently troublesome that we took a fix for it. Entering M22, the current state of provider versioning is that the CLI will load exactly the version of the plugin requested by a Pulumi program, and will error if that specific plugin is not available. This should alleviate the immediate pain of some incoming breaking changes we are planning to absorb in some downstream providers, so that this issue is no longer "on fire" and blocking the uptake of new providers.

For M22, we should pursue a more holistic solution to the problem. We discussed a number of options that we can take here and, although it's not clear what the best solution is at this point, from my perspective the one that seemed most promising was to have Pulumi resources directly inform the engine of the provider version upon resource registration (concretely, provider packages would embed their version into their source code and pass it to the engine during registerResource). This would allow the engine to load exactly the provider binary that is known to be compatible with the source code being used.

In the early M22 timeframe, we'll take a look at our options and understand the technical blockers in place. For the above solution, we will at minimum need to augment the registerResource contract to provide a version, embed version information in code generated by tfgen and the Kubernetes code generator, and allow the engine to multi-instance provider plugins. The latter issue is known to be tricky.

@lukehoban
Copy link
Member Author

See pulumi/pulumi-gcp#115 for a case where users hit issues due to having two copies of @pulumi/gcp - in particular:

@pulumi/gcp@0.18.0
internal-lib@1.0.0
  @pulumi/gcp@0.17.1

Handling this correctly will require support for SxS plugins and much of the additional work outlined in #2389 (comment).

@ncsibra
Copy link

ncsibra commented Apr 3, 2019

A related issue, which cause serious problems, described here: https://pulumi-community.slack.com/archives/C84L4E3N1/p1554209058169500

@rosskevin
Copy link

Even after cleaning out plugins, I'm seeing incorrect older gcp plugins reappear as documented here pulumi/pulumi-gcp#124 (comment)

It seems I cannot workaround the issue.

swgillespie added a commit that referenced this issue Apr 12, 2019
In pursuit of #2389, this commit adds the necessary changes
to the resource monitor protocol so that language hosts can communicate
exactly what version of a provider should be used when servicing an
Invoke, ReadResource, or RegisterResource. The expectation here is that,
if a language host provides a version, the engine MUST use EXACTLY that
version of a provider plugin in order to service the request.
swgillespie added a commit that referenced this issue Apr 12, 2019
In pursuit of #2389, this commit adds the necessary changes
to the resource monitor protocol so that language hosts can communicate
exactly what version of a provider should be used when servicing an
Invoke, ReadResource, or RegisterResource. The expectation here is that,
if a language host provides a version, the engine MUST use EXACTLY that
version of a provider plugin in order to service the request.
swgillespie added a commit that referenced this issue Apr 16, 2019
In pursuit of #2389, this commit adds the necessary changes
to the resource monitor protocol so that language hosts can communicate
exactly what version of a provider should be used when servicing an
Invoke, ReadResource, or RegisterResource. The expectation here is that,
if a language host provides a version, the engine MUST use EXACTLY that
version of a provider plugin in order to service the request.
swgillespie added a commit that referenced this issue Apr 16, 2019
As part of #2389, we need the ability for language hosts to
tell the engine that a particular resource registration, read, or invoke
needs to use a particular version of a resource provider. This was not
previously possible before; the engine prior to this commit loaded
plugins from a default provider map, which was inferred for every
resource provider based on the contents of a user's package.json, and
was itself prone to bugs.

This PR adds the engine support needed for language hosts to request a
particular version of a provider. If this occurs, the source evaluator
specifically records the intent to load a provider with a given version
and produces a "default" provider registration that requests exactly
that version. This allows the source evaluator to produce multiple
default providers for a signle package, which was previously not
possible.

This is accomplished by having the source evaluator deal in the
"ProviderRequest" type, which is a tuple of version and package. A
request to load a provider whose version matches the package of a
previously loaded provider will re-use the existing default provider. If
the version was not previously loaded, a new default provider is
injected.
swgillespie added a commit that referenced this issue Apr 17, 2019
* Load specific provider versions if requested

As part of #2389, we need the ability for language hosts to
tell the engine that a particular resource registration, read, or invoke
needs to use a particular version of a resource provider. This was not
previously possible before; the engine prior to this commit loaded
plugins from a default provider map, which was inferred for every
resource provider based on the contents of a user's package.json, and
was itself prone to bugs.

This PR adds the engine support needed for language hosts to request a
particular version of a provider. If this occurs, the source evaluator
specifically records the intent to load a provider with a given version
and produces a "default" provider registration that requests exactly
that version. This allows the source evaluator to produce multiple
default providers for a signle package, which was previously not
possible.

This is accomplished by having the source evaluator deal in the
"ProviderRequest" type, which is a tuple of version and package. A
request to load a provider whose version matches the package of a
previously loaded provider will re-use the existing default provider. If
the version was not previously loaded, a new default provider is
injected.

* CR Feedback: raise error if semver is invalid

* CR: call String() if you want a hash key

* Update pkg/resource/deploy/providers/provider.go

Co-Authored-By: swgillespie <sean@pulumi.com>
@lukehoban
Copy link
Member Author

We got the core of the engine versioning implemented in M22. We still need to wire this through into the various providers in M23.

@ellismg
Copy link
Contributor

ellismg commented May 24, 2019

We have completed the work here. When we did so, we discovered an issue which is tracked by #2753, but we'll use that that track the completion of this feature.

@ellismg ellismg closed this as completed May 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p1 A bug severe enough to be the next item assigned to an engineer
Projects
None yet
Development

No branches or pull requests

7 participants