v1alpha1

package
v2.1.7 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

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

Index

Constants

View Source
const (
	// LabelApplication is the name of the application associated with an object.
	LabelApplication = "stormforge.io/application"

	// LabelScenario is the application scenario associated with an object.
	LabelScenario = "stormforge.io/scenario"

	// LabelObjective is the application objective associated with an object.
	LabelObjective = "stormforge.io/objective"

	// AnnotationLastScanned is the timestamp of the last application scan.
	AnnotationLastScanned = "apps.stormforge.io/last-scanned"
)

Variables

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

	// 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

func DefaultCostWeights

func DefaultCostWeights(name string) corev1.ResourceList

DefaultCostWeights returns resource weightings for recognized special names.

func RegisterDefaults

func RegisterDefaults(s *runtime.Scheme) error

RegisterDefaults registers the defaulting function for the application root object.

Types

type Application

type Application struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	// Resources are references to application resources to consider in the generation of the experiment.
	// These strings are the same format as used by Kustomize.
	Resources konjure.Resources `json:"resources,omitempty"`

	// Configuration specifies additional details about the experiment parameters.
	Configuration []Parameter `json:"configuration,omitempty"`

	// Ingress specifies how to find the entry point to the application.
	Ingress *Ingress `json:"ingress,omitempty"`

	// The list of scenarios to optimize the application for.
	Scenarios []Scenario `json:"scenarios,omitempty"`

	// The list of objectives to optimize the application for.
	Objectives []Objective `json:"objectives,omitempty"`
}

Application represents a description of an application to run experiments on. +kubebuilder:object:root=true

func (*Application) DeepCopy

func (in *Application) DeepCopy() *Application

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

func (*Application) DeepCopyInto

func (in *Application) DeepCopyInto(out *Application)

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

func (*Application) DeepCopyObject

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

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

func (*Application) Default

func (in *Application) Default()

type ContainerResources

type ContainerResources struct {
	filters.ResourceMetaFilter
	// Label selector of Kubernetes objects to consider when generating container resources patches.
	// Deprecated: use ResourceMetaFilter.LabelSelector instead.
	Selector string `json:"selector,omitempty"`
	// Regular expression matching the container name.
	ContainerName string `json:"containerName,omitempty"`
	// Path to the resource requirements.
	Path string `json:"path,omitempty"`
	// The names of the resources to optimize. Defaults to ["memory", "cpu"].
	Resources []corev1.ResourceName `json:"resources,omitempty"`
	// Create container resource requirements even if the original object does not contain them.
	CreateIfNotPresent bool `json:"create,omitempty"`
	// Per-namespace limit ranges for containers.
	ContainerLimitRange map[string]corev1.LimitRangeItem `json:"containerLimitRange,omitempty"`
}

ContainerResources specifies which resources in the application should have their container resources (CPU and memory) optimized.

func (*ContainerResources) DeepCopy

func (in *ContainerResources) DeepCopy() *ContainerResources

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

func (*ContainerResources) DeepCopyInto

func (in *ContainerResources) DeepCopyInto(out *ContainerResources)

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

func (*ContainerResources) Default added in v2.0.9

func (in *ContainerResources) Default()

type CustomScenario

type CustomScenario struct {
	// Enables Prometheus Push Gateway support for objectives that require it.
	// The `PUSHGATEWAY_URL` environment variable will be added to all
	// containers when the trial job starts.
	UsePushGateway bool `json:"pushGateway,omitempty"`
	// The default specification of a pod to use for executing a trial.
	PodTemplate *corev1.PodTemplateSpec `json:"podTemplate,omitempty"`
	// Additional delay before starting the trial pod.
	InitialDelaySeconds int32 `json:"initialDelaySeconds,omitempty"`
	// The estimated amount of time the trial should last.
	ApproximateRuntimeSeconds int32 `json:"approximateRuntimeSeconds,omitempty"`
	// Override the image of the first container in the trial pod.
	Image string `json:"image,omitempty"`
}

CustomScenario is used for advanced cases where more flexibility is required.

func (*CustomScenario) DeepCopy

func (in *CustomScenario) DeepCopy() *CustomScenario

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

func (*CustomScenario) DeepCopyInto

func (in *CustomScenario) DeepCopyInto(out *CustomScenario)

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

type DatadogGoal

type DatadogGoal struct {
	// The [Datadog](https://docs.datadoghq.com/tracing/trace_search_and_analytics/query_syntax/) query to execute.
	Query string `json:"query"`
	// The aggregator to use on the query results (one of: avg, last, max, min, sum).
	Aggregator string `json:"aggregator,omitempty"`
	// Flag indicating the goal of optimization should be to maximize a metric.
	Maximize bool `json:"maximize,omitempty"`
}

DatadogGoal is used to define an external optimization metric from DataDog.

func (*DatadogGoal) DeepCopy

func (in *DatadogGoal) DeepCopy() *DatadogGoal

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

func (*DatadogGoal) DeepCopyInto

func (in *DatadogGoal) DeepCopyInto(out *DatadogGoal)

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

type DurationGoal

type DurationGoal struct {
	// The duration to optimize. Can be one of the following values: `trial`.
	DurationType
}

DurationGoal is used to optimize the amount of time elapsed in a specific scenario.

func (*DurationGoal) DeepCopy

func (in *DurationGoal) DeepCopy() *DurationGoal

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

func (*DurationGoal) DeepCopyInto

func (in *DurationGoal) DeepCopyInto(out *DurationGoal)

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

func (*DurationGoal) UnmarshalJSON

func (in *DurationGoal) UnmarshalJSON(data []byte) error

UnmarshalJSON allows a timing objective to be specified as a simple string.

type DurationType

type DurationType string

DurationType describes something which occurs over an arbitrary time interval.

const (
	DurationTrial DurationType = "trial"
)

type EnvironmentVariable

type EnvironmentVariable struct {
	filters.ResourceMetaFilter
	// The name of the environment variable to optimize.
	VariableName string `json:"variableName,omitempty"`
	// Regular expression matching the container name.
	ContainerName string `json:"containerName,omitempty"`
	// Path to the environment variable's value.
	Path string `json:"path,omitempty"`
	// The prefix of the value to use when setting the environment variable.
	ValuePrefix string `json:"prefix,omitempty"`
	// The suffix of the value to use when setting the environment variable.
	ValueSuffix string `json:"suffix,omitempty"`
	// The discrete values of the environment variable.
	Values []string `json:"values,omitempty"`
}

EnvironmentVariable specifies which environment variables in the application should have their value optimized.

func (*EnvironmentVariable) DeepCopy

func (in *EnvironmentVariable) DeepCopy() *EnvironmentVariable

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

func (*EnvironmentVariable) DeepCopyInto

func (in *EnvironmentVariable) DeepCopyInto(out *EnvironmentVariable)

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

func (*EnvironmentVariable) Default added in v2.0.9

func (in *EnvironmentVariable) Default()

type ErrorRateGoal

type ErrorRateGoal struct {
	// The error rate to optimize. Can be one of the following values: `requests`.
	ErrorRateType
}

ErrorRateGoal is used to optimize the error rate of an application in a specific scenario.

func (*ErrorRateGoal) DeepCopy

func (in *ErrorRateGoal) DeepCopy() *ErrorRateGoal

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

func (*ErrorRateGoal) DeepCopyInto

func (in *ErrorRateGoal) DeepCopyInto(out *ErrorRateGoal)

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

func (*ErrorRateGoal) UnmarshalJSON

func (in *ErrorRateGoal) UnmarshalJSON(data []byte) error

UnmarshalJSON allows an error rate objective to be specified as a simple string.

type ErrorRateType

type ErrorRateType string

ErrorRateType describes something which can fail.

const (
	ErrorRateRequests ErrorRateType = "requests"
)

type Goal

type Goal struct {
	// The name of the goal. If no specific configuration is supplied, the name is
	// used to derive a configuration. For example, any valid latency (prefixed or
	// suffixed with "latency") will configure a default latency goal.
	Name string `json:"name,omitempty"`
	// The upper bound for the objective.
	Max *resource.Quantity `json:"max,omitempty"`
	// The lower bound for the objective.
	Min *resource.Quantity `json:"min,omitempty"`
	// Flag indicating that this objective should optimized instead of monitored (default: true).
	Optimize *bool `json:"optimize,omitempty"`

	// Requests is used to optimize the resources consumed by an application.
	Requests *RequestsGoal `json:"requests,omitempty"`
	// Latency is used to optimize the responsiveness of an application.
	Latency *LatencyGoal `json:"latency,omitempty"`
	// ErrorRate is used to optimize the failure rate of an application.
	ErrorRate *ErrorRateGoal `json:"errorRate,omitempty"`
	// Duration is used to optimize the elapsed time of an application performing a fixed amount of work.
	Duration *DurationGoal `json:"duration,omitempty"`
	// Prometheus is used to optimize against a Prometheus metric.
	Prometheus *PrometheusGoal `json:"prometheus,omitempty"`
	// Datadog is used to optimize against a Datadog metric.
	Datadog *DatadogGoal `json:"datadog,omitempty"`

	// Internal use field for marking objectives as having been implemented. For example,
	// it may be impossible to optimize for some objectives based on the current state.
	Implemented bool `json:"-"`
	// Internal use field for marking objectives as optional (i.e. do not fail
	// experiment generation if an ignorable goal is not implemented).
	Ignorable bool `json:"-"`
}

Goal is an individual component of an objective.

func (*Goal) DeepCopy

func (in *Goal) DeepCopy() *Goal

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

func (*Goal) DeepCopyInto

func (in *Goal) DeepCopyInto(out *Goal)

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

func (*Goal) Default

func (in *Goal) Default()

type Ingress

type Ingress struct {
	// The URL used to access the application from outside the cluster.
	URL string `json:"url,omitempty"`
}

Ingress describes the point of ingress to the application.

func (*Ingress) DeepCopy

func (in *Ingress) DeepCopy() *Ingress

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

func (*Ingress) DeepCopyInto

func (in *Ingress) DeepCopyInto(out *Ingress)

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

type LatencyGoal

type LatencyGoal struct {
	// The latency to optimize. Can be one of the following values:
	// `minimum` (or `min`), `maximum` (or `max`), `mean` (or `average`, `avg`),
	// `percentile_50` (or `p50`, `median`, `med`), `percentile_95` (or `p95`),
	// `percentile_99` (or `p99`).
	LatencyType
}

LatencyGoal is used to optimize the responsiveness of an application in a specific scenario.

func (*LatencyGoal) DeepCopy

func (in *LatencyGoal) DeepCopy() *LatencyGoal

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

func (*LatencyGoal) DeepCopyInto

func (in *LatencyGoal) DeepCopyInto(out *LatencyGoal)

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

func (*LatencyGoal) UnmarshalJSON

func (in *LatencyGoal) UnmarshalJSON(data []byte) error

UnmarshalJSON allows a latency objective to be specified as a simple string.

type LatencyType

type LatencyType string

LatencyType describes a measure of latency.

const (
	LatencyMinimum      LatencyType = "minimum"
	LatencyMaximum      LatencyType = "maximum"
	LatencyMean         LatencyType = "mean"
	LatencyPercentile50 LatencyType = "percentile_50"
	LatencyPercentile95 LatencyType = "percentile_95"
	LatencyPercentile99 LatencyType = "percentile_99"
)

func FixLatency

func FixLatency(in LatencyType) LatencyType

FixLatency returns a constant value from a user entered value.

type LocustScenario

type LocustScenario struct {
	// Path to a Python module file to import.
	Locustfile string `json:"locustfile,omitempty"`
	// Number of concurrent Locust users.
	Users *int `json:"users,omitempty"`
	// The rate per second in which users are spawned.
	SpawnRate *int `json:"spawnRate,omitempty"`
	// Stop after the specified amount of time.
	RunTime *metav1.Duration `json:"runTime,omitempty"`
}

LocustScenario is used to generate load using Locust.

func (*LocustScenario) DeepCopy

func (in *LocustScenario) DeepCopy() *LocustScenario

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

func (*LocustScenario) DeepCopyInto

func (in *LocustScenario) DeepCopyInto(out *LocustScenario)

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

type Objective

type Objective struct {
	// The name of the objective. If omitted, a default name will be generated
	// based on the goals.
	Name string `json:"name,omitempty"`
	// The list of goals for the objective.
	Goals []Goal `json:"goals,omitempty"`
}

Objective describes the goals of the optimization in terms of specific metrics.

func (*Objective) DeepCopy

func (in *Objective) DeepCopy() *Objective

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

func (*Objective) DeepCopyInto

func (in *Objective) DeepCopyInto(out *Objective)

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

func (*Objective) Default

func (in *Objective) Default()

type Parameter

type Parameter struct {
	// Information related to the discovery of container resources parameters like CPU and memory.
	ContainerResources *ContainerResources `json:"containerResources,omitempty"`
	// Information related to the discovery of replica parameters.
	Replicas *Replicas `json:"replicas,omitempty"`
	// Information related to the discovery of environment variables.
	EnvironmentVariable *EnvironmentVariable `json:"environmentVariable,omitempty"`
}

Parameter describes the strategy for tuning the application.

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.

func (*Parameter) Default added in v2.0.9

func (in *Parameter) Default()

type PrometheusGoal

type PrometheusGoal struct {
	// The PromQL query to execute; the result of this query MUST be a scalar value.
	Query string `json:"query"`
	// The URL of the Prometheus deployment, leave blank to leverage a Prometheus instance
	// whose lifecycle is tied to the trial.
	URL string `json:"url,omitempty"`
	// Flag indicating the goal of optimization should be to maximize a metric.
	Maximize bool `json:"maximize,omitempty"`
}

PrometheusGoal is used to define an external optimization metric from Prometheus.

func (*PrometheusGoal) DeepCopy

func (in *PrometheusGoal) DeepCopy() *PrometheusGoal

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

func (*PrometheusGoal) DeepCopyInto

func (in *PrometheusGoal) DeepCopyInto(out *PrometheusGoal)

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

type Replicas

type Replicas struct {
	filters.ResourceMetaFilter
	// Label selector of Kubernetes objects to consider when generating replica patches.
	// Deprecated: use ResourceMetaFilter.LabelSelector instead.
	Selector string `json:"selector,omitempty"`
	// 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"`
}

Replicas specifies which resources in the application should have their replica count optimized.

func (*Replicas) DeepCopy

func (in *Replicas) DeepCopy() *Replicas

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

func (*Replicas) DeepCopyInto

func (in *Replicas) DeepCopyInto(out *Replicas)

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

func (*Replicas) Default added in v2.0.9

func (in *Replicas) Default()

type RequestsGoal

type RequestsGoal struct {
	// Label selector of the pods which should be considered when collecting cost information.
	Selector string `json:"selector,omitempty"`
	// Weights are used to determine which container resources should be optimized.
	Weights corev1.ResourceList `json:"weights,omitempty"`
}

RequestsGoal is used to optimize the resource requests of an application in a specific scenario.

func (*RequestsGoal) DeepCopy

func (in *RequestsGoal) DeepCopy() *RequestsGoal

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

func (*RequestsGoal) DeepCopyInto

func (in *RequestsGoal) DeepCopyInto(out *RequestsGoal)

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

type Scenario

type Scenario struct {
	// The name of scenario.
	Name string `json:"name,omitempty"`
	// StormForge Performance configuration for the scenario.
	StormForge *StormForgeScenario `json:"stormforgePerf,omitempty"`
	// Locust configuration for the scenario.
	Locust *LocustScenario `json:"locust,omitempty"`
	// Custom configuration for the scenario.
	Custom *CustomScenario `json:"custom,omitempty"`
}

Scenario describes a specific pattern of load to optimize the application for.

func (*Scenario) DeepCopy

func (in *Scenario) DeepCopy() *Scenario

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

func (*Scenario) DeepCopyInto

func (in *Scenario) DeepCopyInto(out *Scenario)

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

func (*Scenario) Default

func (in *Scenario) Default()

type StormForgeScenario

type StormForgeScenario struct {
	// The test case can be used to specify an existing test case in the StormForge Performance API or
	// it can be used to override the generated test case name when specified in conjunction
	// with the local test case file. The organization is optional if it is configured globally.
	TestCase string `json:"testCase,omitempty"`
	// Path to a local test case file used to define a new test case in the StormForge Performance API.
	TestCaseFile string `json:"testCaseFile,omitempty"`
}

StormForgeScenario is used to generate load using StormForge Performance testing.

func (*StormForgeScenario) DeepCopy

func (in *StormForgeScenario) DeepCopy() *StormForgeScenario

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

func (*StormForgeScenario) DeepCopyInto

func (in *StormForgeScenario) DeepCopyInto(out *StormForgeScenario)

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