v1alpha1

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package v1alpha1 contains API Schema definitions for the apps.redskyops v1alpha1 API group +kubebuilder:object:generate=true +groupName=apps.redskyops.dev

Index

Constants

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

	// LabelScenario is the application scenario associated with an object.
	LabelScenario = "redskyops.dev/scenario"

	// LabelObjective is the application objective associated with an object.
	LabelObjective = "redskyops.dev/objective"

	// AnnotationLastScanned is the timestamp of the last application scan.
	AnnotationLastScanned = "apps.stormforge.io/last-scanned"
)
View Source
const (
	StormForgerAccessTokenSecretName = "stormforger-service-accounts"
)

Variables

View Source
var (
	// GroupVersion is group version used to register these objects
	GroupVersion = schema.GroupVersion{Group: "apps.redskyops.dev", 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 added in v1.11.0

func DefaultCostWeights(name string) corev1.ResourceList

DefaultCostWeights returns resource weightings for recognized special names.

func RegisterDefaults

func RegisterDefaults(s *runtime.Scheme) error

Register 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"`

	// Parameters specifies additional details about the experiment parameters.
	Parameters []Parameters `json:"parameters,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"`

	// StormForger allows you to configure StormForger to apply load on your application.
	StormForger *StormForger `json:"stormForger,omitempty"`

	// A count of the initial objectives, internally used to in name generation.
	InitialObjectiveCount int `json:"-"`
}

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()

func (*Application) HasDefaultObjectives

func (in *Application) HasDefaultObjectives() bool

HasDefaultObjectives checks to see if the current number of objectives matches what was present when the application was last defaulted.

type ContainerResources

type ContainerResources struct {
	// Label selector of Kubernetes objects to consider when generating container resources patches.
	Selector string `json:"selector,omitempty"`
	// The names of the resources to optimize. Defaults to ["memory", "cpu"].
	Resources []corev1.ResourceName `json:"resources,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.

type CustomScenario added in v1.11.0

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 added in v1.11.0

func (in *CustomScenario) DeepCopy() *CustomScenario

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

func (*CustomScenario) DeepCopyInto added in v1.11.0

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 added in v1.11.0

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 added in v1.11.0

func (in *DatadogGoal) DeepCopy() *DatadogGoal

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

func (*DatadogGoal) DeepCopyInto added in v1.11.0

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 added in v1.11.0

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 added in v1.11.0

func (in *DurationGoal) DeepCopy() *DurationGoal

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

func (*DurationGoal) DeepCopyInto added in v1.11.0

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 added in v1.11.0

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

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

type DurationType added in v1.9.3

type DurationType string

DurationType describes something which occurs over an arbitrary time interval.

const (
	DurationTrial DurationType = "trial"
)

type ErrorRateGoal added in v1.11.0

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 added in v1.11.0

func (in *ErrorRateGoal) DeepCopy() *ErrorRateGoal

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

func (*ErrorRateGoal) DeepCopyInto added in v1.11.0

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 added in v1.11.0

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

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

type ErrorRateType added in v1.9.3

type ErrorRateType string

ErrorRateType describes something which can fail.

const (
	ErrorRateRequests ErrorRateType = "requests"
)

type Goal added in v1.11.0

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:"-"`
}

Goal is an individual component of an objective.

func (*Goal) DeepCopy added in v1.11.0

func (in *Goal) DeepCopy() *Goal

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

func (*Goal) DeepCopyInto added in v1.11.0

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 added in v1.11.0

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 added in v1.11.0

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 added in v1.11.0

func (in *LatencyGoal) DeepCopy() *LatencyGoal

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

func (*LatencyGoal) DeepCopyInto added in v1.11.0

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 added in v1.11.0

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 Parameters

type Parameters 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"`
}

Parameters describes the strategy for tuning the application.

func (*Parameters) DeepCopy

func (in *Parameters) DeepCopy() *Parameters

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

func (*Parameters) DeepCopyInto

func (in *Parameters) DeepCopyInto(out *Parameters)

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

type PrometheusGoal added in v1.11.0

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 it 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 added in v1.11.0

func (in *PrometheusGoal) DeepCopy() *PrometheusGoal

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

func (*PrometheusGoal) DeepCopyInto added in v1.11.0

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 {
	// Label selector of Kubernetes objects to consider when generating replica patches.
	Selector string `json:"selector,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.

type RequestsGoal added in v1.11.0

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 added in v1.11.0

func (in *RequestsGoal) DeepCopy() *RequestsGoal

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

func (*RequestsGoal) DeepCopyInto added in v1.11.0

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"`
	// StormForger configuration for the scenario.
	StormForger *StormForgerScenario `json:"stormforger,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 StormForger

type StormForger struct {
	// The name of the StormForger organization.
	Organization string `json:"org,omitempty"`
	// Configuration for the StormForger service account.
	AccessToken *StormForgerAccessToken `json:"accessToken,omitempty"`
}

StormForger describes global configuration related to StormForger.

func (*StormForger) DeepCopy

func (in *StormForger) DeepCopy() *StormForger

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

func (*StormForger) DeepCopyInto

func (in *StormForger) DeepCopyInto(out *StormForger)

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

type StormForgerAccessToken

type StormForgerAccessToken struct {
	// The path to the file that contains the service account access token.
	File string `json:"file,omitempty"`
	// A literal token value, this should only be used for testing as it is not secure.
	Literal string `json:"literal,omitempty"`
	// Reference to an existing secret key that contains the access token.
	SecretKeyRef *corev1.SecretKeySelector `json:"secretKeyRef,omitempty"`
}

StormForgerAccessToken is used to configure a service account access token for the StormForger API.

func (*StormForgerAccessToken) DeepCopy

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

func (*StormForgerAccessToken) DeepCopyInto

func (in *StormForgerAccessToken) DeepCopyInto(out *StormForgerAccessToken)

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

type StormForgerScenario

type StormForgerScenario struct {
	// The test case can be used to specify an existing test case in the StormForger 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 StormForger API.
	TestCaseFile string `json:"testCaseFile,omitempty"`
}

StormForgerScenario is used to generate load using StormForger.

func (*StormForgerScenario) DeepCopy

func (in *StormForgerScenario) DeepCopy() *StormForgerScenario

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

func (*StormForgerScenario) DeepCopyInto

func (in *StormForgerScenario) DeepCopyInto(out *StormForgerScenario)

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