pulumi/pkg/resource/deploy
Will Jones 15184d702e
Add `Handshake` to the provider protocol (#17819)
Fixes https://github.com/pulumi/pulumi/issues/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

---------

Co-authored-by: Fraser Waters <fraser@pulumi.com>
2024-11-26 17:35:47 +00:00
..
deploytest Add `Handshake` to the provider protocol (#17819) 2024-11-26 17:35:47 +00:00
providers Add `Handshake` to the provider protocol (#17819) 2024-11-26 17:35:47 +00:00
builtins.go Add `Handshake` to the provider protocol (#17819) 2024-11-26 17:35:47 +00:00
builtins_test.go Normalize plugin.Provider methods to (Context, Request) -> (Response, error) (#16302) 2024-06-07 19:47:49 +00:00
deployment.go Implement plugin download cancellation (#17621) 2024-11-12 18:04:25 +00:00
deployment_executor.go Centralize resource state dependency traversal (#17320) 2024-09-23 08:37:34 +00:00
deployment_executor_test.go Enable goheader rule and add missing license headers (#15473) 2024-09-09 12:05:45 +00:00
deployment_test.go Introduce snapshot metadata (#17430) 2024-09-30 16:45:40 +00:00
doc.go Document Go packages (#6009) 2021-01-11 11:07:59 -07:00
import.go Extend the TestReplacementParameterizedProvider test (#16644) 2024-07-15 08:33:36 +00:00
import_test.go Have `Host.Provider` accept a `PackageDescriptor` (#17244) 2024-09-12 13:17:30 +00:00
manifest.go Split Manifest type to it's own file (#8712) 2022-01-10 12:25:24 +00:00
manifest_test.go Refactor: move plugin kind to apitype (#15946) 2024-04-25 17:30:30 +00:00
plan.go Enable goheader rule and add missing license headers (#15473) 2024-09-09 12:05:45 +00:00
plan_test.go [ci] `pkg/resource/deploy` coverage (#14831) 2023-12-19 16:14:40 +00:00
snapshot.go Persist metadata about snapshot integrity errors (#17291) 2024-11-06 17:35:27 +00:00
snapshot_test.go Fix flake in TestSnapshotPrune_FixesDanglingReferences (#17492) 2024-10-07 08:55:16 +00:00
source.go allow component providers to return more detailed error messages (#17306) 2024-09-25 15:38:36 +00:00
source_error.go Clean up deployment options (#16357) 2024-06-11 13:37:57 +00:00
source_error_test.go Clean up deployment options (#16357) 2024-06-11 13:37:57 +00:00
source_eval.go allow InputPropertyErrors from Calls (#17567) 2024-11-07 09:56:04 +00:00
source_eval_test.go allow InputPropertyErrors from Calls (#17567) 2024-11-07 09:56:04 +00:00
source_null.go Clean up deployment options (#16357) 2024-06-11 13:37:57 +00:00
source_query.go allow component providers to return more detailed error messages (#17306) 2024-09-25 15:38:36 +00:00
source_query_test.go allow component providers to return more detailed error messages (#17306) 2024-09-25 15:38:36 +00:00
state_builder.go Normalize URNs in `DeletedWith` references (#17666) 2024-11-05 13:27:11 +00:00
state_builder_test.go Normalize URNs in `DeletedWith` references (#17666) 2024-11-05 13:27:11 +00:00
step.go Enable some more linting rules (#17456) 2024-10-03 17:37:13 +00:00
step_executor.go Use int32 in Go interfaces that map to protobufs using int32 (#17068) 2024-08-28 13:45:17 +00:00
step_executor_test.go Clean up deployment options (#16357) 2024-06-11 13:37:57 +00:00
step_generator.go Support renaming providers in targeted operations (#17746) 2024-11-13 16:54:16 +00:00
step_generator_test.go Enable some more linting rules (#17456) 2024-10-03 17:37:13 +00:00
step_test.go Add input keys from diff during import step to warning and error message (#17312) 2024-09-25 13:21:50 +00:00
target.go Allow accessing configuration in Python dynamic providers (#17673) 2024-11-07 10:12:24 +00:00
target_test.go upgrade to latest version of golangci-lint (#15977) 2024-04-19 06:20:33 +00:00