types

package
v0.0.0-...-de69368 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MetricProviderPlugins

type MetricProviderPlugins struct {
	// MetricProviders is the list of plugin that implements a RpcMetricProvider
	MetricProviders []PluginItem `json:"metricProviderPlugins" yaml:"metricProviderPlugins"`
}

type PluginItem

type PluginItem struct {
	// Name of the plugin to use in the Rollout custom resources
	Name string `json:"name" yaml:"name"`
	// Location of the plugin. Supports http(s):// urls and file:// prefix
	Location string `json:"location" yaml:"location"`
	// Sha256 is the checksum of the file specified at the provided Location
	Sha256 string `json:"sha256" yaml:"sha256"`
	// Type of the plugin
	Type PluginType
	// Disabled indicates if the plugin should be ignored when referenced in Rollout custom resources. Only valid for a plugin of type Step.
	Disabled bool `json:"disabled" yaml:"disabled"`
	// Args holds command line arguments to initialize the plugin
	Args []string `json:"args" yaml:"args"`
}

type PluginType

type PluginType string

PluginType is a type of plugin

const (
	// PluginTypeMetricProvider is the type for a MetricProvider plugin
	PluginTypeMetricProvider PluginType = "MetricProvider"
	// PluginTypeTrafficRouter is the type for a TrafficRouter plugin
	PluginTypeTrafficRouter PluginType = "TrafficRouter"
	// PluginTypeStep is the type for a Step plugin
	PluginTypeStep PluginType = "Step"
)

type RpcError

type RpcError struct {
	ErrorString string
}

RpcError is a wrapper around the error type to allow for usage with net/rpc and empty ErrorString == "" is considered no error

func (RpcError) Error

func (e RpcError) Error() string

func (RpcError) HasError

func (e RpcError) HasError() bool

HasError returns true if there is an error

type RpcMetricProvider

type RpcMetricProvider interface {
	// Run start a new external system call for a measurement
	// Should be idempotent and do nothing if a call has already been started
	Run(*v1alpha1.AnalysisRun, v1alpha1.Metric) v1alpha1.Measurement
	// Resume Checks if the external system call is finished and returns the current measurement
	Resume(*v1alpha1.AnalysisRun, v1alpha1.Metric, v1alpha1.Measurement) v1alpha1.Measurement
	// Terminate will terminate an in-progress measurement
	Terminate(*v1alpha1.AnalysisRun, v1alpha1.Metric, v1alpha1.Measurement) v1alpha1.Measurement
	// GarbageCollect is used to garbage collect completed measurements to the specified limit
	GarbageCollect(*v1alpha1.AnalysisRun, v1alpha1.Metric, int) RpcError
	// Type gets the provider type
	Type() string
	// GetMetadata returns any additional metadata which providers need to store/display as part
	// of the metric result. For example, Prometheus uses is to store the final resolved queries.
	GetMetadata(metric v1alpha1.Metric) map[string]string
}

type RpcStep

type RpcStep interface {
	// Run executes a step plugin for the RpcStepContext and returns the result to the controller or an RpcError for unexpeted failures
	Run(*v1alpha1.Rollout, *RpcStepContext) (RpcStepResult, RpcError)
	// Terminate stops an uncompleted operation started by the Run operation
	Terminate(*v1alpha1.Rollout, *RpcStepContext) (RpcStepResult, RpcError)
	// Abort reverts the actions performed during the Run operation if necessary
	Abort(*v1alpha1.Rollout, *RpcStepContext) (RpcStepResult, RpcError)
	// Type returns the type of the step plugin
	Type() string
}

type RpcStepContext

type RpcStepContext struct {
	// PluginName is the name of the plugin as defined by the user
	PluginName string
	// Config holds the user specified configuration in the Rollout object for this plugin step
	Config json.RawMessage
	// Status holds a previous execution status related to the operation
	Status json.RawMessage
}

RpcStepContext is the context of the step plugin operation

type RpcStepResult

type RpcStepResult struct {
	// Phase of the operation to idicate if it has completed or not
	Phase StepPhase
	// Message contains information about the execution
	Message string
	// RequeueAfter is the duration to wait before executing the operation again when it does not return a completed phase
	RequeueAfter time.Duration
	// Status hold the execution status of this plugin step. It can be used to persist a state between executions
	Status json.RawMessage
}

type RpcTrafficRoutingReconciler

type RpcTrafficRoutingReconciler interface {
	// UpdateHash informs a traffic routing reconciler about new canary, stable, and additionalDestination(s) pod hashes
	UpdateHash(rollout *v1alpha1.Rollout, canaryHash, stableHash string, additionalDestinations []v1alpha1.WeightDestination) RpcError
	// SetWeight sets the canary weight to the desired weight
	SetWeight(rollout *v1alpha1.Rollout, desiredWeight int32, additionalDestinations []v1alpha1.WeightDestination) RpcError
	// SetHeaderRoute sets the header routing step
	SetHeaderRoute(rollout *v1alpha1.Rollout, setHeaderRoute *v1alpha1.SetHeaderRoute) RpcError
	// SetMirrorRoute sets up the traffic router to mirror traffic to a service
	SetMirrorRoute(rollout *v1alpha1.Rollout, setMirrorRoute *v1alpha1.SetMirrorRoute) RpcError
	// VerifyWeight returns true if the canary is at the desired weight and additionalDestinations are at the weights specified
	// Returns nil if weight verification is not supported or not applicable
	VerifyWeight(rollout *v1alpha1.Rollout, desiredWeight int32, additionalDestinations []v1alpha1.WeightDestination) (RpcVerified, RpcError)
	// RemoveManagedRoutes Removes all routes that are managed by rollouts by looking at spec.strategy.canary.trafficRouting.managedRoutes
	RemoveManagedRoutes(ro *v1alpha1.Rollout) RpcError
	// Type returns the type of the traffic routing reconciler
	Type() string
}

type RpcVerified

type RpcVerified int32

RpcVerified is a wrapper around the *bool as used in VerifyWeight for traffic routers. This is needed because net/rpc does not support pointers.

const (
	NotVerified RpcVerified = iota
	Verified
	NotImplemented
)

func (*RpcVerified) IsVerified

func (v *RpcVerified) IsVerified() *bool

type StepPhase

type StepPhase string

StepPhase is the type of phase of step plugin result

const (
	// PhaseRunning is the Running phase of a step plugin
	PhaseRunning StepPhase = "Running"
	// PhaseRunning is the Successful phase of a step plugin
	PhaseSuccessful StepPhase = "Successful"
	// PhaseRunning is the Failed phase of a step plugin
	PhaseFailed StepPhase = "Failed"
	// PhaseRunning is the Error phase of a step plugin
	PhaseError StepPhase = "Error"
)

func (StepPhase) Validate

func (p StepPhase) Validate() error

Validate the phase of a step plugin

type StepPlugins

type StepPlugins struct {
	// Steps is the list of plugin that implements a RpcStep
	Steps []PluginItem `json:"stepPlugins" yaml:"stepPlugins"`
}

type TrafficRouterPlugins

type TrafficRouterPlugins struct {
	// TrafficRouters is the list of plugin that implements a RpcTrafficRoutingReconciler
	TrafficRouters []PluginItem `json:"trafficRouterPlugins" yaml:"trafficRouterPlugins"`
}

Jump to

Keyboard shortcuts

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