Documentation ¶
Overview ¶
Code generated by mockery v1.0.0. DO NOT EDIT.
Index ¶
- Constants
- Variables
- func IsErrorCustomMsg(err error) bool
- func NewRuntime(config Configuration)
- type Configuration
- type CopySecretsToNamespaceFunc
- type ErrorCustomMsg
- type ExecutionContext
- type ExtractedCredential
- type MockRuntime
- func (_m *MockRuntime) CopySecretsToNamespace(_a0 ExecutionContext, _a1 string, _a2 []string) error
- func (_m *MockRuntime) CopyState(fromName string, toName string, fromNS string, toNS string) error
- func (_m *MockRuntime) CreateExtractedCredential(_a0 string, _a1 string, _a2 map[string]interface{}, _a3 map[string]string) error
- func (_m *MockRuntime) CreateSandbox(_a0 string, _a1 string, _a2 []string, _a3 string, _a4 map[string]string) (string, string, error)
- func (_m *MockRuntime) DeleteExtractedCredential(_a0 string, _a1 string) error
- func (_m *MockRuntime) DeleteState(name string) error
- func (_m *MockRuntime) DestroySandbox(_a0 string, _a1 string, _a2 []string, _a3 string, _a4 bool, _a5 bool)
- func (_m *MockRuntime) ExtractCredentials(_a0 string, _a1 string, _a2 int) ([]byte, error)
- func (_m *MockRuntime) GetExtractedCredential(_a0 string, _a1 string) (map[string]interface{}, error)
- func (_m *MockRuntime) GetRuntime() string
- func (_m *MockRuntime) MasterName(instanceID string) string
- func (_m *MockRuntime) MasterNamespace() string
- func (_m *MockRuntime) MountLocation() string
- func (_m *MockRuntime) RunBundle(_a0 ExecutionContext) (ExecutionContext, error)
- func (_m *MockRuntime) StateIsPresent(name string) (bool, error)
- func (_m *MockRuntime) UpdateExtractedCredential(_a0 string, _a1 string, _a2 map[string]interface{}, _a3 map[string]string) error
- func (_m *MockRuntime) ValidateRuntime() error
- func (_m *MockRuntime) WatchRunningBundle(_a0 string, _a1 string, _a2 UpdateDescriptionFn) error
- type PostSandboxCreate
- type PostSandboxDestroy
- type PreSandboxCreate
- type PreSandboxDestroy
- type ProxyConfig
- type RunBundleFunc
- type Runtime
- type StateManager
- type UpdateDescriptionFn
- type WatchRunningBundleFunc
Constants ¶
const ( // BundleContainerName - name of the container in the pod defintion // Used for the default runtime. BundleContainerName = "apb" )
const ( // GatherCredentialsCommand - Command used when execing for bind credentials // moving this constant here because eventually Extracting creds will // need to be moved to runtime. Therefore keeping all of this together // makes sense GatherCredentialsCommand = "broker-bind-creds" )
Variables ¶
var ( // ErrorPodPullErr - Error indicating we could not pull the image. ErrorPodPullErr = fmt.Errorf("Unable to pull APB image from it's registry. Please contact your cluster admin") // ErrorActionNotFound - Error indicating pod does not have the action. ErrorActionNotFound = fmt.Errorf("action not found") )
var ( //ErrCredentialsNotFound - Credentials not found. ErrCredentialsNotFound = errors.New("extracted credentials were not found") )
Functions ¶
func IsErrorCustomMsg ¶
IsErrorCustomMsg - true if it's a custom message error
func NewRuntime ¶
func NewRuntime(config Configuration)
NewRuntime - Initialize provider variable extCreds - You can pass an ExtractedCredential conforming object this will be used to do CRUD operations. If you want to use the default pass nil and we will use the built-in default of saving them as secrets in the broker namespace.
Types ¶
type Configuration ¶
type Configuration struct { // PostCreateSandboxHooks - The sandbox hooks that you would like to run. PostCreateSandboxHooks []PostSandboxCreate // PostDestroySandboxHooks - The sandbox hooks that you would like to run. PostDestroySandboxHooks []PostSandboxDestroy // PreCreateSandboxHooks - The sandbox hooks that you would like to run. PreCreateSandboxHooks []PreSandboxCreate // PreDestroySandboxHooks - The sandbox hooks that you would like to run. PreDestroySandboxHooks []PreSandboxDestroy // WatchBundle - this is the method that watches the bundle for completion. // The UpdateDescriptionFunc in the default case will call this function when the last description // annotation on the running bundle is changed. WatchBundle WatchRunningBundleFunc // RunBundle - This is the method that will run the bundle. RunBundle RunBundleFunc // CopySecretsToNamespace - This is the method that is used to copy // secrets from a namespace to the executionContext namespace. CopySecretsToNamespace CopySecretsToNamespaceFunc ExtractedCredential // StateMountLocation this is where on disk the state will be stored for a bundle StateMountLocation string // StateMasterNamespace the namespace where state created by bundles will be copied to between actions StateMasterNamespace string }
Configuration - The configuration for the runtime
type CopySecretsToNamespaceFunc ¶
type CopySecretsToNamespaceFunc func(ec ExecutionContext, cn string, secrets []string) error
CopySecretsToNamespaceFunc - copy secrets to namespace
type ErrorCustomMsg ¶
type ErrorCustomMsg struct {
// contains filtered or unexported fields
}
ErrorCustomMsg - An error to propagate the custom error message to the callers
func (ErrorCustomMsg) Error ¶
func (e ErrorCustomMsg) Error() string
type ExecutionContext ¶
type ExecutionContext struct { BundleName string // In k8s location is the namespace that the pod is running in Location string // Account/user that the bundle is running as Account string Targets []string Secrets []string ExtraVars string Image string Action string Policy string ProxyConfig *ProxyConfig Metadata map[string]string // StateName the name of the configmap that holds the state for the bundle StateName string // StateLocation the location in the pod that the state will be mounted StateLocation string }
ExecutionContext - Contains the information necessary to track and clean up an APB run
type ExtractedCredential ¶
type ExtractedCredential interface { // CreateExtractedCredentials - takes id, action, namespace, and credentials will save them. CreateExtractedCredential(string, string, map[string]interface{}, map[string]string) error // UpdateExtractedCredentials - takes id, action, namespace, and credentials will update them. UpdateExtractedCredential(string, string, map[string]interface{}, map[string]string) error // GetExtractedCredential - takes id, namespace will get credentials. GetExtractedCredential(string, string) (map[string]interface{}, error) // DeleteExtractedCredentials - takes id, namespace and deletes the credentials. DeleteExtractedCredential(string, string) error }
ExtractedCredential - Interface to define CRUD operations for how to manage extracted credentials
type MockRuntime ¶
MockRuntime is an autogenerated mock type for the MockRuntime type
func (*MockRuntime) CopySecretsToNamespace ¶
func (_m *MockRuntime) CopySecretsToNamespace(_a0 ExecutionContext, _a1 string, _a2 []string) error
CopySecretsToNamespace provides a mock function with given fields: _a0, _a1, _a2
func (*MockRuntime) CopyState ¶
CopyState provides a mock function with given fields: fromName, toName, fromNS, toNS
func (*MockRuntime) CreateExtractedCredential ¶
func (_m *MockRuntime) CreateExtractedCredential(_a0 string, _a1 string, _a2 map[string]interface{}, _a3 map[string]string) error
CreateExtractedCredential provides a mock function with given fields: _a0, _a1, _a2, _a3
func (*MockRuntime) CreateSandbox ¶
func (_m *MockRuntime) CreateSandbox(_a0 string, _a1 string, _a2 []string, _a3 string, _a4 map[string]string) (string, string, error)
CreateSandbox provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4
func (*MockRuntime) DeleteExtractedCredential ¶
func (_m *MockRuntime) DeleteExtractedCredential(_a0 string, _a1 string) error
DeleteExtractedCredential provides a mock function with given fields: _a0, _a1
func (*MockRuntime) DeleteState ¶
func (_m *MockRuntime) DeleteState(name string) error
DeleteState provides a mock function with given fields: name
func (*MockRuntime) DestroySandbox ¶
func (_m *MockRuntime) DestroySandbox(_a0 string, _a1 string, _a2 []string, _a3 string, _a4 bool, _a5 bool)
DestroySandbox provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4, _a5
func (*MockRuntime) ExtractCredentials ¶
ExtractCredentials provides a mock function with given fields: _a0, _a1, _a2
func (*MockRuntime) GetExtractedCredential ¶
func (_m *MockRuntime) GetExtractedCredential(_a0 string, _a1 string) (map[string]interface{}, error)
GetExtractedCredential provides a mock function with given fields: _a0, _a1
func (*MockRuntime) GetRuntime ¶
func (_m *MockRuntime) GetRuntime() string
GetMockRuntime provides a mock function with given fields:
func (*MockRuntime) MasterName ¶
func (_m *MockRuntime) MasterName(instanceID string) string
MasterName provides a mock function with given fields: instanceID
func (*MockRuntime) MasterNamespace ¶
func (_m *MockRuntime) MasterNamespace() string
MasterNamespace provides a mock function with given fields:
func (*MockRuntime) MountLocation ¶
func (_m *MockRuntime) MountLocation() string
MountLocation provides a mock function with given fields:
func (*MockRuntime) RunBundle ¶
func (_m *MockRuntime) RunBundle(_a0 ExecutionContext) (ExecutionContext, error)
RunBundle provides a mock function with given fields: _a0
func (*MockRuntime) StateIsPresent ¶
func (_m *MockRuntime) StateIsPresent(name string) (bool, error)
StateIsPresent provides a mock function with given fields: name
func (*MockRuntime) UpdateExtractedCredential ¶
func (_m *MockRuntime) UpdateExtractedCredential(_a0 string, _a1 string, _a2 map[string]interface{}, _a3 map[string]string) error
UpdateExtractedCredential provides a mock function with given fields: _a0, _a1, _a2, _a3
func (*MockRuntime) ValidateRuntime ¶
func (_m *MockRuntime) ValidateRuntime() error
ValidateMockRuntime provides a mock function with given fields:
func (*MockRuntime) WatchRunningBundle ¶
func (_m *MockRuntime) WatchRunningBundle(_a0 string, _a1 string, _a2 UpdateDescriptionFn) error
WatchRunningBundle provides a mock function with given fields: _a0, _a1, _a2
type PostSandboxCreate ¶
PostSandboxCreate - The post sand box creation function will be called after the sandbox is created for the APB. This function should not expect to panic and should fail gracefully by bubbling up the error and cleaning up after itself. Parameters in order of adding to the function. string - pod name is also the svc accounts name. string - namespace of the transient namespace. list of strings - target namespaces. string - abp role. return error.
type PostSandboxDestroy ¶
PostSandboxDestroy - The post sand box destroy function will be called after the sandbox is destroyed. This could mean the namespace is kept around if the apb failed and configuration conditions are met. This function should not expect to panic and should fail gracefully by bubbling up the error. This function should also not delete the namespace or the pod directly. This will most likely be used to clean up resources in pre/post create sandbox hooks. Parameters: string - pod / svc-account name string - pod transient namespace []string - target namespaces
type PreSandboxCreate ¶
PreSandboxCreate - The pre sand box creation function will be called before the sandbox is created for the bundle. This function should not expect to panic and should fail gracefully by bubbling up the error and cleaning up after itself. Parameters in order of adding to the function. string - pod name is also the svc accounts name. string - namespace of the transient namespace. list of strings - target namespaces. string - abp role. return error.
type PreSandboxDestroy ¶
PreSandboxDestroy - The pre sand box destroy function will be called before the sandbox is destroyed. This could mean the namespace is kept around if the apb failed and configuration conditions are met. This function should not expect to panic and should fail gracefully by bubbling up the error. This function should also not delete the namespace or the pod directly. This will most likely be used to clean up resources in pre/post create sandbox hooks. Parameters: string - pod / svc-account name string - pod transient namespace []string - target namespaces
type ProxyConfig ¶
ProxyConfig - Contains a desired proxy configuration for the broker and the assets that it spawns
type RunBundleFunc ¶
type RunBundleFunc func(ExecutionContext) (ExecutionContext, error)
RunBundleFunc - method that defines how to run a bundle
type Runtime ¶
type Runtime interface { ValidateRuntime() error GetRuntime() string CreateSandbox(string, string, []string, string, map[string]string) (string, string, error) DestroySandbox(string, string, []string, string, bool, bool) ExtractCredentials(string, string, int) ([]byte, error) ExtractedCredential WatchRunningBundle(string, string, UpdateDescriptionFn) error RunBundle(ExecutionContext) (ExecutionContext, error) CopySecretsToNamespace(ExecutionContext, string, []string) error StateManager }
Runtime - Abstraction for broker actions
var Provider Runtime
Provider - Variable for accessing provider functions
type StateManager ¶
type StateManager interface { CopyState(fromName, toName, fromNS, toNS string) error DeleteState(name string) error StateIsPresent(name string) (bool, error) MasterName(instanceID string) string MasterNamespace() string MountLocation() string }
StateManager defines an interface for managing state created by service bundles
type UpdateDescriptionFn ¶
UpdateDescriptionFn function that will should handle the LastDescription from the bundle.
type WatchRunningBundleFunc ¶
type WatchRunningBundleFunc func(string, string, UpdateDescriptionFn) error
WatchRunningBundleFunc - watches the pod until completion and will update the last description using the UpdateDescriptionFunction