analysis

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2023 License: Apache-2.0 Imports: 19 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrayMeasurement added in v1.3.0

func ArrayMeasurement(run *v1alpha1.AnalysisRun, metricName string) []v1alpha1.Measurement

func BackgroundLabels

func BackgroundLabels(podHash, instanceID string) map[string]string

BackgroundLabels returns a map[string]string of common labels for the background analysis

func BuildArgumentsForRolloutAnalysisRun

func BuildArgumentsForRolloutAnalysisRun(args []v1alpha1.AnalysisRunArgument, stableRS, newRS *appsv1.ReplicaSet, r *v1alpha1.Rollout) ([]v1alpha1.Argument, error)

BuildArgumentsForRolloutAnalysisRun builds the arguments for a analysis base created by a rollout

func CreateWithCollisionCounter

func CreateWithCollisionCounter(logCtx *log.Entry, analysisRunIf argoprojclient.AnalysisRunInterface, run v1alpha1.AnalysisRun) (*v1alpha1.AnalysisRun, error)

CreateWithCollisionCounter attempts to create the given analysisrun and if an AlreadyExists error is encountered, and the existing run is semantically equal and running, returns the exiting run.

func FilterAnalysisRuns

func FilterAnalysisRuns(ars []*v1alpha1.AnalysisRun, cond func(ar *v1alpha1.AnalysisRun) bool) ([]*v1alpha1.AnalysisRun, []*v1alpha1.AnalysisRun)

func FilterAnalysisRunsByName

func FilterAnalysisRunsByName(analysisRuns []*v1alpha1.AnalysisRun, name string) *v1alpha1.AnalysisRun

FilterAnalysisRunsByName returns the analysisRuns with the name provided

func FilterAnalysisRunsByRolloutType

func FilterAnalysisRunsByRolloutType(analysisRuns []*v1alpha1.AnalysisRun, typeFilter string) []*v1alpha1.AnalysisRun

FilterAnalysisRunsByRolloutType returns a list of analysisRuns that have the rollout-type of the typeFilter

func FilterAnalysisRunsToDelete

func FilterAnalysisRunsToDelete(ars []*v1alpha1.AnalysisRun, allRSs []*appsv1.ReplicaSet, limitSuccessful int32, limitUnsuccessful int32) []*v1alpha1.AnalysisRun

FilterAnalysisRunsToDelete returns a list of analysis runs that should be deleted in the cases where: 1. The analysis run has no pod hash label, 2. There is no ReplicaSet with the same pod hash as the analysis run 3. The ReplicaSet that has the same pod hash as the analysis run has a deletiontimestamp. Note: It is okay to use pod hash for filtering since the analysis run's pod hash is originally derived from the new RS. Even if there is a library change during the lifetime of the analysis run, the ReplicaSet's pod hash that the analysis run references does not change.

func FlattenTemplates added in v0.8.0

func FlattenTemplates(templates []*v1alpha1.AnalysisTemplate, clusterTemplates []*v1alpha1.ClusterAnalysisTemplate) (*v1alpha1.AnalysisTemplate, error)

func GetCurrentAnalysisRunByType added in v0.8.0

func GetCurrentAnalysisRunByType(currentArs []*v1alpha1.AnalysisRun, kind string) *v1alpha1.AnalysisRun

func GetDryRunMetrics added in v1.2.0

func GetDryRunMetrics(dryRunMetrics []v1alpha1.DryRun, metrics []v1alpha1.Metric) (map[string]bool, error)

GetDryRunMetrics returns an array of metric names matching the RegEx rules from the Dry-Run metrics.

func GetInstanceID added in v0.7.0

func GetInstanceID(obj runtime.Object) string

GetInstanceID takes an object and returns the controller instance id if it has one

func GetMeasurementRetentionMetrics added in v1.2.0

func GetMeasurementRetentionMetrics(measurementRetentionMetrics []v1alpha1.MeasurementRetention, metrics []v1alpha1.Metric) (map[string]*v1alpha1.MeasurementRetention, error)

GetMeasurementRetentionMetrics returns an array of metric names matching the RegEx rules from the MeasurementRetention rules.

func GetResult

func GetResult(run *v1alpha1.AnalysisRun, metricName string) *v1alpha1.MetricResult

GetResult returns the metric result by name

func IsSemanticallyEqual

func IsSemanticallyEqual(left, right v1alpha1.AnalysisRunSpec) bool

IsSemanticallyEqual checks to see if two analysis runs are semantically equal

func IsTerminating

func IsTerminating(run *v1alpha1.AnalysisRun) bool

IsTerminating returns whether or not the analysis run is terminating, either because a terminate was requested explicitly, or because a metric has already measured Failed, Error, or Inconclusive which causes the run to end prematurely.

func IsWorse

func IsWorse(current, new v1alpha1.AnalysisPhase) bool

IsWorse returns whether or not the new health status code is a worser condition than the current. Both statuses must be already completed

func LastMeasurement

func LastMeasurement(run *v1alpha1.AnalysisRun, metricName string) *v1alpha1.Measurement

LastMeasurement returns the last measurement started or completed for a specific metric

func MergeArgs

func MergeArgs(incomingArgs, templateArgs []v1alpha1.Argument) ([]v1alpha1.Argument, error)

MergeArgs merges two lists of arguments, the incoming and the templates. If there are any unresolved arguments that have no value, raises an error.

func MetricCompleted

func MetricCompleted(run *v1alpha1.AnalysisRun, metricName string) bool

MetricCompleted returns whether or not a metric was completed or not

func NewAnalysisRunFromTemplates added in v0.8.0

func NewAnalysisRunFromTemplates(templates []*v1alpha1.AnalysisTemplate, clusterTemplates []*v1alpha1.ClusterAnalysisTemplate, args []v1alpha1.Argument, dryRunMetrics []v1alpha1.DryRun, measurementRetentionMetrics []v1alpha1.MeasurementRetention, name, generateName, namespace string) (*v1alpha1.AnalysisRun, error)

func NewAnalysisRunFromUnstructured added in v0.10.0

func NewAnalysisRunFromUnstructured(obj *unstructured.Unstructured, templateArgs []v1alpha1.Argument, name, generateName, namespace string) (*unstructured.Unstructured, error)

func PostPromotionLabels added in v0.8.0

func PostPromotionLabels(podHash, instanceID string) map[string]string

PostPromotionLabels returns a map[string]string of common labels for the post promotion analysis

func PrePromotionLabels added in v0.8.0

func PrePromotionLabels(podHash, instanceID string) map[string]string

PrePromotionLabels returns a map[string]string of common labels for the pre promotion analysis

func ResolveArgs added in v1.0.0

func ResolveArgs(args []v1alpha1.Argument) error

func ResolveMetricArgs added in v1.0.0

func ResolveMetricArgs(metric v1alpha1.Metric, args []v1alpha1.Argument) (*v1alpha1.Metric, error)

ResolveMetricArgs resolves args for single metric in AnalysisRun Returns resolved metric Uses ResolveQuotedArgs to handle escaped quotes

func SetResult

func SetResult(run *v1alpha1.AnalysisRun, result v1alpha1.MetricResult)

SetResult updates the metric result

func SortAnalysisRunByPodHash

func SortAnalysisRunByPodHash(ars []*v1alpha1.AnalysisRun) map[string][]*v1alpha1.AnalysisRun

SortAnalysisRunByPodHash returns map with a podHash as a key and an array of analysisRuns with that pod hash

func StepLabels

func StepLabels(index int32, podHash, instanceID string) map[string]string

StepLabels returns a map[string]string of common labels for analysisruns created from an analysis step

func TerminateRun

func TerminateRun(analysisRunIf argoprojclient.AnalysisRunInterface, name string) error

TerminateRun terminates an analysis run

func ValidateMetric

func ValidateMetric(metric v1alpha1.Metric) error

ValidateMetric validates a single metric spec

func ValidateMetrics

func ValidateMetrics(metrics []v1alpha1.Metric) error

ValidateMetrics validates an analysis template spec

func Worst

func Worst(left, right v1alpha1.AnalysisPhase) v1alpha1.AnalysisPhase

Worst returns the worst of the two statuses

Types

type AnalysisRunByCreationTimestamp added in v1.1.0

type AnalysisRunByCreationTimestamp []*v1alpha1.AnalysisRun

AnalysisRunByCreationTimestamp sorts a list of AnalysisRun by creation timestamp

func (AnalysisRunByCreationTimestamp) Len added in v1.1.0

func (AnalysisRunByCreationTimestamp) Less added in v1.1.0

func (AnalysisRunByCreationTimestamp) Swap added in v1.1.0

func (o AnalysisRunByCreationTimestamp) Swap(i, j int)

type CurrentAnalysisRuns added in v0.9.0

type CurrentAnalysisRuns struct {
	BlueGreenPrePromotion  *v1alpha1.AnalysisRun
	BlueGreenPostPromotion *v1alpha1.AnalysisRun
	CanaryStep             *v1alpha1.AnalysisRun
	CanaryBackground       *v1alpha1.AnalysisRun
}

CurrentAnalysisRuns holds all the current analysis runs for a Rollout

func FilterCurrentRolloutAnalysisRuns

func FilterCurrentRolloutAnalysisRuns(analysisRuns []*v1alpha1.AnalysisRun, r *v1alpha1.Rollout) (CurrentAnalysisRuns, []*v1alpha1.AnalysisRun)

FilterCurrentRolloutAnalysisRuns returns analysisRuns that match the analysisRuns listed in the rollout status

func (CurrentAnalysisRuns) ToArray added in v0.9.0

func (c CurrentAnalysisRuns) ToArray() []*v1alpha1.AnalysisRun

Jump to

Keyboard shortcuts

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