stages

package
v0.6.98 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const DryRunResponseKey = "dryRunResponse"
View Source
const FillerPattern = `\$\(#ref\..+\)`
View Source
const ImportPattern = `\$\(#use\s.+\)`
View Source
const ProvisionSuffixKey = ".isProvisioned"
View Source
const UpdateSuffixKey = ".isUpdate"

Variables

View Source
var FillerRegex *regexp.Regexp
View Source
var ImportRegex *regexp.Regexp

Functions

This section is empty.

Types

type Chain

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

Chain allows to add any number of stages to be added to itself allowing "chaining" all of those functions

func CreateChain

func CreateChain() *Chain

CreateChain returns a pointer to the chain object

func (*Chain) Add

func (ch *Chain) Add(fn ChainStageFunction) *Chain

Add adds a function to the chain and returns a pointer to the Chain object

func (*Chain) Clear

func (ch *Chain) Clear() *Chain

Clear clears the chain and returns a pointer to the chain object

func (*Chain) Process

func (ch *Chain) Process(data *Data) *Chain

Process takes in a plan and starts the chain of the functions

Returns a pointer to the Chain object

type ChainStageFunction

type ChainStageFunction func(data *Data, err error, next ChainStageNextFunction)

ChainStageFunction is the type for function that will be invoked on each stage of the chain

func DryRun added in v0.6.49

There are two types of errors here: 1. Error while performing the Dry Run (when the DryRun request could not be sent) 2. Errors in Dry Run (when the Dry Run request was performed successfully but there are errors in the Object sent for DryRun) We are not considering #2 as an error. #2 is treated as the Response of the Dry Run. DryRun stage does not terminate the whole chain when an error of type #2 is encountered, it rather stores that information in the `Other` placeholder for future use. This is in contrast with the Validation stage where the Validation errors terminate the chain.

func Filler

func Filler(skipPrintLogs bool) ChainStageFunction

Filler - filler stage processes the pattern to subsitute Pattern

func ServiceIdentifierAndMutator added in v0.6.28

func ServiceIdentifierAndMutator(prov ServiceInfoProvider, act ServiceActionProvider) ChainStageFunction

ServiceIdentifier takes in a service identity provider and returns a ChainStageFunction

func Validator

func Validator(prov ServiceInfoProvider, act ServiceActionProvider, skipValidation bool) ChainStageFunction

type ChainStageNextFunction

type ChainStageNextFunction func(data *Data, err error)

type ChainStages

type ChainStages []ChainStageNextFunction

ChainStages type represents a slice of ChainStageFunction

type CompConfigPair

type CompConfigPair struct {
	Component     v1alpha1.Component
	Configuration v1alpha1.Configuration
	Hosts         map[meshmodel.Host]bool
}

type Data

type Data struct {
	Pattern                        *core.Pattern
	PatternSvcWorkloadCapabilities map[string]meshmodel.ComponentDefinition
	PatternSvcTraitCapabilities    map[string][]core.TraitCapability //Deprecated. This will be removed and is currently being used to carry properties

	// Other is for passing metadata across different stages
	Lock  sync.Mutex
	Other map[string]interface{}
}

Data is the struct that will be passed on each stage

type ServiceActionProvider

type ServiceActionProvider interface {
	Terminate(error)
	Log(msg string)
	Provision(CompConfigPair) (string, error)
	GetRegistry() *meshmodel.RegistryManager
	Persist(string, core.Service, bool) error
	DryRun([]v1alpha1.Component) (map[string]map[string]core.DryRunResponse2, error)
	Mutate(*core.Pattern) //Uses pre-defined policies/configuration to mutate the pattern
}

type ServiceInfoProvider

type ServiceInfoProvider interface {
	GetMesheryPatternResource(
		name string,
		namespace string,
		typ string,
		oamType string,
	) (ID *uuid.UUID, err error)
	GetServiceMesh() (name string, version string)
	GetAPIVersionForKind(kind string) string
	IsDelete() bool
}

Jump to

Keyboard shortcuts

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