generation

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: May 3, 2021 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetExperimentLabel

func SetExperimentLabel(key, value string) yaml.Filter

SetExperimentLabel is a filter that sets a label on an experiment object.

func SetExperimentName

func SetExperimentName(name string) yaml.Filter

SetExperimentName sets the name on the experiment. In addition, the experiment name is set as a suffix on any generated cluster roles or cluster role bindings.

func SetNamespace

func SetNamespace(namespace string) yaml.Filter

SetNamespace sets the namespace on a resource (if necessary).

Types

type ApplicationSelector

type ApplicationSelector struct {
	Application *redskyappsv1alpha1.Application
	Scenario    *redskyappsv1alpha1.Scenario
	Objective   *redskyappsv1alpha1.Objective
}

ApplicationSelector is responsible for "scanning" the application definition itself.

func (*ApplicationSelector) Map

func (s *ApplicationSelector) Map(*yaml.RNode, yaml.ResourceMeta) ([]interface{}, error)

Map ignores inputs (it should just be the null node from select) and produces additional markers for transform.

func (*ApplicationSelector) Select

func (s *ApplicationSelector) Select([]*yaml.RNode) ([]*yaml.RNode, error)

Select only returns an empty node to ensure that map will be called.

type BuiltInPrometheus

type BuiltInPrometheus struct {
	SetupTaskName          string
	ClusterRoleName        string
	ServiceAccountName     string
	ClusterRoleBindingName string

	scan.ObjectSlice
}

func (*BuiltInPrometheus) Update

type ContainerResourcesSelector

type ContainerResourcesSelector struct {
	scan.GenericSelector
	// Path to the list of containers.
	Path string `json:"path,omitempty"`
	// Create container resource specifications even if the original object does not contain them.
	CreateIfNotPresent bool `json:"create,omitempty"`
	// Regular expression matching the container name.
	ContainerName string `json:"containerName,omitempty"`
	// Names of the resources to select, defaults to ["memory", "cpu"].
	Resources []corev1.ResourceName `json:"resources,omitempty"`
	// contains filtered or unexported fields
}

ContainerResourcesSelector scans for container resources specifications (requests/limits).

func (*ContainerResourcesSelector) Map

func (s *ContainerResourcesSelector) Map(node *yaml.RNode, meta yaml.ResourceMeta) ([]interface{}, error)

Map inspects the supplied resource for container resources specifications.

func (*ContainerResourcesSelector) Select added in v1.11.1

func (s *ContainerResourcesSelector) Select(nodes []*yaml.RNode) ([]*yaml.RNode, error)

type CustomSource

type CustomSource struct {
	Scenario    *redskyappsv1alpha1.Scenario
	Objective   *redskyappsv1alpha1.Objective
	Application *redskyappsv1alpha1.Application
}

func (*CustomSource) Metrics

func (s *CustomSource) Metrics() ([]redskyv1beta1.Metric, error)

func (*CustomSource) Update

func (s *CustomSource) Update(exp *redskyv1beta1.Experiment) error

type DatadogMetricsSource

type DatadogMetricsSource struct {
	Goal *redskyappsv1alpha1.Goal
}

func (*DatadogMetricsSource) Metrics

func (s *DatadogMetricsSource) Metrics() ([]redskyv1beta1.Metric, error)

type DurationMetricsSource

type DurationMetricsSource struct {
	Goal *redskyappsv1alpha1.Goal
}

func (*DurationMetricsSource) Metrics

func (s *DurationMetricsSource) Metrics() ([]redskyv1beta1.Metric, error)

type ExperimentSource

type ExperimentSource interface {
	Update(exp *redskyv1beta1.Experiment) error
}

ExperimentSource allows selectors to modify the experiment directly. Note that for adding parameters, patches, or metrics, the appropriate source should be used instead.

type LocustSource

type LocustSource struct {
	Scenario    *redskyappsv1alpha1.Scenario
	Objective   *redskyappsv1alpha1.Objective
	Application *redskyappsv1alpha1.Application
}

func (*LocustSource) Metrics

func (s *LocustSource) Metrics() ([]redskyv1beta1.Metric, error)

func (*LocustSource) Read

func (s *LocustSource) Read() ([]*yaml.RNode, error)

func (*LocustSource) Update

func (s *LocustSource) Update(exp *redskyv1beta1.Experiment) error

type MetricSource

type MetricSource interface {
	Metrics() ([]redskyv1beta1.Metric, error)
}

MetricSource allows selectors to contribute metrics to an experiment.

type ParameterNamer

type ParameterNamer func(meta yaml.ResourceMeta, path []string, name string) string

ParameterNamer is used to compute the name of an optimization parameter.

type ParameterSource

type ParameterSource interface {
	Parameters(name ParameterNamer) ([]redskyv1beta1.Parameter, error)
}

ParameterSource allows selectors to add parameters to an experiment. In general PatchSources should also be ParameterSources to ensure the parameters used in the generated patches are configured on the experiment.

type PatchSource

type PatchSource interface {
	TargetRef() *corev1.ObjectReference
	Patch(name ParameterNamer) (yaml.Filter, error)
}

PatchSource allows selectors to contribute changes to the patch of a particular resource. In general, ParameterSource should also be implemented to add any parameters referenced by the generated patches.

type PrometheusMetricsSource

type PrometheusMetricsSource struct {
	Goal *redskyappsv1alpha1.Goal
}

func (*PrometheusMetricsSource) Metrics

type ReplicaSelector

type ReplicaSelector struct {
	scan.GenericSelector
	// Path to the replica field.
	Path string `json:"path,omitempty"`
	// Create container resource specifications even if the original object does not contain them.
	CreateIfNotPresent bool `json:"create,omitempty"`
}

ReplicaSelector identifies zero or more replica specifications.

func (*ReplicaSelector) Map

func (s *ReplicaSelector) Map(node *yaml.RNode, meta yaml.ResourceMeta) ([]interface{}, error)

type RequestsMetricsSource

type RequestsMetricsSource struct {
	Goal *redskyappsv1alpha1.Goal
}

func (*RequestsMetricsSource) Metrics

func (s *RequestsMetricsSource) Metrics() ([]redskyv1beta1.Metric, error)

type StormForgerSource

type StormForgerSource struct {
	Scenario    *redskyappsv1alpha1.Scenario
	Objective   *redskyappsv1alpha1.Objective
	Application *redskyappsv1alpha1.Application
}

func (*StormForgerSource) Metrics

func (s *StormForgerSource) Metrics() ([]redskyv1beta1.Metric, error)

func (*StormForgerSource) Read

func (s *StormForgerSource) Read() ([]*yaml.RNode, error)

func (*StormForgerSource) Update

type Transformer

type Transformer struct {
	// Flag indicating the all of the resources that were scanned should also be included in the output.
	IncludeApplicationResources bool
}

Transformer is used to convert all of the output from the selectors, only selector output matching the "*Source" interfaces are supported.

func (*Transformer) Transform

func (t *Transformer) Transform(nodes []*yaml.RNode, selected []interface{}) ([]*yaml.RNode, error)

Transform converts a scan of the supplied nodes into an experiment definition.

Jump to

Keyboard shortcuts

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