mirror of
https://github.com/external-secrets/external-secrets.git
synced 2024-12-14 11:57:59 +00:00
Yandex Lockbox Connection Leaks (#835)
* fix Yandex Lockbox provider connection leaks (https://github.com/external-secrets/external-secrets/issues/833) * fix Yandex Lockbox provider connection leaks (https://github.com/external-secrets/external-secrets/issues/833)
This commit is contained in:
parent
29d2418d8e
commit
45449dccc9
1 changed files with 6 additions and 10 deletions
|
@ -40,6 +40,9 @@ func (lb *YandexCloudCreator) CreateLockboxClient(ctx context.Context, apiEndpoi
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer func() {
|
||||
_ = closeSDK(ctx, sdk)
|
||||
}()
|
||||
|
||||
payloadAPIEndpoint, err := sdk.ApiEndpoint().ApiEndpoint().Get(ctx, &endpoint.GetApiEndpointRequest{
|
||||
ApiEndpointId: "lockbox-payload", // the ID from https://api.cloud.yandex.net/endpoints
|
||||
|
@ -48,11 +51,6 @@ func (lb *YandexCloudCreator) CreateLockboxClient(ctx context.Context, apiEndpoi
|
|||
return nil, err
|
||||
}
|
||||
|
||||
err = closeSDK(ctx, sdk)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
tlsConfig := tls.Config{MinVersion: tls.VersionTLS12}
|
||||
|
||||
if caCertificate != nil {
|
||||
|
@ -85,17 +83,15 @@ func (lb *YandexCloudCreator) CreateIamToken(ctx context.Context, apiEndpoint st
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer func() {
|
||||
_ = closeSDK(ctx, sdk)
|
||||
}()
|
||||
|
||||
iamToken, err := sdk.CreateIAMToken(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = closeSDK(ctx, sdk)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &client.IamToken{Token: iamToken.IamToken, ExpiresAt: iamToken.ExpiresAt.AsTime()}, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue