pod

package
v0.0.0-...-86fc13e Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewContainerStatusNotPresentError

func NewContainerStatusNotPresentError() error

func NewContainerStatusResourcesNotPresentError

func NewContainerStatusResourcesNotPresentError() error

func NewScaleConfig

func NewScaleConfig(kubeHelper KubeHelper) podcommon.ScaleConfig

func NewValidationError

func NewValidationError(message string, toWrap error) error

Types

type ContainerKubeHelper

type ContainerKubeHelper interface {
	Get(*v1.Pod, string) (*v1.Container, error)
	HasStartupProbe(container *v1.Container) bool
	HasReadinessProbe(container *v1.Container) bool
	State(*v1.Pod, string) (v1.ContainerState, error)
	IsStarted(*v1.Pod, string) (bool, error)
	IsReady(*v1.Pod, string) (bool, error)
	Requests(*v1.Container, v1.ResourceName) resource.Quantity
	Limits(*v1.Container, v1.ResourceName) resource.Quantity
	ResizePolicy(*v1.Container, v1.ResourceName) (v1.ResourceResizeRestartPolicy, error)
	CurrentRequests(*v1.Pod, string, v1.ResourceName) (resource.Quantity, error)
	CurrentLimits(*v1.Pod, string, v1.ResourceName) (resource.Quantity, error)
}

ContainerKubeHelper performs operations relating to Kube containers.

type ContainerStatusNotPresentError

type ContainerStatusNotPresentError struct{}

ContainerStatusNotPresentError is an error that indicates container status is not present.

func (ContainerStatusNotPresentError) Error

type ContainerStatusResourcesNotPresentError

type ContainerStatusResourcesNotPresentError struct{}

ContainerStatusResourcesNotPresentError is an error that indicates container status resources is not present.

func (ContainerStatusResourcesNotPresentError) Error

type KubeHelper

type KubeHelper interface {
	Get(context.Context, types.NamespacedName) (bool, *v1.Pod, error)
	Patch(context.Context, *v1.Pod, func(*v1.Pod) (bool, *v1.Pod, error), bool, bool) (*v1.Pod, error)
	UpdateContainerResources(
		context.Context,
		*v1.Pod,
		string,
		resource.Quantity, resource.Quantity,
		resource.Quantity, resource.Quantity,
		func(pod *v1.Pod) (bool, *v1.Pod, error),
		bool,
	) (*v1.Pod, error)
	HasAnnotation(pod *v1.Pod, name string) (bool, string)
	ExpectedLabelValueAs(*v1.Pod, string, podcommon.Type) (any, error)
	ExpectedAnnotationValueAs(*v1.Pod, string, podcommon.Type) (any, error)
	IsContainerInSpec(*v1.Pod, string) bool
	ResizeStatus(*v1.Pod) v1.PodResizeStatus
}

KubeHelper performs operations relating to Kube pods.

type Pod

type Pod struct {
	Validation            Validation
	TargetContainerState  TargetContainerState
	TargetContainerAction TargetContainerAction
	Status                Status
	KubeHelper            KubeHelper
	ContainerKubeHelper   ContainerKubeHelper
}

Pod is a facade (and the only package-external entry point) for pod interaction and contains a number of services. It only exposes exported services methods via their corresponding interfaces.

func NewPod

func NewPod(
	controllerConfig controllercommon.ControllerConfig,
	client client.Client,
	recorder record.EventRecorder,
) *Pod

type Status

type Status interface {
	Update(context.Context, *v1.Pod, string, podcommon.States, podcommon.StatusScaleState) (*v1.Pod, error)
	PodMutationFunc(context.Context, string, podcommon.States, podcommon.StatusScaleState) func(pod *v1.Pod) (bool, *v1.Pod, error)
}

Status performs operations relating to controller status.

type TargetContainerAction

type TargetContainerAction interface {
	Execute(context.Context, podcommon.States, *v1.Pod, podcommon.ScaleConfig) error
}

TargetContainerAction performs actions based on target container state.

type TargetContainerState

type TargetContainerState interface {
	States(context.Context, *v1.Pod, podcommon.ScaleConfig) (podcommon.States, error)
}

TargetContainerState performs operations relating to determining target container state.

type Validation

type Validation interface {
	Validate(context.Context, *v1.Pod, podcommon.ScaleConfig, func(podcommon.ScaleConfig)) error
}

Validation performs operations relating to validation.

type ValidationError

type ValidationError struct {
	// contains filtered or unexported fields
}

ValidationError is an error that indicates validation failed. It wraps another error.

func (ValidationError) Error

func (e ValidationError) Error() string

func (ValidationError) Unwrap

func (e ValidationError) Unwrap() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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