v1alpha1

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2020 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

+k8s:deepcopy-gen=package +groupName=autoscaling.internal.knative.dev

Index

Constants

View Source
const (
	// PodAutoscalerConditionReady is set when the revision is starting to materialize
	// runtime resources, and becomes true when those resources are ready.
	PodAutoscalerConditionReady = apis.ConditionReady
	// PodAutoscalerConditionActive is set when the PodAutoscaler's ScaleTargetRef is receiving traffic.
	PodAutoscalerConditionActive apis.ConditionType = "Active"
)
View Source
const (
	// MetricConditionReady is set when the Metric's latest
	// underlying revision has reported readiness.
	MetricConditionReady = apis.ConditionReady
)

Variables

View Source
var (
	SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
	AddToScheme   = SchemeBuilder.AddToScheme
)
View Source
var SchemeGroupVersion = schema.GroupVersion{Group: autoscaling.InternalGroupName, Version: "v1alpha1"}

SchemeGroupVersion is group version used to register these objects

Functions

func Kind

func Kind(kind string) schema.GroupKind

Kind takes an unqualified kind and returns back a Group qualified GroupKind

func Resource

func Resource(resource string) schema.GroupResource

Resource takes an unqualified resource and returns a Group qualified GroupResource

Types

type Metric

type Metric struct {
	metav1.TypeMeta `json:",inline"`
	// +optional
	metav1.ObjectMeta `json:"metadata,omitempty"`

	// Spec holds the desired state of the Metric (from the client).
	// +optional
	Spec MetricSpec `json:"spec,omitempty"`

	// Status communicates the observed state of the Metric (from the controller).
	// +optional
	Status MetricStatus `json:"status,omitempty"`
}

Metric represents a resource to configure the metric collector with.

+genclient +genreconciler +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

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.

func (*Metric) DeepCopyObject

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

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

func (*Metric) GetGroupVersionKind

func (m *Metric) GetGroupVersionKind() schema.GroupVersionKind

GetGroupVersionKind implements OwnerRefable.

func (*Metric) SetDefaults

func (m *Metric) SetDefaults(ctx context.Context)

SetDefaults sets defaults on the entire Metric if applicable.

func (*Metric) Validate

func (m *Metric) Validate(ctx context.Context) *apis.FieldError

Validate validates the entire Metric.

type MetricList

type MetricList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata"`

	Items []Metric `json:"items"`
}

MetricList is a list of Metric resources

+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

func (*MetricList) DeepCopy

func (in *MetricList) DeepCopy() *MetricList

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

func (*MetricList) DeepCopyInto

func (in *MetricList) DeepCopyInto(out *MetricList)

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

func (*MetricList) DeepCopyObject

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

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

type MetricSpec

type MetricSpec struct {
	// StableWindow is the aggregation window for metrics in a stable state.
	StableWindow time.Duration `json:"stableWindow"`
	// PanicWindow is the aggregation window for metrics where quick reactions are needed.
	PanicWindow time.Duration `json:"panicWindow"`
	// ScrapeTarget is the K8s service that publishes the metric endpoint.
	ScrapeTarget string `json:"scrapeTarget"`
}

MetricSpec contains all values a metric collector needs to operate.

func (*MetricSpec) DeepCopy

func (in *MetricSpec) DeepCopy() *MetricSpec

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

func (*MetricSpec) DeepCopyInto

func (in *MetricSpec) DeepCopyInto(out *MetricSpec)

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

func (*MetricSpec) SetDefaults

func (ms *MetricSpec) SetDefaults(ctx context.Context)

SetDefaults sets defaults on the Metric's Spec if applicable.

func (*MetricSpec) Validate

func (ms *MetricSpec) Validate(ctx context.Context) *apis.FieldError

Validate validates Metric's Spec.

type MetricStatus

type MetricStatus struct {
	duckv1.Status `json:",inline"`
}

MetricStatus reflects the status of metric collection for this specific entity.

func (*MetricStatus) DeepCopy

func (in *MetricStatus) DeepCopy() *MetricStatus

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

func (*MetricStatus) DeepCopyInto

func (in *MetricStatus) DeepCopyInto(out *MetricStatus)

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

func (*MetricStatus) GetCondition

func (ms *MetricStatus) GetCondition(t apis.ConditionType) *apis.Condition

GetCondition gets the condition `t`.

func (*MetricStatus) InitializeConditions

func (ms *MetricStatus) InitializeConditions()

InitializeConditions initializes the conditions of the Metric.

func (*MetricStatus) IsReady

func (ms *MetricStatus) IsReady() bool

IsReady looks at the conditions and if the condition MetricConditionReady is true

func (*MetricStatus) MarkMetricFailed

func (ms *MetricStatus) MarkMetricFailed(reason, message string)

MarkMetricFailed marks the metric status as failed

func (*MetricStatus) MarkMetricNotReady

func (ms *MetricStatus) MarkMetricNotReady(reason, message string)

MarkMetricNotReady marks the metric status as ready == Unknown

func (*MetricStatus) MarkMetricReady

func (ms *MetricStatus) MarkMetricReady()

MarkMetricReady marks the metric status as ready

type PodAutoscaler

type PodAutoscaler struct {
	metav1.TypeMeta `json:",inline"`
	// +optional
	metav1.ObjectMeta `json:"metadata,omitempty"`

	// Spec holds the desired state of the PodAutoscaler (from the client).
	// +optional
	Spec PodAutoscalerSpec `json:"spec,omitempty"`

	// Status communicates the observed state of the PodAutoscaler (from the controller).
	// +optional
	Status PodAutoscalerStatus `json:"status,omitempty"`
}

PodAutoscaler is a Knative abstraction that encapsulates the interface by which Knative components instantiate autoscalers. This definition is an abstraction that may be backed by multiple definitions. For more information, see the Knative Pluggability presentation: https://docs.google.com/presentation/d/10KWynvAJYuOEWy69VBa6bHJVCqIsz1TNdEKosNvcpPY/edit

func (*PodAutoscaler) Class

func (pa *PodAutoscaler) Class() string

func (*PodAutoscaler) DeepCopy

func (in *PodAutoscaler) DeepCopy() *PodAutoscaler

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

func (*PodAutoscaler) DeepCopyInto

func (in *PodAutoscaler) DeepCopyInto(out *PodAutoscaler)

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

func (*PodAutoscaler) DeepCopyObject

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

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

func (*PodAutoscaler) GetGroupVersionKind

func (pa *PodAutoscaler) GetGroupVersionKind() schema.GroupVersionKind

func (*PodAutoscaler) Metric

func (pa *PodAutoscaler) Metric() string

Metric returns the contents of the metric annotation or a default.

func (*PodAutoscaler) PanicThresholdPercentage

func (pa *PodAutoscaler) PanicThresholdPercentage() (percentage float64, ok bool)

PanicThresholdPercentage return the panic target annotation value or false if not present.

func (*PodAutoscaler) PanicWindowPercentage

func (pa *PodAutoscaler) PanicWindowPercentage() (percentage float64, ok bool)

PanicWindowPercentage returns panic window annotation value or false if not present.

func (*PodAutoscaler) ScaleBounds

func (pa *PodAutoscaler) ScaleBounds() (min, max int32)

ScaleBounds returns scale bounds annotations values as a tuple: `(min, max int32)`. The value of 0 for any of min or max means the bound is not set. Note: min will be ignored if the PA is not reachable

func (*PodAutoscaler) SetDefaults

func (r *PodAutoscaler) SetDefaults(ctx context.Context)

func (*PodAutoscaler) Target

func (pa *PodAutoscaler) Target() (float64, bool)

Target returns the target annotation value or false if not present, or invalid.

func (*PodAutoscaler) TargetBC

func (pa *PodAutoscaler) TargetBC() (float64, bool)

TargetBC returns the target burst capacity, if the corresponding annotation is set.

func (*PodAutoscaler) TargetUtilization

func (pa *PodAutoscaler) TargetUtilization() (float64, bool)

TargetUtilization returns the target capacity utilization as a fraction, if the corresponding annotation is set.

func (*PodAutoscaler) Validate

func (pa *PodAutoscaler) Validate(ctx context.Context) *apis.FieldError

func (*PodAutoscaler) Window

func (pa *PodAutoscaler) Window() (window time.Duration, ok bool)

Window returns the window annotation value or false if not present.

type PodAutoscalerList

type PodAutoscalerList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata"`

	Items []PodAutoscaler `json:"items"`
}

PodAutoscalerList is a list of PodAutoscaler resources

func (*PodAutoscalerList) DeepCopy

func (in *PodAutoscalerList) DeepCopy() *PodAutoscalerList

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

func (*PodAutoscalerList) DeepCopyInto

func (in *PodAutoscalerList) DeepCopyInto(out *PodAutoscalerList)

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

func (*PodAutoscalerList) DeepCopyObject

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

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

type PodAutoscalerSpec

type PodAutoscalerSpec struct {
	// DeprecatedGeneration was used prior in Kubernetes versions <1.11
	// when metadata.generation was not being incremented by the api server
	//
	// This property will be dropped in future Knative releases and should
	// not be used - use metadata.generation
	//
	// Tracking issue: https://github.com/knative/serving/issues/643
	//
	// +optional
	DeprecatedGeneration int64 `json:"generation,omitempty"`

	// ContainerConcurrency specifies the maximum allowed
	// in-flight (concurrent) requests per container of the Revision.
	// Defaults to `0` which means unlimited concurrency.
	// +optional
	ContainerConcurrency int64 `json:"containerConcurrency,omitempty"`

	// ScaleTargetRef defines the /scale-able resource that this PodAutoscaler
	// is responsible for quickly right-sizing.
	ScaleTargetRef corev1.ObjectReference `json:"scaleTargetRef"`

	// Reachable specifies whether or not the `ScaleTargetRef` can be reached (ie. has a route).
	// Defaults to `ReachabilityUnknown`
	// +optional
	Reachability ReachabilityType `json:"reachability,omitempty"`

	// The application-layer protocol. Matches `ProtocolType` inferred from the revision spec.
	ProtocolType net.ProtocolType `json:"protocolType"`
}

PodAutoscalerSpec holds the desired state of the PodAutoscaler (from the client).

func (*PodAutoscalerSpec) DeepCopy

func (in *PodAutoscalerSpec) DeepCopy() *PodAutoscalerSpec

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

func (*PodAutoscalerSpec) DeepCopyInto

func (in *PodAutoscalerSpec) DeepCopyInto(out *PodAutoscalerSpec)

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

func (*PodAutoscalerSpec) SetDefaults

func (rs *PodAutoscalerSpec) SetDefaults(ctx context.Context)

func (*PodAutoscalerSpec) Validate

func (pa *PodAutoscalerSpec) Validate(ctx context.Context) *apis.FieldError

Validate validates PodAutoscaler Spec.

type PodAutoscalerStatus

type PodAutoscalerStatus struct {
	duckv1.Status `json:",inline"`

	// ServiceName is the K8s Service name that serves the revision, scaled by this PA.
	// The service is created and owned by the ServerlessService object owned by this PA.
	ServiceName string `json:"serviceName"`

	// MetricsServiceName is the K8s Service name that provides revision metrics.
	// The service is managed by the PA object.
	MetricsServiceName string `json:"metricsServiceName"`

	// DesiredScale shows the current desired number of replicas for the revision.
	DesiredScale *int32 `json:"desiredScale,omitempty"`

	// ActualScale shows the actual number of replicas for the revision.
	ActualScale *int32 `json:"actualScale,omitempty"`
}

PodAutoscalerStatus communicates the observed state of the PodAutoscaler (from the controller).

func (*PodAutoscalerStatus) ActiveFor

func (pas *PodAutoscalerStatus) ActiveFor(now time.Time) time.Duration

ActiveFor returns the time PA spent being active.

func (*PodAutoscalerStatus) CanFailActivation

func (pas *PodAutoscalerStatus) CanFailActivation(now time.Time, idlePeriod time.Duration) bool

CanFailActivation checks whether the pod autoscaler has been activating for at least the specified idle period.

func (*PodAutoscalerStatus) CanScaleToZero

func (pas *PodAutoscalerStatus) CanScaleToZero(now time.Time, gracePeriod time.Duration) bool

CanScaleToZero checks whether the pod autoscaler has been in an inactive state for at least the specified grace period.

func (*PodAutoscalerStatus) DeepCopy

func (in *PodAutoscalerStatus) DeepCopy() *PodAutoscalerStatus

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

func (*PodAutoscalerStatus) DeepCopyInto

func (in *PodAutoscalerStatus) DeepCopyInto(out *PodAutoscalerStatus)

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

func (*PodAutoscalerStatus) GetActualScale

func (pas *PodAutoscalerStatus) GetActualScale() int32

GetActualScale returns the desired scale if ever set, or -1.

func (*PodAutoscalerStatus) GetCondition

func (pas *PodAutoscalerStatus) GetCondition(t apis.ConditionType) *apis.Condition

GetCondition gets the condition `t`.

func (*PodAutoscalerStatus) GetDesiredScale

func (pas *PodAutoscalerStatus) GetDesiredScale() int32

GetDesiredScale returns the desired scale if ever set, or -1.

func (*PodAutoscalerStatus) InitializeConditions

func (pas *PodAutoscalerStatus) InitializeConditions()

InitializeConditions initializes the conditionhs of the PA.

func (*PodAutoscalerStatus) IsActivating

func (pas *PodAutoscalerStatus) IsActivating() bool

IsActivating returns true if the pod autoscaler is Activating if it is neither Active nor Inactive

func (*PodAutoscalerStatus) IsInactive

func (pas *PodAutoscalerStatus) IsInactive() bool

IsInactive returns true if the pod autoscaler is Inactive.

func (*PodAutoscalerStatus) IsReady

func (pas *PodAutoscalerStatus) IsReady() bool

IsReady looks at the conditions and if the Status has a condition PodAutoscalerConditionReady returns true if ConditionStatus is True

func (*PodAutoscalerStatus) MarkActivating

func (pas *PodAutoscalerStatus) MarkActivating(reason, message string)

MarkActivating marks the PA as activating.

func (*PodAutoscalerStatus) MarkActive

func (pas *PodAutoscalerStatus) MarkActive()

MarkActive marks the PA active.

func (*PodAutoscalerStatus) MarkInactive

func (pas *PodAutoscalerStatus) MarkInactive(reason, message string)

MarkInactive marks the PA as inactive.

func (*PodAutoscalerStatus) MarkResourceFailedCreation

func (pas *PodAutoscalerStatus) MarkResourceFailedCreation(kind, name string)

MarkResourceFailedCreation changes the "Active" condition to false to reflect that a critical resource of the given kind and name was unable to be created.

func (*PodAutoscalerStatus) MarkResourceNotOwned

func (pas *PodAutoscalerStatus) MarkResourceNotOwned(kind, name string)

MarkResourceNotOwned changes the "Active" condition to false to reflect that the resource of the given kind and name has already been created, and we do not own it.

type PodScalable

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

	Spec   PodScalableSpec   `json:"spec"`
	Status PodScalableStatus `json:"status"`
}

PodScalable is a duck type that the resources referenced by the PodAutoscaler's ScaleTargetRef must implement. They must also implement the `/scale` sub-resource for use with `/scale` based implementations (e.g. HPA), but this further constrains the shape the referenced resources may take.

func (*PodScalable) DeepCopy

func (in *PodScalable) DeepCopy() *PodScalable

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

func (*PodScalable) DeepCopyInto

func (in *PodScalable) DeepCopyInto(out *PodScalable)

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

func (*PodScalable) DeepCopyObject

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

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

func (*PodScalable) GetFullType

func (*PodScalable) GetFullType() duck.Populatable

GetFullType implements duck.Implementable

func (*PodScalable) GetListType

func (*PodScalable) GetListType() runtime.Object

GetListType implements apis.Listable

func (*PodScalable) Populate

func (t *PodScalable) Populate()

Populate implements duck.Populatable

type PodScalableList

type PodScalableList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata"`

	Items []PodScalable `json:"items"`
}

PodScalableList is a list of PodScalable resources

func (*PodScalableList) DeepCopy

func (in *PodScalableList) DeepCopy() *PodScalableList

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

func (*PodScalableList) DeepCopyInto

func (in *PodScalableList) DeepCopyInto(out *PodScalableList)

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

func (*PodScalableList) DeepCopyObject

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

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

type PodScalableSpec

type PodScalableSpec struct {
	Replicas *int32                 `json:"replicas,omitempty"`
	Selector *metav1.LabelSelector  `json:"selector"`
	Template corev1.PodTemplateSpec `json:"template"`
}

PodScalableSpec is the specification for the desired state of a PodScalable (or at least our shared portion).

func (*PodScalableSpec) DeepCopy

func (in *PodScalableSpec) DeepCopy() *PodScalableSpec

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

func (*PodScalableSpec) DeepCopyInto

func (in *PodScalableSpec) DeepCopyInto(out *PodScalableSpec)

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

type PodScalableStatus

type PodScalableStatus struct {
	Replicas int32 `json:"replicas,omitempty"`
}

PodScalableStatus is the observed state of a PodScalable (or at least our shared portion).

func (*PodScalableStatus) DeepCopy

func (in *PodScalableStatus) DeepCopy() *PodScalableStatus

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

func (*PodScalableStatus) DeepCopyInto

func (in *PodScalableStatus) DeepCopyInto(out *PodScalableStatus)

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

type ReachabilityType

type ReachabilityType string

ReachabilityType is the enumeration type for the different states of reachability to the `ScaleTarget` of a `PodAutoscaler`

const (
	// ReachabilityUnknown means the reachability of the `ScaleTarget` is unknown.
	// Used when the reachability cannot be determined, eg. during activation.
	ReachabilityUnknown ReachabilityType = ""

	// ReachabilityReachable means the `ScaleTarget` is reachable, ie. it has an active route.
	ReachabilityReachable ReachabilityType = "Reachable"

	// ReachabilityReachable means the `ScaleTarget` is not reachable, ie. it does not have an active route.
	ReachabilityUnreachable ReachabilityType = "Unreachable"
)

Jump to

Keyboard shortcuts

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