plugin

package
v0.1.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 17, 2018 License: Apache-2.0 Imports: 8 Imported by: 27

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

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

type MockDeployPlugin struct {
	SleepTime time.Duration
}

MockDeployPlugin is a mock plugin which does nothing, except sleeping a given time amount on every action

func (*MockDeployPlugin) Cleanup

func (p *MockDeployPlugin) Cleanup() error

Cleanup does nothing

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

func (*MockDeployPlugin) Update

func (p *MockDeployPlugin) Update(cluster *lang.Cluster, deployName string, params util.NestedParameterMap, eventLog *event.Log) error

Update does nothing but sleeps

type MockDeployPluginFailComponents

type MockDeployPluginFailComponents struct {
	// FailComponents is a list of substrings to search in component names. When found, the corresponding component will be failed
	FailComponents []string

	// FailAsPanic, if set to true, will panic on matching components. Otherwise it will return an error
	FailAsPanic bool
}

MockDeployPluginFailComponents is a mock plugin which does nothing, except fails component actions if their name contains one of the given strings

func (*MockDeployPluginFailComponents) Cleanup

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

func (*MockPostProcessPlugin) Process

func (p *MockPostProcessPlugin) Process(desiredPolicy *lang.Policy, desiredState *resolve.PolicyResolution, externalData *external.Data, eventLog *event.Log) error

Process 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

type RegistryFactory added in v0.1.10

type RegistryFactory func() Registry

RegistryFactory returns plugins registry on demand

Directories

Path Synopsis
Package helm implements support for Helm plugin, which can deploy Helm charts onto k8s clusters via Helm API.
Package helm implements support for Helm plugin, which can deploy Helm charts onto k8s clusters via Helm API.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL