Documentation ¶
Overview ¶
Package plugin introduces plugins for Aptomi engine, which are responsible for component instantiation and management on different cloud providers (e.g. deployment plugin, such as k8s/helm) and also configuration of underlying cloud infrastructure components (e.g. istio plugin).
Index ¶
- type DeployPlugin
- type MockDeployPlugin
- func (p *MockDeployPlugin) Cleanup() error
- func (p *MockDeployPlugin) Create(cluster *lang.Cluster, deployName string, params util.NestedParameterMap, ...) error
- func (p *MockDeployPlugin) Destroy(cluster *lang.Cluster, deployName string, params util.NestedParameterMap, ...) error
- func (p *MockDeployPlugin) Endpoints(cluster *lang.Cluster, deployName string, params util.NestedParameterMap, ...) (map[string]string, error)
- func (p *MockDeployPlugin) GetSupportedCodeTypes() []string
- func (p *MockDeployPlugin) Update(cluster *lang.Cluster, deployName string, params util.NestedParameterMap, ...) error
- type MockDeployPluginFailComponents
- func (p *MockDeployPluginFailComponents) Cleanup() error
- func (p *MockDeployPluginFailComponents) Create(cluster *lang.Cluster, deployName string, params util.NestedParameterMap, ...) error
- func (p *MockDeployPluginFailComponents) Destroy(cluster *lang.Cluster, deployName string, params util.NestedParameterMap, ...) error
- func (p *MockDeployPluginFailComponents) Endpoints(cluster *lang.Cluster, deployName string, params util.NestedParameterMap, ...) (map[string]string, error)
- func (p *MockDeployPluginFailComponents) GetSupportedCodeTypes() []string
- func (p *MockDeployPluginFailComponents) Update(cluster *lang.Cluster, deployName string, params util.NestedParameterMap, ...) error
- type MockPostProcessPlugin
- type MockRegistry
- type Plugin
- type PostProcessPlugin
- type Registry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeployPlugin ¶
type DeployPlugin interface { Plugin GetSupportedCodeTypes() []string Create(cluster *lang.Cluster, deployName string, params util.NestedParameterMap, eventLog *event.Log) error Update(cluster *lang.Cluster, deployName string, params util.NestedParameterMap, eventLog *event.Log) error Destroy(cluster *lang.Cluster, deployName string, params util.NestedParameterMap, eventLog *event.Log) error Endpoints(cluster *lang.Cluster, deployName string, params util.NestedParameterMap, eventLog *event.Log) (map[string]string, error) }
DeployPlugin is a definition of deployment plugin which takes care of creating, updating and destroying component instances in the cloud
type MockDeployPlugin ¶
MockDeployPlugin is a mock plugin which does nothing, except sleeping a given time amount on every action
func (*MockDeployPlugin) Create ¶
func (p *MockDeployPlugin) Create(cluster *lang.Cluster, deployName string, params util.NestedParameterMap, eventLog *event.Log) error
Create does nothing but sleeps
func (*MockDeployPlugin) Destroy ¶
func (p *MockDeployPlugin) Destroy(cluster *lang.Cluster, deployName string, params util.NestedParameterMap, eventLog *event.Log) error
Destroy does nothing but sleeps
func (*MockDeployPlugin) Endpoints ¶
func (p *MockDeployPlugin) Endpoints(cluster *lang.Cluster, deployName string, params util.NestedParameterMap, eventLog *event.Log) (map[string]string, error)
Endpoints sleeps and then always returns an empty set of endpoints
func (*MockDeployPlugin) GetSupportedCodeTypes ¶
func (p *MockDeployPlugin) GetSupportedCodeTypes() []string
GetSupportedCodeTypes does nothing
type MockDeployPluginFailComponents ¶
type MockDeployPluginFailComponents struct {
FailComponents []string
}
MockDeployPluginFailComponents is a mock plugin which does nothing, except fails component actions if their name contains one of the given strings
func (*MockDeployPluginFailComponents) Cleanup ¶
func (p *MockDeployPluginFailComponents) Cleanup() error
Cleanup does nothing
func (*MockDeployPluginFailComponents) Create ¶
func (p *MockDeployPluginFailComponents) Create(cluster *lang.Cluster, deployName string, params util.NestedParameterMap, eventLog *event.Log) error
Create does nothing, except failing components if their name contains of the strings from FailComponents
func (*MockDeployPluginFailComponents) Destroy ¶
func (p *MockDeployPluginFailComponents) Destroy(cluster *lang.Cluster, deployName string, params util.NestedParameterMap, eventLog *event.Log) error
Destroy does nothing, except failing components if their name contains of the strings from FailComponents
func (*MockDeployPluginFailComponents) Endpoints ¶
func (p *MockDeployPluginFailComponents) Endpoints(cluster *lang.Cluster, deployName string, params util.NestedParameterMap, eventLog *event.Log) (map[string]string, error)
Endpoints always returns an empty set of endpoints
func (*MockDeployPluginFailComponents) GetSupportedCodeTypes ¶
func (p *MockDeployPluginFailComponents) GetSupportedCodeTypes() []string
GetSupportedCodeTypes does nothing
func (*MockDeployPluginFailComponents) Update ¶
func (p *MockDeployPluginFailComponents) Update(cluster *lang.Cluster, deployName string, params util.NestedParameterMap, eventLog *event.Log) error
Update does nothing, except failing components if their name contains of the strings from FailComponents
type MockPostProcessPlugin ¶
type MockPostProcessPlugin struct { }
MockPostProcessPlugin is a mock post-processing plugin which does nothing
func (*MockPostProcessPlugin) Cleanup ¶
func (p *MockPostProcessPlugin) Cleanup() error
Cleanup does nothing
type MockRegistry ¶
type MockRegistry struct { DeployPlugin DeployPlugin PostProcessPlugin PostProcessPlugin }
MockRegistry is a mock plugin registry, with a single deployment plugin and a single post-processing plugin. It's useful in unit tests and running policy apply in noop mode (e.g. for testing UI without deploying changes)
func (*MockRegistry) GetDeployPlugin ¶
func (reg *MockRegistry) GetDeployPlugin(codeType string) (DeployPlugin, error)
GetDeployPlugin always returns the same deployment plugin
func (*MockRegistry) GetPostProcessingPlugins ¶
func (reg *MockRegistry) GetPostProcessingPlugins() []PostProcessPlugin
GetPostProcessingPlugins always returns the same post-processing plugin
type Plugin ¶
type Plugin interface {
Cleanup() error
}
Plugin is a base interface for all engine plugins
type PostProcessPlugin ¶
type PostProcessPlugin interface { Plugin Process(desiredPolicy *lang.Policy, desiredState *resolve.PolicyResolution, externalData *external.Data, eventLog *event.Log) error }
PostProcessPlugin is a definition of post-processing plugin which gets called once by an action from the engine applier, after engine is done processing all component instances
type Registry ¶
type Registry interface { GetDeployPlugin(codeType string) (DeployPlugin, error) GetPostProcessingPlugins() []PostProcessPlugin }
Registry is a registry of all Aptomi engine plugins
func NewRegistry ¶
func NewRegistry(deployPlugins []DeployPlugin, postProcessPlugins []PostProcessPlugin) Registry
NewRegistry creates a registry of aptomi engine plugins