v1beta2

package
v2.0.2 Latest Latest
Warning

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

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

Documentation

Overview

Package v1beta2 contains API Schema definitions for the optimize.stormforge.io v1beta2 API group +kubebuilder:object:generate=true +groupName=optimize.stormforge.io

Index

Constants

View Source
const (
	// AnnotationExperimentURL is the URL of the experiment on the remote server
	AnnotationExperimentURL = "stormforge.io/experiment-url"
	// AnnotationNextTrialURL is the URL used to obtain the next trial suggestion
	AnnotationNextTrialURL = "stormforge.io/next-trial-url"
	// AnnotationReportTrialURL is the URL used to report trial observations
	AnnotationReportTrialURL = "stormforge.io/report-trial-url"
	// AnnotationServerSync controls additional behavior around synchronizing the experiment remotely
	AnnotationServerSync = "stormforge.io/server-sync"

	// LabelExperiment is the name of the experiment associated with an object
	LabelExperiment = "stormforge.io/experiment"
)
View Source
const (
	// AnnotationInitializer is a comma-delimited list of initializing processes. Similar to a "finalizer", the trial
	// will not start executing until the initializer is empty.
	AnnotationInitializer = "stormforge.io/initializer"

	// LabelTrial contains the name of the trial associated with an object
	LabelTrial = "stormforge.io/trial"
	// LabelTrialRole contains the role in trial execution
	LabelTrialRole = "stormforge.io/trial-role"
)

Variables

View Source
var (
	// GroupVersion is group version used to register these objects
	GroupVersion = schema.GroupVersion{Group: "optimize.stormforge.io", Version: "v1beta2"}

	// SchemeBuilder is used to add go types to the GroupVersionKind scheme
	SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

	// AddToScheme adds the types in this group-version to the given scheme.
	AddToScheme = SchemeBuilder.AddToScheme
)

Functions

This section is empty.

Types

type Assignment

type Assignment struct {
	// Name of the parameter being assigned
	Name string `json:"name"`
	// Value of the assignment
	Value intstr.IntOrString `json:"value"`
}

Assignment represents an individual name/value pair. Assignment names must correspond to parameter names on the associated experiment.

func (*Assignment) DeepCopy

func (in *Assignment) DeepCopy() *Assignment

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Assignment.

func (*Assignment) DeepCopyInto

func (in *Assignment) DeepCopyInto(out *Assignment)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ConfigMapHelmValuesFromSource

type ConfigMapHelmValuesFromSource struct {
	corev1.LocalObjectReference `json:",inline"`
}

ConfigMapHelmValuesFromSource is a reference to a ConfigMap that contains "*values.yaml" keys TODO How do document the side effect of things like patches in the ConfigMap also being applied?

func (*ConfigMapHelmValuesFromSource) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConfigMapHelmValuesFromSource.

func (*ConfigMapHelmValuesFromSource) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Constraint

type Constraint struct {
	// The optional name of the constraint
	Name string `json:"name,omitempty"`
	// The ordering constraint to impose
	Order *OrderConstraint `json:"order,omitempty"`
	// The sum constraint to impose
	Sum *SumConstraint `json:"sum,omitempty"`
}

Constraint represents a constraint to the domain of the parameters

func (*Constraint) DeepCopy

func (in *Constraint) DeepCopy() *Constraint

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Constraint.

func (*Constraint) DeepCopyInto

func (in *Constraint) DeepCopyInto(out *Constraint)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Experiment

type Experiment struct {
	metav1.TypeMeta `json:",inline"`
	// Standard object metadata
	metav1.ObjectMeta `json:"metadata,omitempty"`
	// Specification of the desired behavior for an experiment
	Spec ExperimentSpec `json:"spec,omitempty"`
	// Current status of an experiment
	Status ExperimentStatus `json:"status,omitempty"`
}

Experiment is the Schema for the experiments API +kubebuilder:resource:shortName=exp +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.phase",description="Experiment status"

func (*Experiment) DeepCopy

func (in *Experiment) DeepCopy() *Experiment

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Experiment.

func (*Experiment) DeepCopyInto

func (in *Experiment) DeepCopyInto(out *Experiment)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Experiment) DeepCopyObject

func (in *Experiment) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*Experiment) Replicas

func (in *Experiment) Replicas() int32

Replicas returns the effective replica (trial) count for the experiment

func (*Experiment) SetReplicas

func (in *Experiment) SetReplicas(r int)

SetReplicas establishes a new replica (trial) count for the experiment

func (*Experiment) TrialSelector

func (in *Experiment) TrialSelector() *metav1.LabelSelector

TrialSelector returns a label selector for matching trials associated with the experiment

type ExperimentCondition

type ExperimentCondition struct {
	// The condition type
	Type ExperimentConditionType `json:"type"`
	// The status of the condition, one of "True", "False", or "Unknown
	Status corev1.ConditionStatus `json:"status"`
	// The last known time the condition was checked
	LastProbeTime metav1.Time `json:"lastProbeTime"`
	// The time at which the condition last changed status
	LastTransitionTime metav1.Time `json:"lastTransitionTime"`
	// A reason code describing the why the condition occurred
	Reason string `json:"reason,omitempty"`
	// A human readable message describing the transition
	Message string `json:"message,omitempty"`
}

ExperimentCondition represents an observed condition of an experiment

func (*ExperimentCondition) DeepCopy

func (in *ExperimentCondition) DeepCopy() *ExperimentCondition

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExperimentCondition.

func (*ExperimentCondition) DeepCopyInto

func (in *ExperimentCondition) DeepCopyInto(out *ExperimentCondition)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ExperimentConditionType

type ExperimentConditionType string

ExperimentConditionType represents the possible observable conditions for an experiment

const (
	// ExperimentComplete is a condition that indicates the experiment completed successfully
	ExperimentComplete ExperimentConditionType = "stormforge.io/experiment-complete"
	// ExperimentFailed is a condition that indicates an experiment failed
	ExperimentFailed ExperimentConditionType = "stormforge.io/experiment-failed"
)

type ExperimentList

type ExperimentList struct {
	metav1.TypeMeta `json:",inline"`
	// Standard list metadata
	metav1.ListMeta `json:"metadata,omitempty"`
	// The list of experiments
	Items []Experiment `json:"items"`
}

ExperimentList contains a list of Experiment

func (*ExperimentList) DeepCopy

func (in *ExperimentList) DeepCopy() *ExperimentList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExperimentList.

func (*ExperimentList) DeepCopyInto

func (in *ExperimentList) DeepCopyInto(out *ExperimentList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ExperimentList) DeepCopyObject

func (in *ExperimentList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type ExperimentSpec

type ExperimentSpec struct {
	// Replicas is the number of trials to execute concurrently, defaults to 1
	Replicas *int32 `json:"replicas,omitempty"`
	// Optimization defines additional configuration for the optimization
	Optimization []Optimization `json:"optimization,omitempty"`
	// Parameters defines the search space for the experiment
	Parameters []Parameter `json:"parameters"`
	// Constraints defines restrictions on the parameter domain for the experiment
	Constraints []Constraint `json:"constraints,omitempty"`
	// Metrics defines the outcomes for the experiment
	Metrics []Metric `json:"metrics"`
	// Patches is a sequence of templates written against the experiment parameters that will be used to put the
	// cluster into the desired state
	Patches []PatchTemplate `json:"patches,omitempty"`
	// NamespaceSelector is used to locate existing namespaces for trials
	NamespaceSelector *metav1.LabelSelector `json:"namespaceSelector,omitempty"`
	// NamespaceTemplate can be specified to create new namespaces for trials; if specified created namespaces must be
	// matched by the namespace selector
	NamespaceTemplate *NamespaceTemplateSpec `json:"namespaceTemplate,omitempty"`
	// Selector locates trial resources that are part of this experiment
	Selector *metav1.LabelSelector `json:"selector,omitempty"`
	// TrialTemplate for creating a new trial. The resulting trial must be matched by Selector. The template can provide an
	// initial namespace, however other namespaces (matched by NamespaceSelector) will be used if the effective
	// replica count is more then one
	TrialTemplate TrialTemplateSpec `json:"trialTemplate,omitempty"`
}

ExperimentSpec defines the desired state of Experiment

func (*ExperimentSpec) DeepCopy

func (in *ExperimentSpec) DeepCopy() *ExperimentSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExperimentSpec.

func (*ExperimentSpec) DeepCopyInto

func (in *ExperimentSpec) DeepCopyInto(out *ExperimentSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ExperimentStatus

type ExperimentStatus struct {
	// Phase is a brief human readable description of the experiment status
	Phase string `json:"phase"`
	// ActiveTrials is the observed number of running trials
	ActiveTrials int32 `json:"activeTrials"`
	// Conditions is the current state of the experiment
	Conditions []ExperimentCondition `json:"conditions,omitempty"`
}

ExperimentStatus defines the observed state of Experiment

func (*ExperimentStatus) DeepCopy

func (in *ExperimentStatus) DeepCopy() *ExperimentStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExperimentStatus.

func (*ExperimentStatus) DeepCopyInto

func (in *ExperimentStatus) DeepCopyInto(out *ExperimentStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type HelmValue

type HelmValue struct {
	// The name of Helm value as passed to one of the set options
	Name string `json:"name"`
	// Force the value to be treated as a string
	ForceString bool `json:"forceString,omitempty"`
	// Set a Helm value using the evaluated template. Templates are evaluated using the same rules as patches
	Value intstr.IntOrString `json:"value,omitempty"`
	// Source for a Helm value
	ValueFrom *HelmValueSource `json:"valueFrom,omitempty"`
}

HelmValue represents a value in a Helm template

func (*HelmValue) DeepCopy

func (in *HelmValue) DeepCopy() *HelmValue

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmValue.

func (*HelmValue) DeepCopyInto

func (in *HelmValue) DeepCopyInto(out *HelmValue)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type HelmValueSource

type HelmValueSource struct {
	// Selects a trial parameter assignment as a Helm value
	ParameterRef *ParameterSelector `json:"parameterRef,omitempty"`
}

HelmValueSource represents a source for a Helm value

func (*HelmValueSource) DeepCopy

func (in *HelmValueSource) DeepCopy() *HelmValueSource

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmValueSource.

func (*HelmValueSource) DeepCopyInto

func (in *HelmValueSource) DeepCopyInto(out *HelmValueSource)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type HelmValuesFromSource

type HelmValuesFromSource struct {
	// The ConfigMap to select from
	ConfigMap *ConfigMapHelmValuesFromSource `json:"configMap,omitempty"`
}

HelmValuesFromSource represents a source of a values mapping

func (*HelmValuesFromSource) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelmValuesFromSource.

func (*HelmValuesFromSource) DeepCopyInto

func (in *HelmValuesFromSource) DeepCopyInto(out *HelmValuesFromSource)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Metric

type Metric struct {
	// The name of the metric
	Name string `json:"name"`
	// Indicator that the goal of the experiment is to minimize the value of this metric
	Minimize bool `json:"minimize,omitempty"`
	// The inclusive minimum allowed value for the metric
	Min *resource.Quantity `json:"min,omitempty"`
	// The inclusive maximum allowed value for the metric
	Max *resource.Quantity `json:"max,omitempty"`
	// Indicator that this metric should be optimized (default: true)
	Optimize *bool `json:"optimize,omitempty"`

	// The metric collection type, one of: kubernetes|prometheus|datadog|jsonpath, default: kubernetes
	Type MetricType `json:"type,omitempty"`
	// Collection type specific query, e.g. Go template for "kubernetes", PromQL for "prometheus" or a JSON pointer expression (with curly braces) for "jsonpath"
	Query string `json:"query"`
	// Collection type specific query for the error associated with collected metric value
	ErrorQuery string `json:"errorQuery,omitempty"`

	// URL to use when querying remote metric sources.
	URL string `json:"url,omitempty"`
	// Target reference of the Kubernetes object to query for metric information.
	Target *ResourceTarget `json:"target,omitempty"`
}

Metric represents an observable outcome from a trial run

func (*Metric) DeepCopy

func (in *Metric) DeepCopy() *Metric

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Metric.

func (*Metric) DeepCopyInto

func (in *Metric) DeepCopyInto(out *Metric)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type MetricType

type MetricType string

MetricType represents the allowable types of metrics

const (
	// MetricKubernetes metrics issue Kubernetes API requests using the target reference and selector (if no
	// reference is supplied, the trial itself is assumed). Queries are Go Templates evaluated against the
	// the result of the API call.
	MetricKubernetes MetricType = "kubernetes"
	// MetricPrometheus metrics issue PromQL queries to a matched service. Queries MUST evaluate to a scalar value.
	MetricPrometheus MetricType = "prometheus"
	// MetricDatadog metrics issue queries to the Datadog service. Requires API and application key configuration.
	MetricDatadog MetricType = "datadog"
	// MetricJSONPath metrics fetch a JSON resource from the matched service. Queries are JSON path expression evaluated against the resource.
	MetricJSONPath MetricType = "jsonpath"
	// MetricNewRelic metrics issue queries to the New Relic service. Requires API and application key configuration.
	MetricNewRelic MetricType = "newrelic"
)

type NamespaceTemplateSpec

type NamespaceTemplateSpec struct {
	// Standard object metadata
	metav1.ObjectMeta `json:"metadata,omitempty"`
	// Specification of the namespace
	Spec corev1.NamespaceSpec `json:"spec,omitempty"`
}

NamespaceTemplateSpec is used as a template for creating new namespaces

func (*NamespaceTemplateSpec) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamespaceTemplateSpec.

func (*NamespaceTemplateSpec) DeepCopyInto

func (in *NamespaceTemplateSpec) DeepCopyInto(out *NamespaceTemplateSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Optimization

type Optimization struct {
	// Name is the name of the optimization configuration to set
	Name string `json:"name"`
	// Value is string representation of the optimization configuration
	Value string `json:"value"`
}

Optimization is a configuration setting for the optimizer

func (*Optimization) DeepCopy

func (in *Optimization) DeepCopy() *Optimization

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Optimization.

func (*Optimization) DeepCopyInto

func (in *Optimization) DeepCopyInto(out *Optimization)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type OrderConstraint

type OrderConstraint struct {
	// LowerParameter is the name of the parameter that must be the smaller of two parameters
	LowerParameter string `json:"lowerParameter"`
	// UpperParameter is the name of the parameter that must be the larger of two parameters
	UpperParameter string `json:"upperParameter"`
}

OrderConstraint defines a constraint between the ordering of two parameters in the experiment

func (*OrderConstraint) DeepCopy

func (in *OrderConstraint) DeepCopy() *OrderConstraint

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OrderConstraint.

func (*OrderConstraint) DeepCopyInto

func (in *OrderConstraint) DeepCopyInto(out *OrderConstraint)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Parameter

type Parameter struct {
	// The name of the parameter
	Name string `json:"name"`
	// The baseline value for this parameter.
	Baseline *intstr.IntOrString `json:"baseline,omitempty"`
	// The inclusive minimum value of the parameter
	Min int32 `json:"min,omitempty"`
	// The inclusive maximum value of the parameter
	Max int32 `json:"max,omitempty"`
	// The discrete allowed values of the parameter
	Values []string `json:"values,omitempty"`
}

Parameter represents the domain of a single component of the experiment search space

func (*Parameter) DeepCopy

func (in *Parameter) DeepCopy() *Parameter

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Parameter.

func (*Parameter) DeepCopyInto

func (in *Parameter) DeepCopyInto(out *Parameter)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ParameterSelector

type ParameterSelector struct {
	// The name of the trial parameter to use
	Name string `json:"name"`
}

ParameterSelector selects a trial parameter assignment. Note that parameters values are used as is (i.e. in numeric form), for more control over the formatting of a parameter assignment use the template option on HelmValue.

func (*ParameterSelector) DeepCopy

func (in *ParameterSelector) DeepCopy() *ParameterSelector

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ParameterSelector.

func (*ParameterSelector) DeepCopyInto

func (in *ParameterSelector) DeepCopyInto(out *ParameterSelector)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type PatchOperation

type PatchOperation struct {
	// The reference to the object that the patched should be applied to
	TargetRef corev1.ObjectReference `json:"targetRef"`
	// The patch content type, must be a type supported by the Kubernetes API server
	PatchType types.PatchType `json:"patchType"`
	// The raw data representing the patch to be applied
	Data []byte `json:"data"`
	// The number of remaining attempts to apply the patch, will be automatically set
	// to zero if the patch is successfully applied
	AttemptsRemaining int `json:"attemptsRemaining,omitempty"`
}

PatchOperation represents a patch used to prepare the cluster for a trial run, includes the evaluated parameter assignments as necessary

func (*PatchOperation) DeepCopy

func (in *PatchOperation) DeepCopy() *PatchOperation

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PatchOperation.

func (*PatchOperation) DeepCopyInto

func (in *PatchOperation) DeepCopyInto(out *PatchOperation)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type PatchReadinessGate

type PatchReadinessGate struct {
	// ConditionType refers to a condition in the patched target's condition list
	ConditionType string `json:"conditionType"`
}

PatchReadinessGate contains a reference to a condition

func (*PatchReadinessGate) DeepCopy

func (in *PatchReadinessGate) DeepCopy() *PatchReadinessGate

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PatchReadinessGate.

func (*PatchReadinessGate) DeepCopyInto

func (in *PatchReadinessGate) DeepCopyInto(out *PatchReadinessGate)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type PatchTemplate

type PatchTemplate struct {
	// The patch type, one of: strategic|merge|json, default: strategic
	Type PatchType `json:"type,omitempty"`
	// Direct reference to the object the patch should be applied to
	TargetRef *corev1.ObjectReference `json:"targetRef,omitempty"`
	// A Go Template that evaluates to valid patch
	Patch string `json:"patch"`
	// ReadinessGates will be evaluated for patch target readiness. A patch target is ready if all conditions specified
	// in the readiness gates have a status equal to "True". If no readiness gates are specified, some target types may
	// have default gates assigned to them. Some condition checks may result in errors, e.g. a condition type of "Ready"
	// is not allowed for a ConfigMap. Condition types starting with "stormforge.io/" may not appear in the patched
	// target's condition list, but are still evaluated against the resource's state.
	ReadinessGates []PatchReadinessGate `json:"readinessGates,omitempty"`
}

PatchTemplate defines a target resource and a patch template to apply

func (*PatchTemplate) DeepCopy

func (in *PatchTemplate) DeepCopy() *PatchTemplate

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PatchTemplate.

func (*PatchTemplate) DeepCopyInto

func (in *PatchTemplate) DeepCopyInto(out *PatchTemplate)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type PatchType

type PatchType string

PatchType represents the allowable types of patches

const (
	// PatchStrategic is the patch type for a strategic merge patch
	PatchStrategic PatchType = "strategic"
	// PatchMerge is the patch type for a merge patch
	PatchMerge PatchType = "merge"
	// PatchJSON is the patch type for aJSON patch (RFC 6902)
	PatchJSON PatchType = "json"
)

type ReadinessCheck

type ReadinessCheck struct {
	// TargetRef is the reference to the object to test the readiness of
	TargetRef corev1.ObjectReference `json:"targetRef"`
	// Selector may be used to trigger a search for multiple related objects to search; this may have RBAC implications,
	// in particular "list" permissions are required
	Selector *metav1.LabelSelector `json:"selector,omitempty"`
	// ConditionTypes are the status conditions that must be "True"; in addition to conditions that appear in the
	// status of the target object, additional special conditions starting with "stormforge.io/" can be tested
	ConditionTypes []string `json:"conditionTypes,omitempty"`
	// InitialDelaySeconds is the approximate number of seconds after all of the patches have been applied to start
	// evaluating this check
	InitialDelaySeconds int32 `json:"initialDelaySeconds,omitempty"`
	// PeriodSeconds is the approximate amount of time in between evaluation attempts of this check
	PeriodSeconds int32 `json:"periodSeconds,omitempty"`
	// AttemptsRemaining is the number of failed attempts to allow before marking the entire trial as failed, will be
	// automatically set to zero if the check has been successfully evaluated
	AttemptsRemaining int32 `json:"attemptsRemaining,omitempty"`
	// LastCheckTime is the timestamp of the last evaluation attempt
	LastCheckTime *metav1.Time `json:"lastCheckTime,omitempty"`
}

ReadinessCheck represents a check to determine when the patched application is "ready" and it is safe to start the trial run job

func (*ReadinessCheck) DeepCopy

func (in *ReadinessCheck) DeepCopy() *ReadinessCheck

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReadinessCheck.

func (*ReadinessCheck) DeepCopyInto

func (in *ReadinessCheck) DeepCopyInto(out *ReadinessCheck)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ResourceTarget

type ResourceTarget struct {
	// API version of the referent.
	APIVersion string `json:"apiVersion,omitempty"`
	// Kind of the referent.
	Kind string `json:"kind,omitempty"`
	// Namespace of the referent.
	Namespace string `json:"namespace,omitempty"`

	// Name of the referent, if blank then the selector is used to match a list of resources.
	Name string `json:"name,omitempty"`
	// LabelSelector matches labels when the name is left unspecified.
	*metav1.LabelSelector `json:",inline"`
}

ResourceTarget contains enough information to reference either a single target resource by name, or a group of target resources by label.

func (*ResourceTarget) DeepCopy

func (in *ResourceTarget) DeepCopy() *ResourceTarget

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceTarget.

func (*ResourceTarget) DeepCopyInto

func (in *ResourceTarget) DeepCopyInto(out *ResourceTarget)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ResourceTarget) GroupVersionKind

func (r *ResourceTarget) GroupVersionKind() schema.GroupVersionKind

GroupVersionKind returns the GVK for the target reference.

func (*ResourceTarget) NamespacedName

func (r *ResourceTarget) NamespacedName() types.NamespacedName

NamespacedName returns the namespaced name for the target reference.

func (*ResourceTarget) SetGroupVersionKind

func (r *ResourceTarget) SetGroupVersionKind(gvk schema.GroupVersionKind)

SetGroupVersionKind overwrites the GVK for the target reference.

type SetupTask

type SetupTask struct {
	// The name that uniquely identifies the setup task
	Name string `json:"name"`
	// Override the default image used for performing setup tasks
	Image string `json:"image,omitempty"`
	// Override the default command for the container
	Command []string `json:"command,omitempty"`
	// Override the default args for the container
	Args []string `json:"args,omitempty"`
	// Flag to indicate the creation part of the task can be skipped
	SkipCreate bool `json:"skipCreate,omitempty"`
	// Flag to indicate the deletion part of the task can be skipped
	SkipDelete bool `json:"skipDelete,omitempty"`
	// Volume mounts for the setup task
	VolumeMounts []corev1.VolumeMount `json:"volumeMounts,omitempty"`
	// The Helm chart reference to release as part of this task
	HelmChart string `json:"helmChart,omitempty"`
	// The Helm chart version, empty means use the latest
	HelmChartVersion string `json:"helmChartVersion,omitempty"`
	// The Helm values to set, ignored unless helmChart is also set
	HelmValues []HelmValue `json:"helmValues,omitempty"`
	// The Helm values, ignored unless helmChart is also set
	HelmValuesFrom []HelmValuesFromSource `json:"helmValuesFrom,omitempty"`
	// The Helm repository to fetch the chart from
	HelmRepository string `json:"helmRepository,omitempty"`
}

SetupTask represents the configuration necessary to apply application state to the cluster prior to each trial run and remove that state after the run concludes

func (*SetupTask) DeepCopy

func (in *SetupTask) DeepCopy() *SetupTask

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SetupTask.

func (*SetupTask) DeepCopyInto

func (in *SetupTask) DeepCopyInto(out *SetupTask)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type SumConstraint

type SumConstraint struct {
	// Bound for the sum of the listed parameters
	Bound resource.Quantity `json:"bound"`
	// IsUpperBound determines if the bound values is an upper or lower bound on the sum
	IsUpperBound bool `json:"isUpperBound,omitempty"`
	// Parameters that should be summed
	Parameters []SumConstraintParameter `json:"parameters"`
}

SumConstraint defines a constraint between the sum of a collection of parameters

func (*SumConstraint) DeepCopy

func (in *SumConstraint) DeepCopy() *SumConstraint

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SumConstraint.

func (*SumConstraint) DeepCopyInto

func (in *SumConstraint) DeepCopyInto(out *SumConstraint)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type SumConstraintParameter

type SumConstraintParameter struct {
	// Name of the parameter
	Name string `json:"name"`
	// Weight of the parameter
	Weight resource.Quantity `json:"weight"`
}

SumConstraintParameter is a weighted parameter specification in a sum constraint

func (*SumConstraintParameter) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SumConstraintParameter.

func (*SumConstraintParameter) DeepCopyInto

func (in *SumConstraintParameter) DeepCopyInto(out *SumConstraintParameter)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Trial

type Trial struct {
	metav1.TypeMeta `json:",inline"`
	// Standard object metadata
	metav1.ObjectMeta `json:"metadata,omitempty"`
	// Specification of the desired behavior for a trial
	Spec TrialSpec `json:"spec,omitempty"`
	// Current status of a trial
	Status TrialStatus `json:"status,omitempty"`
}

Trial is the Schema for the trials API +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.phase",description="Trial status" +kubebuilder:printcolumn:name="Assignments",type="string",JSONPath=".status.assignments",description="Current assignments" +kubebuilder:printcolumn:name="Values",type="string",JSONPath=".status.values",description="Current values"

func (*Trial) DeepCopy

func (in *Trial) DeepCopy() *Trial

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Trial.

func (*Trial) DeepCopyInto

func (in *Trial) DeepCopyInto(out *Trial)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Trial) DeepCopyObject

func (in *Trial) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*Trial) ExperimentNamespacedName

func (in *Trial) ExperimentNamespacedName() types.NamespacedName

ExperimentNamespacedName returns the namespaced name of the experiment for this trial

func (*Trial) GetAssignment

func (in *Trial) GetAssignment(name string) (intstr.IntOrString, bool)

GetAssignment returns an assignment value by name

func (*Trial) GetJobSelector

func (in *Trial) GetJobSelector() *metav1.LabelSelector

GetJobSelector returns the job selector

func (*Trial) HasInitializer

func (in *Trial) HasInitializer() bool

HasInitializer checks to see if the trial has an initializer

type TrialCondition

type TrialCondition struct {
	// The condition type, e.g. "stormforge.io/trial-complete"
	Type TrialConditionType `json:"type"`
	// The status of the condition, one of "True", "False", or "Unknown
	Status corev1.ConditionStatus `json:"status"`
	// The last known time the condition was checked
	LastProbeTime metav1.Time `json:"lastProbeTime"`
	// The time at which the condition last changed status
	LastTransitionTime metav1.Time `json:"lastTransitionTime"`
	// A reason code describing the why the condition occurred
	Reason string `json:"reason,omitempty"`
	// A human readable message describing the transition
	Message string `json:"message,omitempty"`
}

TrialCondition represents an observed condition of a trial

func (*TrialCondition) DeepCopy

func (in *TrialCondition) DeepCopy() *TrialCondition

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrialCondition.

func (*TrialCondition) DeepCopyInto

func (in *TrialCondition) DeepCopyInto(out *TrialCondition)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type TrialConditionType

type TrialConditionType string

TrialConditionType represents the possible observable conditions for a trial

const (
	// TrialComplete is a condition that indicates a successful trial run
	TrialComplete TrialConditionType = "stormforge.io/trial-complete"
	// TrialFailed is a condition that indicates a failed trial run
	TrialFailed TrialConditionType = "stormforge.io/trial-failed"
	// TrialSetupCreated is a condition that indicates all "create" setup tasks have finished
	TrialSetupCreated TrialConditionType = "stormforge.io/trial-setup-created"
	// TrialSetupDeleted is a condition that indicates all "delete" setup tasks have finished
	TrialSetupDeleted TrialConditionType = "stormforge.io/trial-setup-deleted"
	// TrialPatched is a condition that indicates patches have been applied for a trial
	TrialPatched TrialConditionType = "stormforge.io/trial-patched"
	// TrialReady is a condition that indicates the application is ready after patches were applied
	TrialReady TrialConditionType = "stormforge.io/trial-ready"
	// TrialObserved is a condition that indicates a trial has had metrics collected
	TrialObserved TrialConditionType = "stormforge.io/trial-observed"
)

type TrialList

type TrialList struct {
	metav1.TypeMeta `json:",inline"`
	// Standard list metadata
	metav1.ListMeta `json:"metadata,omitempty"`
	// The list of trials
	Items []Trial `json:"items"`
}

TrialList contains a list of Trial

func (*TrialList) DeepCopy

func (in *TrialList) DeepCopy() *TrialList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrialList.

func (*TrialList) DeepCopyInto

func (in *TrialList) DeepCopyInto(out *TrialList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*TrialList) DeepCopyObject

func (in *TrialList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type TrialReadinessGate

type TrialReadinessGate struct {
	// Kind of the readiness target
	Kind string `json:"kind,omitempty"`
	// Name of the readiness target, mutually exclusive with "Selector"
	Name string `json:"name,omitempty"`
	// APIVersion of the readiness target
	APIVersion string `json:"apiVersion,omitempty"`
	// Selector matches the resources whose condition must be checked, mutually exclusive with "Name"
	Selector *metav1.LabelSelector `json:"selector,omitempty"`
	// ConditionTypes are the status conditions that must be "True"
	ConditionTypes []string `json:"conditionTypes,omitempty"`
	// InitialDelaySeconds is the approximate number of seconds after all of the patches have been applied to start
	// evaluating this check
	InitialDelaySeconds int32 `json:"initialDelaySeconds,omitempty"`
	// PeriodSeconds is the approximate amount of time in between evaluation attempts of this check;
	// defaults to 10 seconds, minimum value is 1 second
	PeriodSeconds int32 `json:"periodSeconds,omitempty"`
	// FailureThreshold is number of times that any of the specified ready conditions may be "False";
	// defaults to 3, minimum value is 1
	FailureThreshold int32 `json:"failureThreshold,omitempty"`
}

TrialReadinessGate represents a readiness check on one or more objects that must pass after patches have been applied, but before the trial run job can start

func (*TrialReadinessGate) DeepCopy

func (in *TrialReadinessGate) DeepCopy() *TrialReadinessGate

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrialReadinessGate.

func (*TrialReadinessGate) DeepCopyInto

func (in *TrialReadinessGate) DeepCopyInto(out *TrialReadinessGate)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type TrialSpec

type TrialSpec struct {
	// ExperimentRef is the reference to the experiment that contains the definitions to use for this trial,
	// defaults to an experiment in the same namespace with the same name
	ExperimentRef *corev1.ObjectReference `json:"experimentRef,omitempty"`
	// Assignments are used to patch the cluster state prior to the trial run
	Assignments []Assignment `json:"assignments,omitempty"`
	// Selector matches the job representing the trial run
	Selector *metav1.LabelSelector `json:"selector,omitempty"`
	// JobTemplate is the job template used to create trial run jobs
	JobTemplate *batchv1beta1.JobTemplateSpec `json:"jobTemplate,omitempty"`
	// InitialDelaySeconds is number of seconds to wait after a trial becomes ready before starting the trial run job
	InitialDelaySeconds int32 `json:"initialDelaySeconds,omitempty"`
	// The offset used to adjust the start time to account for spin up of the trial run
	StartTimeOffset *metav1.Duration `json:"startTimeOffset,omitempty"`
	// The approximate amount of time the trial run should execute (not inclusive of the start time offset)
	ApproximateRuntime *metav1.Duration `json:"approximateRuntime,omitempty"`
	// The minimum number of seconds before an attempt should be made to clean up the trial, if unset or negative no attempt is made to clean up the trial
	TTLSecondsAfterFinished *int32 `json:"ttlSecondsAfterFinished,omitempty"`
	// The minimum number of seconds before an attempt should be made to clean up a failed trial, defaults to TTLSecondsAfterFinished
	TTLSecondsAfterFailure *int32 `json:"ttlSecondsAfterFailure,omitempty"`
	// The readiness gates to check before running the trial job
	ReadinessGates []TrialReadinessGate `json:"readinessGates,omitempty"`

	// Values are the collected metrics at the end of the trial run
	Values []Value `json:"values,omitempty"`

	// Setup tasks that must run before the trial starts (and possibly after it ends)
	SetupTasks []SetupTask `json:"setupTasks,omitempty"`
	// Volumes to make available to setup tasks, typically ConfigMap backed volumes
	SetupVolumes []corev1.Volume `json:"setupVolumes,omitempty"`
	// Service account name for running setup tasks, needs enough permissions to add and remove software
	SetupServiceAccountName string `json:"setupServiceAccountName,omitempty"`
	// Cluster role name to be assigned to the setup service account when creating namespaces
	SetupDefaultClusterRole string `json:"setupDefaultClusterRole,omitempty"`
	// Policy rules to be assigned to the setup service account when creating namespaces
	SetupDefaultRules []rbacv1.PolicyRule `json:"setupDefaultRules,omitempty"`
}

TrialSpec defines the desired state of Trial

func (*TrialSpec) DeepCopy

func (in *TrialSpec) DeepCopy() *TrialSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrialSpec.

func (*TrialSpec) DeepCopyInto

func (in *TrialSpec) DeepCopyInto(out *TrialSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type TrialStatus

type TrialStatus struct {
	// Phase is a brief human readable description of the trial status
	Phase string `json:"phase"`
	// Assignments is a string representation of the trial assignments for reporting purposes
	Assignments string `json:"assignments"`
	// Values is a string representation of the trial values for reporting purposes
	Values string `json:"values"`
	// StartTime is the effective (possibly adjusted) time the trial run job started
	StartTime *metav1.Time `json:"startTime,omitempty"`
	// CompletionTime is the effective (possibly adjusted) time the trial run job completed
	CompletionTime *metav1.Time `json:"completionTime,omitempty"`
	// Conditions is the current state of the trial
	Conditions []TrialCondition `json:"conditions,omitempty"`
	// PatchOperations are the patches from the experiment evaluated in the context of this trial
	PatchOperations []PatchOperation `json:"patchOperations,omitempty"`
	// ReadinessChecks are the all of the objects whose conditions need to be inspected for this trial
	ReadinessChecks []ReadinessCheck `json:"readinessChecks,omitempty"`
}

TrialStatus defines the observed state of Trial

func (*TrialStatus) DeepCopy

func (in *TrialStatus) DeepCopy() *TrialStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrialStatus.

func (*TrialStatus) DeepCopyInto

func (in *TrialStatus) DeepCopyInto(out *TrialStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type TrialTemplateSpec

type TrialTemplateSpec struct {
	// Standard object metadata
	metav1.ObjectMeta `json:"metadata,omitempty"`
	// Specification of the desired behavior for the trial
	Spec TrialSpec `json:"spec,omitempty"`
}

TrialTemplateSpec is used as a template for creating new trials

func (*TrialTemplateSpec) DeepCopy

func (in *TrialTemplateSpec) DeepCopy() *TrialTemplateSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrialTemplateSpec.

func (*TrialTemplateSpec) DeepCopyInto

func (in *TrialTemplateSpec) DeepCopyInto(out *TrialTemplateSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Value

type Value struct {
	// The metric name the value corresponds to
	Name string `json:"name"`
	// The observed float64 value, formatted as a string
	Value string `json:"value"`
	// The observed float64 error (standard deviation), formatted as a string
	Error string `json:"error,omitempty"`
	// The number of remaining attempts to observer the value, will be automatically set
	// to zero if the metric is successfully collected
	AttemptsRemaining int `json:"attemptsRemaining,omitempty"`
}

Value represents an observed metric value after a trial run has completed successfully. Value names must correspond to metric names on the associated experiment.

func (*Value) DeepCopy

func (in *Value) DeepCopy() *Value

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Value.

func (*Value) DeepCopyInto

func (in *Value) DeepCopyInto(out *Value)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

Jump to

Keyboard shortcuts

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