Skip to content

Commit

Permalink
feat: add external secret store api and interface
Browse files Browse the repository at this point in the history
  • Loading branch information
adohe committed Nov 21, 2023
1 parent f59e4e0 commit 4c0c635
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pkg/apis/secrets/types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package secrets

// SecretStoreSpec contains configuration to describe target secret store.
type SecretStoreSpec struct {
Provider *ProviderSpec `yaml:"provider" json:"provider"`
}

// ProviderSpec contains provider-specific configuration.
type ProviderSpec struct {
AWS *AWSProvider `yaml:"aws,omitempty" json:"aws,omitempty"`
}

// AWSProvider configures a store to retrieve secrets from AWS.
type AWSProvider struct {

Check failure on line 14 in pkg/apis/secrets/types.go

View workflow job for this annotation

GitHub Actions / Golang Lint

File is not `gofumpt`-ed (gofumpt)
}
21 changes: 21 additions & 0 deletions pkg/secrets/interface.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package secrets

import (
"context"

secretsapi "kusionstack.io/kusion/pkg/apis/secrets"
)

// SecretStore provides the interface to interact with various cloud secret manager.
type SecretStore interface {
// GetSecret retrieves ref secret from backend secret manager.
GetSecret(ctx context.Context, ref string) ([]byte, error)
}

// SecretStoreProvider is a factory type for secret store.
type SecretStoreProvider interface {
// Type returns a string that reflects the type of this provider.
Type() string
// NewSecretStore constructs a usable secret store with specific provider spec.
NewSecretStore(spec *secretsapi.SecretStoreSpec) (SecretStore, error)
}

0 comments on commit 4c0c635

Please sign in to comment.