deprovisioning

package
v0.31.4 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: Apache-2.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

View Source
const MultiMachineConsolidationTimeoutDuration = 1 * time.Minute
View Source
const SingleMachineConsolidationTimeoutDuration = 3 * time.Minute

Variables

This section is empty.

Functions

func GetPodEvictionCost

func GetPodEvictionCost(ctx context.Context, p *v1.Pod) float64

GetPodEvictionCost returns the disruption cost computed for evicting the given pod.

Types

type Action added in v0.28.0

type Action string
var (
	NoOpAction    Action = "no-op"
	ReplaceAction Action = "replace"
	DeleteAction  Action = "delete"
)

type Candidate added in v0.27.1

type Candidate struct {
	*state.StateNode
	// contains filtered or unexported fields
}

Candidate is a state.StateNode that we are considering for deprovisioning along with extra information to be used in making that determination

func GetCandidates added in v0.27.1

func GetCandidates(ctx context.Context, cluster *state.Cluster, kubeClient client.Client, recorder events.Recorder, clk clock.Clock, cloudProvider cloudprovider.CloudProvider, shouldDeprovision CandidateFilter) ([]*Candidate, error)

GetCandidates returns nodes that appear to be currently deprovisionable based off of their nodePool

func NewCandidate added in v0.27.1

func NewCandidate(ctx context.Context, kubeClient client.Client, recorder events.Recorder, clk clock.Clock, node *state.StateNode,
	nodePoolMap map[nodepoolutil.Key]*v1beta1.NodePool, nodePoolToInstanceTypesMap map[nodepoolutil.Key]map[string]*cloudprovider.InstanceType) (*Candidate, error)

type CandidateFilter

type CandidateFilter func(context.Context, *Candidate) bool

type Command

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

func (Command) Action added in v0.28.0

func (o Command) Action() Action

func (Command) String

func (o Command) String() string

type Controller

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

Controller is the deprovisioning controller.

func NewController

func NewController(clk clock.Clock, kubeClient client.Client, provisioner *provisioning.Provisioner,
	cp cloudprovider.CloudProvider, recorder events.Recorder, cluster *state.Cluster) *Controller

func (*Controller) Builder

func (*Controller) Name

func (c *Controller) Name() string

func (*Controller) Reconcile

func (c *Controller) Reconcile(ctx context.Context, _ reconcile.Request) (reconcile.Result, error)

type Deprovisioner

type Deprovisioner interface {
	ShouldDeprovision(context.Context, *Candidate) bool
	ComputeCommand(context.Context, ...*Candidate) (Command, error)
	String() string
}

type Drift

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

Drift is a subreconciler that deletes drifted machines.

func NewDrift

func NewDrift(kubeClient client.Client, cluster *state.Cluster, provisioner *provisioning.Provisioner, recorder events.Recorder) *Drift

func (*Drift) ComputeCommand

func (d *Drift) ComputeCommand(ctx context.Context, nodes ...*Candidate) (Command, error)

ComputeCommand generates a deprovisioning command given deprovisionable machines

func (*Drift) ShouldDeprovision

func (d *Drift) ShouldDeprovision(ctx context.Context, c *Candidate) bool

ShouldDeprovision is a predicate used to filter deprovisionable machines

func (*Drift) String

func (d *Drift) String() string

String is the string representation of the deprovisioner

type Emptiness

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

Emptiness is a subreconciler that deletes empty machines. Emptiness will respect TTLSecondsAfterEmpty

func NewEmptiness

func NewEmptiness(clk clock.Clock) *Emptiness

func (*Emptiness) ComputeCommand

func (e *Emptiness) ComputeCommand(_ context.Context, candidates ...*Candidate) (Command, error)

ComputeCommand generates a deprovisioning command given deprovisionable machines

func (*Emptiness) ShouldDeprovision

func (e *Emptiness) ShouldDeprovision(_ context.Context, c *Candidate) bool

ShouldDeprovision is a predicate used to filter deprovisionable machines

func (*Emptiness) String

func (e *Emptiness) String() string

string is the string representation of the deprovisioner

type EmptyMachineConsolidation added in v0.27.1

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

EmptyMachineConsolidation is the consolidation controller that performs multi-machine consolidation of entirely empty machines

func NewEmptyMachineConsolidation added in v0.27.1

func NewEmptyMachineConsolidation(clk clock.Clock, cluster *state.Cluster, kubeClient client.Client,
	provisioner *provisioning.Provisioner, cp cloudprovider.CloudProvider, recorder events.Recorder) *EmptyMachineConsolidation

func (*EmptyMachineConsolidation) ComputeCommand added in v0.27.1

func (c *EmptyMachineConsolidation) ComputeCommand(ctx context.Context, candidates ...*Candidate) (Command, error)

ComputeCommand generates a deprovisioning command given deprovisionable machines

func (*EmptyMachineConsolidation) ShouldDeprovision added in v0.27.1

func (c *EmptyMachineConsolidation) ShouldDeprovision(_ context.Context, cn *Candidate) bool

ShouldDeprovision is a predicate used to filter deprovisionable nodes

func (*EmptyMachineConsolidation) String added in v0.27.1

func (c *EmptyMachineConsolidation) String() string

string is the string representation of the deprovisioner

type Expiration

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

Expiration is a subreconciler that deletes empty nodes. Expiration will respect TTLSecondsAfterEmpty

func NewExpiration

func NewExpiration(clk clock.Clock, kubeClient client.Client, cluster *state.Cluster, provisioner *provisioning.Provisioner, recorder events.Recorder) *Expiration

func (*Expiration) ComputeCommand

func (e *Expiration) ComputeCommand(ctx context.Context, nodes ...*Candidate) (Command, error)

ComputeCommand generates a deprovisioning command given deprovisionable nodes

func (*Expiration) ShouldDeprovision

func (e *Expiration) ShouldDeprovision(_ context.Context, c *Candidate) bool

ShouldDeprovision is a predicate used to filter deprovisionable nodes

func (*Expiration) String

func (e *Expiration) String() string

String is the string representation of the deprovisioner

type MultiMachineConsolidation added in v0.27.1

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

func NewMultiMachineConsolidation added in v0.27.1

func NewMultiMachineConsolidation(clk clock.Clock, cluster *state.Cluster, kubeClient client.Client,
	provisioner *provisioning.Provisioner, cp cloudprovider.CloudProvider, recorder events.Recorder) *MultiMachineConsolidation

func (*MultiMachineConsolidation) ComputeCommand added in v0.27.1

func (m *MultiMachineConsolidation) ComputeCommand(ctx context.Context, candidates ...*Candidate) (Command, error)

func (*MultiMachineConsolidation) ShouldDeprovision added in v0.27.1

func (c *MultiMachineConsolidation) ShouldDeprovision(_ context.Context, cn *Candidate) bool

ShouldDeprovision is a predicate used to filter deprovisionable nodes

func (*MultiMachineConsolidation) String added in v0.27.1

func (c *MultiMachineConsolidation) String() string

string is the string representation of the deprovisioner

type PDBLimits

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

PDBLimits is used to evaluate if evicting a list of pods is possible.

func NewPDBLimits

func NewPDBLimits(ctx context.Context, kubeClient client.Client) (*PDBLimits, error)

func (*PDBLimits) CanEvictPods

func (s *PDBLimits) CanEvictPods(pods []*v1.Pod) (client.ObjectKey, bool)

CanEvictPods returns true if every pod in the list is evictable. They may not all be evictable simultaneously, but for every PDB that controls the pods at least one pod can be evicted.

type SingleMachineConsolidation added in v0.27.1

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

SingleMachineConsolidation is the consolidation controller that performs single machine consolidation.

func NewSingleMachineConsolidation added in v0.27.1

func NewSingleMachineConsolidation(clk clock.Clock, cluster *state.Cluster, kubeClient client.Client, provisioner *provisioning.Provisioner,
	cp cloudprovider.CloudProvider, recorder events.Recorder) *SingleMachineConsolidation

func (*SingleMachineConsolidation) ComputeCommand added in v0.27.1

func (s *SingleMachineConsolidation) ComputeCommand(ctx context.Context, candidates ...*Candidate) (Command, error)

ComputeCommand generates a deprovisioning command given deprovisionable machines nolint:gocyclo

func (*SingleMachineConsolidation) ShouldDeprovision added in v0.27.1

func (c *SingleMachineConsolidation) ShouldDeprovision(_ context.Context, cn *Candidate) bool

ShouldDeprovision is a predicate used to filter deprovisionable nodes

func (*SingleMachineConsolidation) String added in v0.27.1

func (c *SingleMachineConsolidation) String() string

string is the string representation of the deprovisioner

type Validation

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

Validation is used to perform validation on a consolidation command. It makes an assumption that when re-used, all of the commands passed to IsValid were constructed based off of the same consolidation state. This allows it to skip the validation TTL for all but the first command.

func NewValidation

func NewValidation(validationPeriod time.Duration, clk clock.Clock, cluster *state.Cluster, kubeClient client.Client, provisioner *provisioning.Provisioner, cp cloudprovider.CloudProvider, recorder events.Recorder) *Validation

func (*Validation) IsValid

func (v *Validation) IsValid(ctx context.Context, cmd Command) (bool, error)

func (*Validation) ShouldDeprovision

func (v *Validation) ShouldDeprovision(_ context.Context, c *Candidate) bool

ShouldDeprovision is a predicate used to filter deprovisionable nodes

func (*Validation) ValidateCommand

func (v *Validation) ValidateCommand(ctx context.Context, cmd Command, candidates []*Candidate) (bool, error)

ValidateCommand validates a command for a deprovisioner

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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