Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.


Summary
Overview
The v2 provider enables out-of-process providers using gRPC, allowing a single provider codebase to expose multiple APIs (e.g., AWS SecretsManager, ParameterStore, ECR, STS) without requiring modifications to existing v1 provider implementations.
Open Issues
ADR Deliverables
main.goFlow Diagram
graph TB subgraph "ESO Controller (In-Process)" A[ExternalSecret Controller] -->|"GetProviderSecretData()"| B[Client Manager] B -->|"Check storeRef.kind == Provider"| C{Is v2 Provider?} C -->|Yes| D[Create gRPC Client] C -->|No| E[Use v1 Provider In-Process] D --> F[V2ClientWrapper<br/>v1→v2 Adapter] F -->|"Implements<br/>esv1.SecretsClient"| G[gRPC Client] end subgraph "gRPC Communication" G -->|"GetSecretRequest<br/>{ProviderRef, RemoteRef}"| H[mTLS Connection] end subgraph "Provider Server (Out-of-Process)" H --> I[AdapterServer<br/>v2→v1 Adapter] I -->|"1. Parse ProviderRef<br/>(apiVersion + kind)"| J{Resolve GVK} J -->|"SecretsManager"| K[AWS v1 Provider] J -->|"ParameterStore"| K J -->|"ECRAuthToken"| K J -->|"STSSessionToken"| K K -->|"2. Fetch CR<br/>(e.g., SecretsManager)"| M[v1.SyntheticStore] M -->|"4. Call v1 provider"| N[provider.NewClient] N -->|"5. Get secret"| O[AWS API] O -->|"6. Return secret data"| H end style A fill:#e1f5ff style F fill:#ffe1f5 style I fill:#fff5e1 style K fill:#e1ffe11. Client-Side: v2 → v1 Adapter (In-Process)
How ExternalSecret Controller Uses gRPC Clients
In
externalsecret_controller_secret.go, the reconciler uses the Client Manager to obtain provider clients:Client Manager: Creating gRPC Clients
When a
SecretStoreRefhaskind: Provider, the manager creates a gRPC client:The
getV2ProviderClientmethod:ProviderresourceV2ClientWrapper(the v2→v1 adapter)V2ClientWrapper: Implementing v1.SecretsClient
The wrapper adapts the gRPC
v2.Providerinterface to the v1SecretsClientinterface:gRPC Client: Making RPC Calls
The gRPC client converts v1 types to protobuf and makes RPC calls:
2. Multiple APIs via ProviderReference Mapping
Separate CRDs for Each AWS Service
The AWS v2 provider exposes separate Kubernetes Custom Resources for different services:
Example:
SecretsManagerCRD:Future expansion will include
ParameterStore,ECRAuthToken,STSSessionToken, etc., all served by the same gRPC server process.3. Server-Side: v1 → v2 Adapter (Out-of-Process)
AdapterServer: Mapping ProviderRef to v1 Clients
The gRPC server uses
AdapterServerto map incomingProviderReference(apiVersion + kind) to v1 provider implementations:Resolving Provider from ProviderReference
The server resolves the v1 provider based on GVK:
GetSecret RPC Handler
The server receives GetSecret requests and delegates to v1 providers:
AWS Provider Main: Single Process, Multiple APIs
The AWS provider's main function sets up the mapping:
To add ParameterStore, you'd simply extend the mapping:
And update the
specMapperto handle the new Kind.Example manifest