plugin

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package plugin introduces plugins for Aptomi engine such as cluster (kubernetes) and code (helm) plugins.

Cluster plugins responsible for working with different cloud providers, such as kubernetes. Separated instance of the cluster plugins is created for each lang.Cluster, so, it could safely cache data.

Code plugins responsible for handling deployment into the cloud providers, such as helm. Separated instance of the code plugin is created for each pair of the lang.Cluster and code type, for example, cluster "test-1" and code type "helm".

PostProcess plugins has access to all data across all cloud providers and executed as a last step.

All plugins created for single enforcement cycle or API call using plugin registry.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base added in v0.1.11

type Base interface {
	Cleanup() error
}

Base is a base interface for all engine plugins

type ClusterPlugin added in v0.1.11

type ClusterPlugin interface {
	Base

	Validate() error
}

ClusterPlugin is a definition of cluster plugin which takes care of cluster operations such as validation in the cloud. It's created for specific cluster and enforcement cycle or API call.

type ClusterPluginConstructor added in v0.1.11

type ClusterPluginConstructor func(cluster *lang.Cluster, cfg config.Plugins) (ClusterPlugin, error)

ClusterPluginConstructor represents constructor for the cluster plugin

type CodePlugin added in v0.1.11

type CodePlugin interface {
	Base

	Create(deployName string, params util.NestedParameterMap, eventLog *event.Log) error
	Update(deployName string, params util.NestedParameterMap, eventLog *event.Log) error
	Destroy(deployName string, params util.NestedParameterMap, eventLog *event.Log) error
	Endpoints(deployName string, params util.NestedParameterMap, eventLog *event.Log) (map[string]string, error)
	Resources(deployName string, params util.NestedParameterMap, eventLog *event.Log) (Resources, error)
}

CodePlugin is a definition of deployment plugin which takes care of creating, updating and destroying component instances in the cloud. It's created for specific cluster and enforcement cycle or API call.

type CodePluginConstructor added in v0.1.11

type CodePluginConstructor func(cluster ClusterPlugin, cfg config.Plugins) (CodePlugin, error)

CodePluginConstructor represents constructor the the code plugin

type PostProcessPlugin

type PostProcessPlugin interface {
	Base

	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 {
	ForCluster(cluster *lang.Cluster) (ClusterPlugin, error)
	ForCodeType(cluster *lang.Cluster, codeType string) (CodePlugin, error)
	PostProcess() []PostProcessPlugin
}

Registry is a registry of all Aptomi engine plugins

func NewRegistry

func NewRegistry(config config.Plugins, clusterTypes map[string]ClusterPluginConstructor, codeTypes map[string]map[string]CodePluginConstructor, 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

type Resource added in v0.1.12

type Resource = []string

Resource is a list of columns representing deployed resources

type ResourceRegistry added in v0.1.12

type ResourceRegistry struct {
	// contains filtered or unexported fields
}

ResourceRegistry helps to store and use handlers and headers for resources

func NewResourceRegistry added in v0.1.12

func NewResourceRegistry() *ResourceRegistry

NewResourceRegistry creates new ResourceRegistry

func (*ResourceRegistry) AddHandler added in v0.1.12

func (reg *ResourceRegistry) AddHandler(resourceType string, headers []string, handler ResourceTypeHandler)

AddHandler adds specified resource type handler to registry by specified resource type with specified headers

func (*ResourceRegistry) Handle added in v0.1.12

func (reg *ResourceRegistry) Handle(resourceType string, obj interface{}) []string

Handle returns columns for specified object with specified resource type

func (*ResourceRegistry) Headers added in v0.1.12

func (reg *ResourceRegistry) Headers(resourceType string) []string

Headers returns headers for specified resource type

func (*ResourceRegistry) IsSupported added in v0.1.12

func (reg *ResourceRegistry) IsSupported(resourceType string) bool

IsSupported checks if specified resource type supported by registry

type ResourceTable added in v0.1.12

type ResourceTable struct {
	Headers []string
	Items   []Resource
}

ResourceTable is a list of resources of the same type as columns with column headers

type ResourceTypeHandler added in v0.1.12

type ResourceTypeHandler func(obj interface{}) []string

ResourceTypeHandler represents function that converts object into columns

type Resources added in v0.1.12

type Resources map[string]*ResourceTable

Resources represents description of all deployed on a cluster resources of different types

func (Resources) Merge added in v0.1.12

func (status Resources) Merge(with Resources)

Merge takes Resources and merges them into current resources object

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