Documentation
¶
Index ¶
- Constants
- func NewMockAdapter() (SecureStorage, *MockAdapter)
- type AuthConfig
- type InputDelete
- type InputLookup
- type InputLookupKeys
- type InputStore
- type MockAdapter
- type MockDelete
- type MockLookup
- type MockLookupKeys
- type MockStore
- type OutputDelete
- type OutputLookup
- type OutputLookupKeys
- type OutputStore
- type RealVaultApi
- func (v *RealVaultApi) Delete(path string) (*api.Secret, error)
- func (v *RealVaultApi) List(path string) (*api.Secret, error)
- func (v *RealVaultApi) Read(path string) (*api.Secret, error)
- func (v *RealVaultApi) SetToken(t string)
- func (v *RealVaultApi) Write(path string, data map[string]interface{}) (*api.Secret, error)
- type SecureStorage
- type VaultAdapter
- type VaultApi
Constants ¶
const DefaultBasePath = "secret"
const EnvVaultAuthPath = "CRAY_VAULT_AUTH_PATH"
const EnvVaultJWTFile = "CRAY_VAULT_JWT_FILE"
These Env var are provided globally to pods
const EnvVaultRoleFile = "CRAY_VAULT_ROLE_FILE"
Variables ¶
This section is empty.
Functions ¶
func NewMockAdapter ¶
func NewMockAdapter() (SecureStorage, *MockAdapter)
Types ¶
type AuthConfig ¶
type AuthConfig struct {
JWTFile string
RoleFile string
Path string
// contains filtered or unexported fields
}
AuthConfig struct for vault k8s authentication
func DefaultAuthConfig ¶
func DefaultAuthConfig() *AuthConfig
DefaultAuthConfig Create the default auth config that will work for almost all scenarios
func (*AuthConfig) GetAuthArgs ¶
func (authConfig *AuthConfig) GetAuthArgs() map[string]interface{}
GetAuthArgs generates the ars required for generating an auth token
func (*AuthConfig) GetAuthPath ¶
func (authConfig *AuthConfig) GetAuthPath() string
GetAuthPath Getter for auth path key
func (*AuthConfig) LoadJWT ¶
func (authConfig *AuthConfig) LoadJWT() error
LoadJWT save contents of JWTFile to the jwt field
func (*AuthConfig) LoadRole ¶
func (authConfig *AuthConfig) LoadRole() error
LoadRole save contents of RoleFile to the role field
func (*AuthConfig) ReadEnvironment ¶
func (authConfig *AuthConfig) ReadEnvironment() error
ReadEnvironment Update an authConfig with environment variables
type InputDelete ¶
type InputDelete struct {
Key string
}
type InputLookup ¶
type InputLookup struct {
Key string
}
type InputLookupKeys ¶
type InputLookupKeys struct {
KeyPath string
}
type InputStore ¶
type InputStore struct {
Key string
Value interface{}
}
type MockAdapter ¶
type MockAdapter struct {
StoreNum int
StoreData []MockStore
LookupNum int
LookupData []MockLookup
DeleteNum int
DeleteData []MockDelete
LookupKeysNum int
LookupKeysData []MockLookupKeys
}
func (*MockAdapter) Delete ¶
func (ss *MockAdapter) Delete(key string) error
func (*MockAdapter) Lookup ¶
func (ss *MockAdapter) Lookup(key string, output interface{}) error
func (*MockAdapter) LookupKeys ¶
func (ss *MockAdapter) LookupKeys(keyPath string) ([]string, error)
func (*MockAdapter) Store ¶
func (ss *MockAdapter) Store(key string, value interface{}) error
type MockDelete ¶
type MockDelete struct {
Input InputDelete
Output OutputDelete
}
type MockLookup ¶
type MockLookup struct {
Input InputLookup
Output OutputLookup
}
type MockLookupKeys ¶
type MockLookupKeys struct {
Input InputLookupKeys
Output OutputLookupKeys
}
type MockStore ¶
type MockStore struct {
Input InputStore
Output OutputStore
}
type OutputDelete ¶
type OutputDelete struct {
Err error
}
type OutputLookup ¶
type OutputLookup struct {
Output interface{}
Err error
}
type OutputLookupKeys ¶
type OutputStore ¶
type OutputStore struct {
Err error
}
type RealVaultApi ¶
func (*RealVaultApi) SetToken ¶
func (v *RealVaultApi) SetToken(t string)
type SecureStorage ¶
type SecureStorage interface {
Store(key string, value interface{}) error
Lookup(key string, output interface{}) error
Delete(key string) error
LookupKeys(keyPath string) ([]string, error)
}
func NewVaultAdapter ¶
func NewVaultAdapter(basePath string) (SecureStorage, error)
Create a new SecureStorage interface that uses Vault. This connects to vault.
type VaultAdapter ¶
type VaultAdapter struct {
Config *api.Config
Client VaultApi
AuthConfig *AuthConfig
BasePath string
VaultRetry int
}
func (*VaultAdapter) Delete ¶
func (ss *VaultAdapter) Delete(key string) error
Remove a struct from Vault at the location specified by key. This function prepends the basePath. Retries are implemented for token renewal.
func (*VaultAdapter) Lookup ¶
func (ss *VaultAdapter) Lookup(key string, output interface{}) error
Read a struct from Vault at the location specified by key. This function prepends the basePath. Retries are implemented for token renewal.
func (*VaultAdapter) LookupKeys ¶
func (ss *VaultAdapter) LookupKeys(keyPath string) ([]string, error)
Get a list of keys that exsist in Vault at the path specified by keyPath. This function prepends the basePath. Retries are implemented for token renewal.
func (*VaultAdapter) Store ¶
func (ss *VaultAdapter) Store(key string, value interface{}) error
Write a struct to Vault at the location specified by key. This function prepends the basePath. Retries are implemented for token renewal.
type VaultApi ¶
type VaultApi interface {
Read(path string) (*api.Secret, error)
Write(path string, data map[string]interface{}) (*api.Secret, error)
Delete(path string) (*api.Secret, error)
List(path string) (*api.Secret, error)
SetToken(t string)
}
///////////////////////////////////////////////////////////////////////////// Vault API interface - This interface wraps only a subset of functions for api.Client so as to reduce the amount of functions that need to be mocked for unit testing. /////////////////////////////////////////////////////////////////////////////