[go: up one dir, main page]

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 Handshake to the provider protocol #17819

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Conversation

lunaris
Copy link
Collaborator
@lunaris lunaris commented Nov 20, 2024

Fixes #16876

The pulumi provider protocol gRPC always starts by calling CheckConfig and then Configure. The problem is that CheckConfig accepts a property bag, which could contain secrets or outputs or resource references, etc. However, the engine doesn't know if the provider supports these items (and vice versa) until Configure is called, since Configure is the call where the engine and the provider agree on which parts of the protocol they support.

This introduces a Handshake component to the provider protocol that establishes which version of the protocol the provider and engine support. This also adds the plugins root and program directories to that handshake request allowing a provider to know where it was started up from. This also replaces Provider.Attach as the handshake request includes the engine address to connect to.

Tasting notes:

  • Add Handshake with request/response to the protocol. Handshake starts as a high watermark for accepts secrets, accepts resources, etc but includes the plugins root and program directories (if possible), as well as the engine address. This pretty much replaces the need for Attach.
  • Modify dialPlugin (where the engine establishes gRPC connections to plugins) to take a callback that is used to initialise the connection
  • For non-provider plugins, pass testConnection, which captures the logic we have today -- call a dummy gRPC method and observed not implemented error to confirm connection is live
  • For provider plugins, pass handshake, which sends a Handshake and captures the response
  • All providers thus handshake at boot, as opposed to Configure, which a. happens later and b. is asynchronous
  • Modify provider implementation to track a protocol; move acceptSecrets and company from configSource to there
  • If Handshake is implemented, populate protocol on dialPlugin. If not, fallback to populating in Configure
  • Invariant: Configure implies protocol
  • The rest is largely plumbing
  • We can add similar Handshake methods for the other plugin types as well

if m.HandshakeF != nil {
return m.HandshakeF(ctx, req)
}
return HandshakeResponse{}, errors.New("Handshake not implemented")
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This will probably need to be nil rather than an error.

@Frassle Frassle marked this pull request as ready for review November 25, 2024 20:57
@Frassle Frassle requested a review from a team as a code owner November 25, 2024 20:57
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.

Separate protocol configuration and provider configuration
2 participants