Skip to content

Commit 373f50a

Browse files
committed
isStandalone field on client too
1 parent 9229764 commit 373f50a

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

vault/client.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ type ClientOptions struct {
3434
GlobalVaultAuthOptions *common.GlobalVaultAuthOptions
3535
CredentialProviderFactory credentials.CredentialProviderFactory
3636
UserAgent string
37+
IsStandalone bool
3738
}
3839

3940
func defaultClientOptions() *ClientOptions {
@@ -199,6 +200,7 @@ var _ Client = (*defaultClient)(nil)
199200
type defaultClient struct {
200201
client *api.Client
201202
isClone bool
203+
isStandalone bool
202204
authObj *secretsv1beta1.VaultAuth
203205
connObj *secretsv1beta1.VaultConnection
204206
authSecret *api.Secret
@@ -356,7 +358,13 @@ func (c *defaultClient) GetCacheKey() (ClientCacheKey, error) {
356358
}
357359

358360
func (c *defaultClient) getCacheKey() (ClientCacheKey, error) {
359-
cacheKey, err := ComputeClientCacheKeyFromClient(c)
361+
var cacheKey ClientCacheKey
362+
var err error
363+
if c.isStandalone {
364+
cacheKey, err = computeClientCacheKey(c.authObj, c.connObj, c.credentialProvider.GetUID(), true)
365+
} else {
366+
cacheKey, err = ComputeClientCacheKeyFromClient(c)
367+
}
360368
if err != nil {
361369
return "", err
362370
}
@@ -824,6 +832,7 @@ func (c *defaultClient) init(ctx context.Context, client ctrlclient.Client,
824832
}
825833

826834
c.skipRenewal = opts.SkipRenewal
835+
c.isStandalone = opts.IsStandalone
827836
c.credentialProvider = credentialProvider
828837
c.client = vc
829838
c.authObj = authObj

vault/client_factory.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,7 @@ func (m *cachingClientFactory) clientOptions() *ClientOptions {
718718
WatcherDoneCh: m.callbackHandlerCh,
719719
GlobalVaultAuthOptions: m.GlobalVaultAuthOptions,
720720
CredentialProviderFactory: m.credentialProviderFactory,
721+
IsStandalone: m.isStandalone,
721722
}
722723
}
723724

0 commit comments

Comments
 (0)