v1

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package v1 contains API Schema definitions for the wing v1 API group +kubebuilder:object:generate=true +groupName=wing.xscaling.dev

Index

Constants

View Source
const (
	// Information only and will not cause any problems
	EventTypeNormal string = "Normal"
	// These events are to warn that something might go wrong
	EventTypeWarning string = "Warning"
)
View Source
const (
	EventReasonScaling   = "Scaling"
	EventReasonPanicMode = "PanicMode"
)
View Source
const (
	// DefaultMinReplicas is the default maximum number of replicas if not provided
	DefaultMinReplicas int32 = 1
)
View Source
const (
	// DryRunAnnotation is used to indicate whether the scaling action should be performed.
	// If it's set to true, the scaling action will be performed.
	// If it's set to false or not set, the scaling action will be skipped.
	// Will be performed by default in next release.
	DryRunAnnotation = "wing.xscaling.dev/dry-run"
)
View Source
const (
	ReplicaPatchesAnnotation = "wing.xscaling.dev/replica-patches"
)

Variables

View Source
var (
	// GroupVersion is group version used to register these objects
	GroupVersion = schema.GroupVersion{Group: "wing.xscaling.dev", Version: "v1"}

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

func InitializeConditions(c *Conditions)

InitializeConditions to the default -> Status: Unknown

Types

type Condition

type Condition struct {
	// Type of condition
	// +required
	Type ConditionType `json:"type" description:"type of status condition"`

	// Status of the condition, one of True, False, Unknown.
	// +required
	Status metav1.ConditionStatus `json:"status" description:"status of the condition, one of True, False, Unknown"`

	// The reason for the condition's last transition.
	// +optional
	Reason string `json:"reason,omitempty" description:"one-word CamelCase reason for the condition's last transition"`

	// A human readable message indicating details about the transition.
	// +optional
	Message string `json:"message,omitempty" description:"human-readable message indicating details about last transition"`

	// Last time the condition transitioned from one status to another.
	// +required
	LastTransitionTime metav1.Time `json:"lastTransitionTime" description:"last time the condition transitioned from one status to another"`
}

func GetCondition

func GetCondition(conditions Conditions, conditionType ConditionType) Condition

func (*Condition) DeepCopy

func (in *Condition) DeepCopy() *Condition

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

func (*Condition) DeepCopyInto

func (in *Condition) DeepCopyInto(out *Condition)

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

type ConditionType

type ConditionType string
const (
	ConditionReplicaPatched ConditionType = "ReplicaPatched"
	ConditionScaleLimited   ConditionType = "ScaleLimited"
	ConditionReady          ConditionType = "Ready"
	ConditionPanicMode      ConditionType = "PanicMode"
	ConditionExhausted      ConditionType = "Exhausted"
)

type Conditions

type Conditions []Condition

func DeleteCondition

func DeleteCondition(conditions Conditions, conditionType ConditionType) Conditions

func SetCondition

func SetCondition(conditions Conditions, condition Condition) Conditions

func (Conditions) DeepCopy

func (in Conditions) DeepCopy() Conditions

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

func (Conditions) DeepCopyInto

func (in Conditions) DeepCopyInto(out *Conditions)

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

type CrossVersionObjectReference

type CrossVersionObjectReference struct {
	// Kind of the referent; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds"
	Kind string `json:"kind"`
	// Name of the referent; More info: http://kubernetes.io/docs/user-guide/identifiers#names
	Name string `json:"name"`
	// API version of the referent
	// +optional
	APIVersion string `json:"apiVersion,omitempty"`
}

CrossVersionObjectReference contains enough information to let you identify the referred resource.

func (*CrossVersionObjectReference) DeepCopy

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

func (*CrossVersionObjectReference) DeepCopyInto

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

type Exhaust added in v0.0.2

type Exhaust struct {
	// Type of exhaust mode, only `Pending` is currently supported.
	Type ExhaustType `json:"type,omitempty" yaml:"type,omitempty"`

	// Pending is the details for exhaust check config.
	// If oldest pending pod life is not shorter than timeout,
	// and percentage or number of pending pod(s) is not smaller than threshold,
	// then the exhaust mode will be triggered.
	Pending *ExhaustPending `json:"pending,omitempty" yaml:"pending,omitempty"`
}

Exhaust is the settings for exhaust checking

func (*Exhaust) DeepCopy added in v0.0.2

func (in *Exhaust) DeepCopy() *Exhaust

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

func (*Exhaust) DeepCopyInto added in v0.0.2

func (in *Exhaust) DeepCopyInto(out *Exhaust)

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

type ExhaustPending added in v0.0.2

type ExhaustPending struct {
	Threshold      intstr.IntOrString `json:"threshold" yaml:"threshold"`
	TimeoutSeconds int32              `json:"timeoutSeconds" yaml:"timeoutSeconds"`
}

func (*ExhaustPending) DeepCopy added in v0.0.2

func (in *ExhaustPending) DeepCopy() *ExhaustPending

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

func (*ExhaustPending) DeepCopyInto added in v0.0.2

func (in *ExhaustPending) DeepCopyInto(out *ExhaustPending)

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

type ExhaustType added in v0.0.2

type ExhaustType string
const (
	ExhaustOnPending ExhaustType = "Pending"
)

type GroupVersionKindResource

type GroupVersionKindResource struct {
	Group    string `json:"group"`
	Version  string `json:"version"`
	Kind     string `json:"kind"`
	Resource string `json:"resource"`
}

GroupVersionKindResource provides unified structure for schema.GroupVersionKind and Resource

func (*GroupVersionKindResource) DeepCopy

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

func (*GroupVersionKindResource) DeepCopyInto

func (in *GroupVersionKindResource) DeepCopyInto(out *GroupVersionKindResource)

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

func (GroupVersionKindResource) GVKString

func (gvkr GroupVersionKindResource) GVKString() string

GVKString returns the group, version and kind in string format

func (GroupVersionKindResource) GroupResource

func (gvkr GroupVersionKindResource) GroupResource() schema.GroupResource

GroupResource returns the group and resource of GroupVersionKindResource

func (GroupVersionKindResource) GroupVersion

func (gvkr GroupVersionKindResource) GroupVersion() schema.GroupVersion

GroupVersion returns the group and version of GroupVersionKindResource

func (GroupVersionKindResource) GroupVersionKind

func (gvkr GroupVersionKindResource) GroupVersionKind() schema.GroupVersionKind

GroupVersionKind returns the group, version and kind of GroupVersionKindResource

type MetricTarget

type MetricTarget struct {
	// type represents whether the metric type is Utilization, Value, or AverageValue
	Type MetricTargetType `json:"type"`
	// value is the target value of the metric (as a quantity).
	// +optional
	Value *resource.Quantity `json:"value,omitempty"`
	// averageValue is the target value of the average of the
	// metric across all relevant pods (as a quantity)
	// +optional
	AverageValue *resource.Quantity `json:"averageValue,omitempty"`
	// averageUtilization is the target value of the average of the
	// resource metric across all relevant pods, represented as a percentage of
	// the requested value of the resource for the pods.
	// Currently only valid for Resource metric source type
	// +optional
	AverageUtilization *int32 `json:"averageUtilization,omitempty"`
}

MetricTarget defines the target value, average value, or average utilization of a specific metric

func (*MetricTarget) DeepCopy

func (in *MetricTarget) DeepCopy() *MetricTarget

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

func (*MetricTarget) DeepCopyInto

func (in *MetricTarget) DeepCopyInto(out *MetricTarget)

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

type MetricTargetType

type MetricTargetType string

MetricTargetType specifies the type of metric being targeted, and should be either "Value", "AverageValue", or "Utilization"

const (
	// UtilizationMetricType declares a MetricTarget is an AverageUtilization value
	UtilizationMetricType MetricTargetType = "Utilization"
	// ValueMetricType declares a MetricTarget is a raw value
	ValueMetricType MetricTargetType = "Value"
	// AverageValueMetricType declares a MetricTarget is an
	AverageValueMetricType MetricTargetType = "AverageValue"
)

type ReplicaAutoscaler

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

	Spec   ReplicaAutoscalerSpec   `json:"spec,omitempty"`
	Status ReplicaAutoscalerStatus `json:"status,omitempty"`
}

ReplicaAutoscaler is the Schema for the replicaautoscalers API

func (*ReplicaAutoscaler) DeepCopy

func (in *ReplicaAutoscaler) DeepCopy() *ReplicaAutoscaler

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

func (*ReplicaAutoscaler) DeepCopyInto

func (in *ReplicaAutoscaler) DeepCopyInto(out *ReplicaAutoscaler)

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

func (*ReplicaAutoscaler) DeepCopyObject

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

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

type ReplicaAutoscalerList

type ReplicaAutoscalerList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []ReplicaAutoscaler `json:"items"`
}

ReplicaAutoscalerList contains a list of ReplicaAutoscaler

func (*ReplicaAutoscalerList) DeepCopy

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

func (*ReplicaAutoscalerList) DeepCopyInto

func (in *ReplicaAutoscalerList) DeepCopyInto(out *ReplicaAutoscalerList)

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

func (*ReplicaAutoscalerList) DeepCopyObject

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

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

type ReplicaAutoscalerSpec

type ReplicaAutoscalerSpec struct {
	// Replicator specified which replicator used for aggregating scalers output and
	// make final scaling decision
	// +optional
	Replicator *string `json:"replicator,omitempty"`

	// ReplicatorSettings is the configuration of replicator
	// +kubebuilder:pruning:PreserveUnknownFields
	// +optional
	ReplicatorSettings *runtime.RawExtension `json:"replicatorSettings,omitempty"`

	// ScaleTargetRef points to the target resource to scale, and is used to the pods for which metrics
	// should be collected, as well as to actually change the replica count.
	ScaleTargetRef CrossVersionObjectReference `json:"scaleTargetRef"`
	// minReplicas is the lower limit for the number of replicas to which the autoscaler can scale down.
	// If `minReplicas` is nil then the replicas will be set as `maxReplicas` without autoscaling.
	// +optional
	MinReplicas *int32 `json:"minReplicas,omitempty"`
	// maxReplicas is the upper limit for the number of replicas to which the autoscaler can scale up.
	// It cannot be less that minReplicas(if it has been set).
	MaxReplicas int32 `json:"maxReplicas"`

	// Targets contain various scaling metrics and thresholds used for calculating the final desired replicas.
	// +kubebuilder:validation:Optional
	// +optional
	Targets []ReplicaAutoscalerTarget `json:"targets,omitempty"`

	// Strategy decides how to make scaling decision
	// +kubebuilder:validation:Optional
	// +optional
	Strategy *ReplicaAutoscalerStrategy `json:"strategy,omitempty"`

	// +optional
	Exhaust *Exhaust `json:"exhaust,omitempty" yaml:"exhaust,omitempty"`
}

ReplicaAutoscalerSpec defines the desired state of ReplicaAutoscaler

func (*ReplicaAutoscalerSpec) DeepCopy

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

func (*ReplicaAutoscalerSpec) DeepCopyInto

func (in *ReplicaAutoscalerSpec) DeepCopyInto(out *ReplicaAutoscalerSpec)

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

type ReplicaAutoscalerStatus

type ReplicaAutoscalerStatus struct {
	// observedGeneration is the most recent generation observed by this autoscaler.
	// +optional
	ObservedGeneration *int64 `json:"observedGeneration,omitempty"`

	// lastScaleTime is the last time the ReplicaAutoscaler scaled,
	// used by the autoscaler to control how often the replicas is changed.
	// +optional
	LastScaleTime *metav1.Time `json:"lastScaleTime,omitempty"`

	// currentReplicas is current replicas of object managed by this autoscaler,
	// as last seen by the autoscaler.
	// +optional
	CurrentReplicas int32 `json:"currentReplicas,omitempty"`

	// desiredReplicas is the desired replicas of object managed by this autoscaler,
	// as last calculated by the autoscaler.
	// +kubebuilder:default=0
	DesiredReplicas int32 `json:"desiredReplicas"`

	// targets indicates state of targets used by this autoscaler
	// +listType=atomic
	// +patchMergeKey=target
	// +patchStrategy=replace
	// +optional
	Targets []TargetStatus `json:"targets,omitempty" patchStrategy:"replace" patchMergeKey:"target"`

	// conditions is the set of conditions required for this autoscaler to scale its target,
	// and indicates whether or not those conditions are met.
	// +patchMergeKey=type
	// +patchStrategy=merge
	// +optional
	Conditions Conditions `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" listType:"map"`
}

ReplicaAutoscalerStatus defines the observed state of ReplicaAutoscaler

func (*ReplicaAutoscalerStatus) DeepCopy

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

func (*ReplicaAutoscalerStatus) DeepCopyInto

func (in *ReplicaAutoscalerStatus) DeepCopyInto(out *ReplicaAutoscalerStatus)

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

type ReplicaAutoscalerStrategy

type ReplicaAutoscalerStrategy struct {
	// Panic Mode
	// Panic Windows in seconds indicates how long the panic mode will last after startup.
	PanicWindowSeconds *int32 `json:"panicWindowSeconds,omitempty"`
	// Panic Threshold indicates the threshold of replicas to trigger panic mode.
	// Value: 1.1 - 10.0 e.g 1.1 means the desired replicas is 110% of the current replicas.
	PanicThreshold *resource.Quantity `json:"panicThreshold,omitempty"`
}

func (*ReplicaAutoscalerStrategy) DeepCopy

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

func (*ReplicaAutoscalerStrategy) DeepCopyInto

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

type ReplicaAutoscalerTarget

type ReplicaAutoscalerTarget struct {
	// metric indicates which metric provider should present utilization stat.
	Metric string `json:"metric"`
	// metricType represents whether the metric type is Utilization, Value, or AverageValue
	MetricType MetricTargetType `json:"metricType,omitempty"`

	Settings TargetSettings `json:"settings"`
}

ReplicaAutoscalerTarget defines metric provider and target threshold

func (*ReplicaAutoscalerTarget) DeepCopy

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

func (*ReplicaAutoscalerTarget) DeepCopyInto

func (in *ReplicaAutoscalerTarget) DeepCopyInto(out *ReplicaAutoscalerTarget)

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

type ReplicaPatch

type ReplicaPatch struct {
	// Specified the working timezone of the patch.
	Timezone string `json:"timezone"`
	// Start and End could be a cron expression or a time string.
	// But can't be mixed.
	Start string `json:"start"`
	End   string `json:"end"`
	// When using specified time range, retention seconds is required.
	// It's the time duration of the patch will be hold for after end time, then will be purge.
	// Zero means will be deleted once found out of the time range.
	RetentionSeconds *int64 `json:"retentionSeconds,omitempty"`
	// MinReplicas is the lower limit for the number of replicas to which the autoscaler can scale down.
	MinReplicas int32 `json:"minReplicas"`
	// MaxReplicas is the upper limit for the number of replicas to which the autoscaler can scale up.
	MaxReplicas int32 `json:"maxReplicas"`
}

Advanced feature: Replica Patch, dynamic controls the scaling range of the replica autoscaler. implemented in ReplicaAutoscaler annotation `wing.xscaling.dev/replica-patches`. As stored in annotation, it's a json string of []ReplicaPatch and it's mutable for controller rather than spec. WARNING: If it's a static replica autoscaler, this patch will be ignored.

func (*ReplicaPatch) DeepCopy

func (in *ReplicaPatch) DeepCopy() *ReplicaPatch

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

func (*ReplicaPatch) DeepCopyInto

func (in *ReplicaPatch) DeepCopyInto(out *ReplicaPatch)

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

type ReplicaPatches

type ReplicaPatches []ReplicaPatch

func (ReplicaPatches) DeepCopy

func (in ReplicaPatches) DeepCopy() ReplicaPatches

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

func (ReplicaPatches) DeepCopyInto

func (in ReplicaPatches) DeepCopyInto(out *ReplicaPatches)

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

type ScheduleTargetSettings

type ScheduleTargetSettings struct {
	Timezone string `json:"timezone"`
	Start    string `json:"start"`
	End      string `json:"end"`
	// +kubebuilder:pruning:PreserveUnknownFields
	Settings *runtime.RawExtension `json:"settings"`
}

func (*ScheduleTargetSettings) DeepCopy

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

func (*ScheduleTargetSettings) DeepCopyInto

func (in *ScheduleTargetSettings) DeepCopyInto(out *ScheduleTargetSettings)

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

type TargetSettings

type TargetSettings struct {
	// +kubebuilder:pruning:PreserveUnknownFields
	Default *runtime.RawExtension `json:"default"`

	// +kubebuilder:validation:Optional
	// +optional
	Schedules []ScheduleTargetSettings `json:"schedules,omitempty"`
}

func (*TargetSettings) DeepCopy

func (in *TargetSettings) DeepCopy() *TargetSettings

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

func (*TargetSettings) DeepCopyInto

func (in *TargetSettings) DeepCopyInto(out *TargetSettings)

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

type TargetStatus

type TargetStatus struct {
	// Target indicates the source of status
	Target string `json:"target"`
	// Scaler indicates which scaler used for calculating desired replicas
	Scaler string `json:"scaler"`
	// Target desired replicas calculated by giving settings
	DesiredReplicas int32 `json:"desireReplicas"`
	// Metric holds key values of scaler which used for calculate desired replicas
	Metric MetricTarget ` json:"metric"`
}

TargetStatus represents the running status of scaling target

func (*TargetStatus) DeepCopy

func (in *TargetStatus) DeepCopy() *TargetStatus

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

func (*TargetStatus) DeepCopyInto

func (in *TargetStatus) DeepCopyInto(out *TargetStatus)

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