1
0
Fork 0
mirror of https://github.com/external-secrets/external-secrets.git synced 2024-12-14 11:57:59 +00:00

Add support for Yandex Lockbox: custom API endpoint

This commit is contained in:
zamysel 2021-08-17 20:13:13 +03:00
parent 0815fcf857
commit 6b2f852eb6
7 changed files with 14 additions and 4 deletions

View file

@ -26,6 +26,9 @@ type YandexLockboxAuth struct {
// YandexLockboxProvider Configures a store to sync secrets using the Yandex Lockbox provider.
type YandexLockboxProvider struct {
// Yandex.Cloud API endpoint
Endpoint string `json:"endpoint,omitempty"`
// Auth defines the information necessary to authenticate against Yandex Lockbox
Auth YandexLockboxAuth `json:"auth"`
}

View file

@ -637,6 +637,9 @@ spec:
- name
type: object
type: object
endpoint:
description: Yandex.Cloud API endpoint
type: string
required:
- auth
type: object

View file

@ -637,6 +637,9 @@ spec:
- name
type: object
type: object
endpoint:
description: Yandex.Cloud API endpoint
type: string
required:
- auth
type: object

View file

@ -22,7 +22,7 @@ import (
// Creates LockboxClient with the given authorized key.
type LockboxClientCreator interface {
Create(ctx context.Context, authorizedKey *iamkey.Key) (LockboxClient, error)
Create(ctx context.Context, endpoint string, authorizedKey *iamkey.Key) (LockboxClient, error)
}
// Responsible for accessing Lockbox secrets.

View file

@ -30,7 +30,7 @@ type LockboxClientCreator struct {
Backend *LockboxBackend
}
func (lcc *LockboxClientCreator) Create(ctx context.Context, authorizedKey *iamkey.Key) (client.LockboxClient, error) {
func (lcc *LockboxClientCreator) Create(ctx context.Context, endpoint string, authorizedKey *iamkey.Key) (client.LockboxClient, error) {
return &LockboxClient{lcc.Backend, authorizedKey}, nil
}

View file

@ -27,7 +27,7 @@ import (
type LockboxClientCreator struct {
}
func (lb *LockboxClientCreator) Create(ctx context.Context, authorizedKey *iamkey.Key) (client.LockboxClient, error) {
func (lb *LockboxClientCreator) Create(ctx context.Context, endpoint string, authorizedKey *iamkey.Key) (client.LockboxClient, error) {
credentials, err := ycsdk.ServiceAccountKey(authorizedKey)
if err != nil {
return nil, err
@ -35,6 +35,7 @@ func (lb *LockboxClientCreator) Create(ctx context.Context, authorizedKey *iamke
sdk, err := ycsdk.Build(ctx, ycsdk.Config{
Credentials: credentials,
Endpoint: endpoint,
})
if err != nil {
return nil, err

View file

@ -78,7 +78,7 @@ func (p *lockboxProvider) NewClient(ctx context.Context, store esv1alpha1.Generi
return nil, fmt.Errorf("unable to unmarshal authorized key: %w", err)
}
lb, err := p.lockboxClientCreator.Create(ctx, &authorizedKey)
lb, err := p.lockboxClientCreator.Create(ctx, storeSpecYandexLockbox.Endpoint, &authorizedKey)
if err != nil {
return nil, fmt.Errorf("failed to create Yandex.Cloud SDK: %w", err)
}