scale

package
v0.0.0-...-038031d Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ScaleCondition

func ScaleCondition(r Scaler, precondition *ScalePrecondition, namespace, name string, count uint, updatedResourceVersion *string, gr schema.GroupResource) wait.ConditionFunc

ScaleCondition is a closure around Scale that facilitates retries via util.wait

func WaitForScaleHasDesiredReplicas

func WaitForScaleHasDesiredReplicas(sClient scaleclient.ScalesGetter, gr schema.GroupResource, resourceName string, namespace string, newSize uint, waitForReplicas *RetryParams) error

WaitForScaleHasDesiredReplicas waits until condition scaleHasDesiredReplicas is satisfied or returns error when timeout happens

Types

type PreconditionError

type PreconditionError struct {
	Precondition  string
	ExpectedValue string
	ActualValue   string
}

A PreconditionError is returned when a resource fails to match the scale preconditions passed to kubectl.

func (PreconditionError) Error

func (pe PreconditionError) Error() string

type RetryParams

type RetryParams struct {
	Interval, Timeout time.Duration
}

RetryParams encapsulates the retry parameters used by kubectl's scaler.

func NewRetryParams

func NewRetryParams(interval, timeout time.Duration) *RetryParams

type ScalePrecondition

type ScalePrecondition struct {
	Size            int
	ResourceVersion string
}

ScalePrecondition describes a condition that must be true for the scale to take place If CurrentSize == -1, it is ignored. If CurrentResourceVersion is the empty string, it is ignored. Otherwise they must equal the values in the resource for it to be valid.

type Scaler

type Scaler interface {
	// Scale scales the named resource after checking preconditions. It optionally
	// retries in the event of resource version mismatch (if retry is not nil),
	// and optionally waits until the status of the resource matches newSize (if wait is not nil)
	// TODO: Make the implementation of this watch-based (#56075) once #31345 is fixed.
	Scale(namespace, name string, newSize uint, preconditions *ScalePrecondition, retry, wait *RetryParams, gr schema.GroupResource) error
	// ScaleSimple does a simple one-shot attempt at scaling - not useful on its own, but
	// a necessary building block for Scale
	ScaleSimple(namespace, name string, preconditions *ScalePrecondition, newSize uint, gr schema.GroupResource) (updatedResourceVersion string, err error)
}

Scaler provides an interface for resources that can be scaled.

func NewScaler

func NewScaler(scalesGetter scaleclient.ScalesGetter) Scaler

NewScaler get a scaler for a given resource

Jump to

Keyboard shortcuts

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