Documentation ¶
Index ¶
- Constants
- Variables
- func AddSecrets(specs []*Spec)
- func AddSecretsFor(spec *Spec)
- func DeleteExtractedCredentials(id string) error
- func DumpJSON(obj interface{}) (string, error)
- func InitializeClusterConfig(config ClusterConfig)
- func InitializeSecretsCache(rules []AssociationRule)
- func LoadJSON(payload string, obj interface{}) error
- func RecoverExtractCredentials(podname, ns, fqname, id string, method JobMethod, targets []string, rt int) error
- func SetExtractedCredentials(id string, creds *ExtractedCredentials) error
- func SetExtractedCredentialsWithLabels(id string, creds *ExtractedCredentials, labels map[string]string) error
- func SpecLogDump(spec *Spec)
- func SpecsLogDump(specs []*Spec)
- type AssociationRule
- type BindInstance
- type ClusterConfig
- type Context
- type Dependency
- type Executor
- type ExecutorAccessors
- type ExecutorAsync
- type ExecutorConfig
- type ExtractedCredentials
- type JobMethod
- type JobState
- type MockExecutor
- func (_m *MockExecutor) Bind(instance *ServiceInstance, parameters *Parameters, bindingID string) <-chan StatusMessage
- func (_m *MockExecutor) DashboardURL() string
- func (_m *MockExecutor) Deprovision(instance *ServiceInstance) <-chan StatusMessage
- func (_m *MockExecutor) ExtractedCredentials() *ExtractedCredentials
- func (_m *MockExecutor) LastStatus() StatusMessage
- func (_m *MockExecutor) PodName() string
- func (_m *MockExecutor) Provision(_a0 *ServiceInstance) <-chan StatusMessage
- func (_m *MockExecutor) Unbind(instance *ServiceInstance, parameters *Parameters, bindingID string) <-chan StatusMessage
- func (_m *MockExecutor) Update(instance *ServiceInstance) <-chan StatusMessage
- type NilableNumber
- type ParameterDescriptor
- type Parameters
- type Plan
- type RecoverStatus
- type Schema
- type SchemaPlan
- type SecretsConfig
- type ServiceBindingSchema
- type ServiceInstance
- type ServiceInstanceSchema
- type Spec
- type SpecManifest
- type State
- type StatusMessage
Constants ¶
const ( // StateNotYetStarted - Executor has not yet started state. StateNotYetStarted State = "not yet started" // StateInProgress - APB is in progress state StateInProgress State = "in progress" // StateSucceeded - Succeeded state StateSucceeded State = "succeeded" // StateFailed - Failed state StateFailed State = "failed" // ApbContainerName - The name of the apb container ApbContainerName = "apb" // ProvisionCredentialsKey parameter name passed to APBs ProvisionCredentialsKey = "_apb_provision_creds" // BindCredentialsKey parameter name passed to APBs BindCredentialsKey = "_apb_bind_creds" // ClusterKey parameter name passed to APBs ClusterKey = "cluster" // NamespaceKey parameter name passed to APBs NamespaceKey = "namespace" )
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" )
const MaxRuntimeVersion = 2
MaxRuntimeVersion constant to describe maximum supported runtime version
const MaxSpecVersion = "1.0.0"
MaxSpecVersion constant to describe maximum supported spec version
const MinRuntimeVersion = 1
MinRuntimeVersion constant to describe minimum supported runtime version
const MinSpecVersion = "1.0.0"
MinSpecVersion constant to describe minimum supported spec version
Variables ¶
var ( // ErrExtractedCredentialsNotFound - Extracted Credentials are not found. ErrExtractedCredentialsNotFound = fmt.Errorf("credentials not found") )
Functions ¶
func AddSecrets ¶
func AddSecrets(specs []*Spec)
AddSecrets - Uses the AssociationRules generated from config to link specs to secrets and add them to the global secrets cache
func AddSecretsFor ¶
func AddSecretsFor(spec *Spec)
AddSecretsFor - Uses AssociationRules for a given spec to link the spec to secrets and add them to the global secrets cache
func DeleteExtractedCredentials ¶
DeleteExtractedCredentials - Will delete the extracted credentials for a caller of the APB package. Please use this method with caution.
func InitializeClusterConfig ¶
func InitializeClusterConfig(config ClusterConfig)
InitializeClusterConfig - initialize the cluster config.
func InitializeSecretsCache ¶
func InitializeSecretsCache(rules []AssociationRule)
InitializeSecretsCache - Generates AssociationRules from config and initializes the global secrets cache
func RecoverExtractCredentials ¶
func RecoverExtractCredentials(podname, ns, fqname, id string, method JobMethod, targets []string, rt int) error
RecoverExtractCredentials - Recover extracted credentials.
func SetExtractedCredentials ¶
func SetExtractedCredentials(id string, creds *ExtractedCredentials) error
SetExtractedCredentials - Will set new credentials for an id. Please use this method with caution.
func SetExtractedCredentialsWithLabels ¶
func SetExtractedCredentialsWithLabels(id string, creds *ExtractedCredentials, labels map[string]string) error
SetExtractedCredentialsWithLabels - Will set new credentials for an id and add specified labels Please use this method with caution.
Types ¶
type AssociationRule ¶
AssociationRule - A rule to associate an apb with a secret
type BindInstance ¶
type BindInstance struct { ID uuid.UUID `json:"id"` ServiceID uuid.UUID `json:"service_id"` Parameters *Parameters `json:"parameters"` CreateJobKey string }
BindInstance - Binding Instance describes a completed binding
func (*BindInstance) IsEqual ¶
func (bi *BindInstance) IsEqual(newbi *BindInstance) bool
IsEqual - Determines if two BindInstances are equal, omitting any Parameters that generally get added by the broker itself.
func (*BindInstance) UserParameters ¶
func (bi *BindInstance) UserParameters() Parameters
UserParameters - returns the Parameters field with any keys and values removed that are typically added by the broker itself. The return value should represent what a OSB API client provides in a bind request.
type ClusterConfig ¶
type ClusterConfig struct { PullPolicy string `yaml:"image_pull_policy"` SandboxRole string `yaml:"sandbox_role"` Namespace string `yaml:"namespace"` KeepNamespace bool `yaml:"keep_namespace"` KeepNamespaceOnError bool `yaml:"keep_namespace_on_error"` }
ClusterConfig - Configuration for the cluster.
type Dependency ¶
type Dependency struct { Key string `json:"key,omitempty" yaml:"key,omitempty"` Value interface{} `json:"value,omitempty" yaml:"value,omitempty"` }
Dependency - a parameter dependency
type Executor ¶
type Executor interface { ExecutorAccessors ExecutorAsync }
Executor - Composite executor interface.
func NewExecutor ¶
func NewExecutor(config ExecutorConfig) Executor
NewExecutor - Creates a new Executor for running an APB.
type ExecutorAccessors ¶
type ExecutorAccessors interface { PodName() string LastStatus() StatusMessage DashboardURL() string ExtractedCredentials() *ExtractedCredentials }
ExecutorAccessors - Accessors for Executor state.
type ExecutorAsync ¶
type ExecutorAsync interface { Provision(*ServiceInstance) <-chan StatusMessage Deprovision(instance *ServiceInstance) <-chan StatusMessage Bind(instance *ServiceInstance, parameters *Parameters, bindingID string) <-chan StatusMessage Unbind(instance *ServiceInstance, parameters *Parameters, bindingID string) <-chan StatusMessage Update(instance *ServiceInstance) <-chan StatusMessage }
ExecutorAsync - Main interface used for running APBs asynchronously.
type ExecutorConfig ¶
type ExecutorConfig struct { // This will tell the executor to use the context namespace as the // namespace for the bundle to be created in. SkipCreateNS bool }
ExecutorConfig - configuration for the executor.
type ExtractedCredentials ¶
type ExtractedCredentials struct {
Credentials map[string]interface{} `json:"credentials,omitempty"`
}
ExtractedCredentials - Credentials that are extracted from the pods
func GetExtractedCredentials ¶
func GetExtractedCredentials(id string) (*ExtractedCredentials, error)
GetExtractedCredentials - Will get the extracted credentials for a caller of the APB package.
type JobMethod ¶
type JobMethod string
JobMethod - APB Method Type that the job was spawned from.
const ( // JobMethodProvision - Provision MethodType const. JobMethodProvision JobMethod = "provision" // JobMethodDeprovision - Deprovision MethodType const. JobMethodDeprovision JobMethod = "deprovision" // JobMethodBind - Bind MethodType const. JobMethodBind JobMethod = "bind" // JobMethodUnbind - Unbind MethodType const. JobMethodUnbind JobMethod = "unbind" // JobMethodUpdate - Update MethodType const. JobMethodUpdate JobMethod = "update" )
type JobState ¶
type JobState struct { Token string `json:"token"` State State `json:"state"` Podname string `json:"podname"` Method JobMethod `json:"method"` Error string `json:"error"` Description string `json:"description"` }
JobState - The job state
type MockExecutor ¶
MockExecutor is an autogenerated mock type for the Executor type
func (*MockExecutor) Bind ¶
func (_m *MockExecutor) Bind(instance *ServiceInstance, parameters *Parameters, bindingID string) <-chan StatusMessage
Bind provides a mock function with given fields: instance, parameters, bindingID
func (*MockExecutor) DashboardURL ¶
func (_m *MockExecutor) DashboardURL() string
DashboardURL provides a mock function with given fields:
func (*MockExecutor) Deprovision ¶
func (_m *MockExecutor) Deprovision(instance *ServiceInstance) <-chan StatusMessage
Deprovision provides a mock function with given fields: instance
func (*MockExecutor) ExtractedCredentials ¶
func (_m *MockExecutor) ExtractedCredentials() *ExtractedCredentials
ExtractedCredentials provides a mock function with given fields:
func (*MockExecutor) LastStatus ¶
func (_m *MockExecutor) LastStatus() StatusMessage
LastStatus provides a mock function with given fields:
func (*MockExecutor) PodName ¶
func (_m *MockExecutor) PodName() string
PodName provides a mock function with given fields:
func (*MockExecutor) Provision ¶
func (_m *MockExecutor) Provision(_a0 *ServiceInstance) <-chan StatusMessage
Provision provides a mock function with given fields: _a0
func (*MockExecutor) Unbind ¶
func (_m *MockExecutor) Unbind(instance *ServiceInstance, parameters *Parameters, bindingID string) <-chan StatusMessage
Unbind provides a mock function with given fields: instance, parameters, bindingID
func (*MockExecutor) Update ¶
func (_m *MockExecutor) Update(instance *ServiceInstance) <-chan StatusMessage
Update provides a mock function with given fields: instance
type NilableNumber ¶
type NilableNumber float64
NilableNumber - Number that could be nil (e.g. when omitted from json/yaml)
type ParameterDescriptor ¶
type ParameterDescriptor struct { Name string `json:"name"` Title string `json:"title"` Type string `json:"type"` Description string `json:"description,omitempty"` Default interface{} `json:"default,omitempty"` // string validators DeprecatedMaxlength int `json:"maxlength,omitempty" yaml:"maxlength,omitempty"` // backwards compatibility MaxLength int `json:"maxLength,omitempty" yaml:"max_length,omitempty"` MinLength int `json:"minLength,omitempty" yaml:"min_length,omitempty"` Pattern string `json:"pattern,omitempty"` // number validators MultipleOf float64 `json:"multipleOf,omitempty" yaml:"multiple_of,omitempty"` Maximum *NilableNumber `json:"maximum,omitempty"` ExclusiveMaximum *NilableNumber `json:"exclusiveMaximum,omitempty" yaml:"exclusive_maximum,omitempty"` Minimum *NilableNumber `json:"minimum,omitempty"` ExclusiveMinimum *NilableNumber `json:"exclusiveMinimum,omitempty" yaml:"exclusive_minimum,omitempty"` Enum []string `json:"enum,omitempty"` Required bool `json:"required"` Updatable bool `json:"updatable"` DisplayType string `json:"displayType,omitempty" yaml:"display_type,omitempty"` DisplayGroup string `json:"displayGroup,omitempty" yaml:"display_group,omitempty"` Dependencies []Dependency `json:"dependencies,omitempty" yaml:"dependencies,omitempty"` }
ParameterDescriptor - a parameter to be used by the service catalog to get data.
type Parameters ¶
type Parameters map[string]interface{}
Parameters - generic string to object or value parameter
func (*Parameters) Add ¶
func (p *Parameters) Add(key string, val interface{})
Add adds a values to the parameters indexed by key
func (*Parameters) EnsureDefaults ¶
func (p *Parameters) EnsureDefaults()
EnsureDefaults returns the sets any expected parameters that are not present with default values
type Plan ¶
type Plan struct { ID string `json:"id" yaml:"-"` Name string `json:"name"` Description string `json:"description"` Metadata map[string]interface{} `json:"metadata,omitempty"` Free bool `json:"free,omitempty"` Bindable bool `json:"bindable,omitempty"` Parameters []ParameterDescriptor `json:"parameters"` BindParameters []ParameterDescriptor `json:"bind_parameters,omitempty" yaml:"bind_parameters,omitempty"` UpdatesTo []string `json:"updates_to,omitempty" yaml:"updates_to,omitempty"` }
Plan - Plan object describing an APB deployment plan and associated parameters
func (*Plan) GetParameter ¶
func (p *Plan) GetParameter(name string) *ParameterDescriptor
GetParameter - retrieves a reference to a ParameterDescriptor from a plan by name. Will return nil if the requested ParameterDescriptor does not exist.
type RecoverStatus ¶
RecoverStatus - Status of the recovery.
type Schema ¶
type Schema struct { ServiceInstance ServiceInstanceSchema `json:"service_instance"` ServiceBinding ServiceBindingSchema `json:"service_binding"` }
Schema - Schema to be returned based on 2.13 of the open service broker api. https://github.com/avade/servicebroker/blob/cda8c57b6a4bb7eaee84be20bb52dc155269758a/spec.md
type SchemaPlan ¶
type SchemaPlan struct { ID string `json:"id" yaml:"-"` Name string `json:"name"` Description string `json:"description"` Metadata map[string]interface{} `json:"metadata,omitempty"` Free bool `json:"free,omitempty"` Bindable bool `json:"bindable,omitempty"` UpdatesTo []string `json:"updates_to,omitempty" yaml:"updates_to,omitempty"` Schemas Schema `json:"schema,omitempty"` }
SchemaPlan - Plan object describing an APB deployment plan and associated parameters
func ConvertPlansToSchema ¶
func ConvertPlansToSchema(plans []Plan) ([]SchemaPlan, error)
ConvertPlansToSchema - converts plans to schema
type SecretsConfig ¶
type SecretsConfig struct { Name string `yaml:"name"` ApbName string `yaml:"apb_name"` Secret string `yaml:"secret"` }
SecretsConfig - Entry for a secret config block in broker config
func (SecretsConfig) Validate ¶
func (c SecretsConfig) Validate() bool
Validate - Ensures that the secrets config is valid (i.e., all strings are non-empty
type ServiceBindingSchema ¶
ServiceBindingSchema - Schema definitions for creating a service binding.
type ServiceInstance ¶
type ServiceInstance struct { ID uuid.UUID `json:"id"` Spec *Spec `json:"spec"` Context *Context `json:"context"` Parameters *Parameters `json:"parameters"` BindingIDs map[string]bool `json:"binding_ids"` DashboardURL string `json:"dashboard_url"` }
ServiceInstance - Service Instance describes a running service.
func (*ServiceInstance) AddBinding ¶
func (si *ServiceInstance) AddBinding(bindingUUID uuid.UUID)
AddBinding - Add binding ID to service instance
func (*ServiceInstance) RemoveBinding ¶
func (si *ServiceInstance) RemoveBinding(bindingUUID uuid.UUID)
RemoveBinding - Remove binding ID from service instance
type ServiceInstanceSchema ¶
type ServiceInstanceSchema struct { Create map[string]*schema.Schema `json:"create"` Update map[string]*schema.Schema `json:"update"` }
ServiceInstanceSchema - Schema definitions for creating and updating a service instance. Toyed with the idea of making an InputParameters that was a *schema.Schema based on 2.13 of the open service broker api. https://github.com/avade/servicebroker/blob/cda8c57b6a4bb7eaee84be20bb52dc155269758a/spec.md
type Spec ¶
type Spec struct { ID string `json:"id"` Runtime int `json:"runtime"` Version string `json:"version"` FQName string `json:"name" yaml:"name" mapstructure:"name"` Image string `json:"image" yaml:"-"` Tags []string `json:"tags"` Bindable bool `json:"bindable"` Description string `json:"description"` Metadata map[string]interface{} `json:"metadata,omitempty"` Async string `json:"async"` Plans []Plan `json:"plans"` Alpha map[string]interface{} `json:"alpha,omitempty"` Delete bool `json:"delete"` }
Spec - A APB spec
func FilterSecrets ¶
FilterSecrets - Filters all parameters masked by a secret out of the given specs
func (*Spec) GetPlan ¶
GetPlan - retrieves a plan from a spec by name. Will return empty plan and false if the requested plan does not exist.
func (*Spec) GetPlanFromID ¶
GetPlanFromID - retrieves a plan from a spec by id. Will return empty plan and false if the requested plan does not exist.
func (*Spec) ValidateVersion ¶
ValidateVersion - Ensure the Bundle Spec Version and Bundle Runtime Version are within bounds
type SpecManifest ¶
SpecManifest - Spec ID to Spec manifest
func NewSpecManifest ¶
func NewSpecManifest(specs []*Spec) SpecManifest
NewSpecManifest - Creates Spec manifest
type StatusMessage ¶
StatusMessage - Describes the latest known status of a running APB