Documentation
¶
Overview ¶
Package experiment enables construction of an experiment object with handler/task lists within it.
Index ¶
- Variables
- func GetClient() (rc client.Client, err error)
- func GetTypedObject(nn *client.ObjectKey, obj client.Object) error
- func Resource(resource string) schema.GroupResource
- func UpdateInClusterExperiment(e *Experiment) (err error)
- func UpdateVariable(v *v2alpha1.VersionDetail, name string, value string) error
- type ActionMap
- type Builder
- type Experiment
- type Spec
- type Strategy
Constants ¶
This section is empty.
Variables ¶
GetConfig variable is useful for test mocks.
var NumAttempt = 10
NumAttempt is the number of times to attempt Get operation for a k8s resource
var Period = 18 * time.Second
Period is the time duration between between each attempt
Functions ¶
func GetClient ¶
GetClient constructs and returns a K8s client. The returned client has experiment.Experiment type registered.
func GetTypedObject ¶
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 ¶
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 ¶
FromCluster fetches an experiment from k8s cluster.
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.