experiment

package
v0.1.0-pre Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package experiment enables construction of an experiment object with handler/task lists within it.

Index

Constants

This section is empty.

Variables

View Source
var GetConfig = func() (*rest.Config, error) {
	return config.GetConfig()
}

GetConfig variable is useful for test mocks.

View Source
var NumAttempt = 10

NumAttempt is the number of times to attempt Get operation for a k8s resource

View Source
var Period = 18 * time.Second

Period is the time duration between between each attempt

Functions

func GetClient

func GetClient() (rc client.Client, err error)

GetClient constructs and returns a K8s client. The returned client has experiment.Experiment type registered.

func GetTypedObject

func GetTypedObject(nn *client.ObjectKey, obj client.Object) error

GetTypedObject gets a typed object from the k8s cluster. Types of such objects include experiment, knative service, etc. This function attempts to get the object `numAttempts` times, with the interval between attempts equal to `period`.

func Resource

func Resource(resource string) schema.GroupResource

Resource takes an unqualified resource and returns a Group qualified GroupResource

func UpdateInClusterExperiment

func UpdateInClusterExperiment(e *Experiment) (err error)

UpdateInClusterExperiment updates the experiment within cluster.

func UpdateVariable

func UpdateVariable(v *v2alpha1.VersionDetail, name string, value string) error

UpdateVariable updates a variable within the given VersionDetail. If the variable is already present in the VersionDetail object, the pre-existing value takes precedence and is retained; if not, the new value is inserted.

Types

type ActionMap

type ActionMap map[string][]base.TaskSpec

ActionMap type represents a map whose keys are actions names, and whose values are slices of TaskSpecs.

type Builder

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

Builder helps in construction of an experiment.

func (*Builder) Build

func (b *Builder) Build() (*Experiment, error)

Build returns the built experiment or error. Must call FromFile or FromCluster on b prior to invoking Build.

func (*Builder) FromCluster

func (b *Builder) FromCluster(nn *client.ObjectKey) *Builder

FromCluster fetches an experiment from k8s cluster.

func (*Builder) FromFile

func (b *Builder) FromFile(filePath string) *Builder

FromFile builds an experiment from a yaml file.

type Experiment

type Experiment struct {
	iter8.Experiment
	Spec Spec `json:"spec,omitempty" yaml:"spec,omitempty"`
}

Experiment is an enhancement of v2alpha1.Experiment struct that contains task list information.

func GetExperimentFromContext

func GetExperimentFromContext(ctx context.Context) (*Experiment, error)

GetExperimentFromContext gets the experiment object from given context.

func (*Experiment) Extrapolate

func (exp *Experiment) Extrapolate(inputArgs []string) ([]string, error)

Extrapolate extrapolates input arguments based on tags of the recommended baseline in the experiment.

func (*Experiment) GetActionSpec

func (e *Experiment) GetActionSpec(name string) ([]base.TaskSpec, error)

GetActionSpec gets a named action spec from an experiment. type ActionSpec []TaskSpec

func (*Experiment) GetRecommendedBaseline

func (e *Experiment) GetRecommendedBaseline() (string, error)

GetRecommendedBaseline from the experiment.

func (*Experiment) GetVersionDetail

func (e *Experiment) GetVersionDetail(versionName string) (*iter8.VersionDetail, error)

GetVersionDetail from the experiment for a named version.

type Spec

type Spec struct {
	iter8.ExperimentSpec
	Strategy Strategy `json:"strategy" yaml:"strategy"`
}

Spec is an enhancement of v2alpha1.ExperimentSpec struct that contains task list information.

type Strategy

type Strategy struct {
	iter8.Strategy
	Handlers *iter8.Handlers `json:"handlers,omitempty" yaml:"handlers,omitempty"`
	// Map of task lists.
	Actions ActionMap `json:"actions,omitempty" yaml:"actions,omitempty"`
}

Strategy is an enhancement of v2alpha1.Strategy struct that contains actions.

Jump to

Keyboard shortcuts

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