deprovisioning

package
v0.0.0-...-d7985ca Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2023 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

This section is empty.

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 CandidateFilter

type CandidateFilter func(context.Context, *state.Node, *v1alpha5.Provisioner, []*v1.Pod) bool

type CandidateNode

type CandidateNode struct {
	*v1.Node
	// contains filtered or unexported fields
}

CandidateNode is a node that we are considering for deprovisioning along with extra information to be used in making that determination

type Command

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

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, *state.Node, *v1alpha5.Provisioner, []*v1.Pod) bool
	ComputeCommand(context.Context, ...CandidateNode) (Command, error)
	String() string
}

type Drift

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

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

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, candidates ...CandidateNode) (Command, error)

ComputeCommand generates a deprovisioning command given deprovisionable nodes

func (*Drift) ShouldDeprovision

func (d *Drift) ShouldDeprovision(ctx context.Context, n *state.Node, provisioner *v1alpha5.Provisioner, nodePods []*v1.Pod) bool

ShouldDeprovision is a predicate used to filter deprovisionable nodes

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 nodes. Emptiness will respect TTLSecondsAfterEmpty

func NewEmptiness

func NewEmptiness(clk clock.Clock) *Emptiness

func (*Emptiness) ComputeCommand

func (e *Emptiness) ComputeCommand(_ context.Context, nodes ...CandidateNode) (Command, error)

ComputeCommand generates a deprovisioning command given deprovisionable nodes

func (*Emptiness) ShouldDeprovision

func (e *Emptiness) ShouldDeprovision(ctx context.Context, n *state.Node, provisioner *v1alpha5.Provisioner, nodePods []*v1.Pod) bool

ShouldDeprovision is a predicate used to filter deprovisionable nodes

func (*Emptiness) String

func (e *Emptiness) String() string

string is the string representation of the deprovisioner

type EmptyNodeConsolidation

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

EmptyNodeConsolidation is the consolidation controller that performs multi-node consolidation of entirely empty nodes

func NewEmptyNodeConsolidation

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

func (*EmptyNodeConsolidation) ComputeCommand

func (c *EmptyNodeConsolidation) ComputeCommand(ctx context.Context, candidates ...CandidateNode) (Command, error)

ComputeCommand generates a deprovisioning command given deprovisionable nodes

func (*EmptyNodeConsolidation) ShouldDeprovision

func (c *EmptyNodeConsolidation) ShouldDeprovision(ctx context.Context, n *state.Node, provisioner *v1alpha5.Provisioner, _ []*v1.Pod) bool

ShouldDeprovision is a predicate used to filter deprovisionable nodes

func (*EmptyNodeConsolidation) String

func (c *EmptyNodeConsolidation) String() string

string is the string representation of the deprovisioner

func (*EmptyNodeConsolidation) ValidateCommand

func (c *EmptyNodeConsolidation) ValidateCommand(ctx context.Context, cmd Command, candidateNodes []CandidateNode) (bool, error)

ValidateCommand validates a command for a 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, candidates ...CandidateNode) (Command, error)

ComputeCommand generates a deprovisioning command given deprovisionable nodes

func (*Expiration) ShouldDeprovision

func (e *Expiration) ShouldDeprovision(ctx context.Context, n *state.Node, provisioner *v1alpha5.Provisioner, nodePods []*v1.Pod) bool

ShouldDeprovision is a predicate used to filter deprovisionable nodes

func (*Expiration) SortCandidates

func (e *Expiration) SortCandidates(nodes []CandidateNode) []CandidateNode

SortCandidates orders expired nodes by when they've expired

func (*Expiration) String

func (e *Expiration) String() string

String is the string representation of the deprovisioner

type MultiNodeConsolidation

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

func NewMultiNodeConsolidation

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

func (*MultiNodeConsolidation) ComputeCommand

func (m *MultiNodeConsolidation) ComputeCommand(ctx context.Context, candidates ...CandidateNode) (Command, error)

func (*MultiNodeConsolidation) ShouldDeprovision

func (c *MultiNodeConsolidation) ShouldDeprovision(ctx context.Context, n *state.Node, provisioner *v1alpha5.Provisioner, _ []*v1.Pod) bool

ShouldDeprovision is a predicate used to filter deprovisionable nodes

func (*MultiNodeConsolidation) String

func (c *MultiNodeConsolidation) String() string

string is the string representation of the deprovisioner

func (*MultiNodeConsolidation) ValidateCommand

func (c *MultiNodeConsolidation) ValidateCommand(ctx context.Context, cmd Command, candidateNodes []CandidateNode) (bool, error)

ValidateCommand validates a command for a 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 SingleNodeConsolidation

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

SingleNodeConsolidation is the consolidation controller that performs single node consolidation.

func NewSingleNodeConsolidation

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

func (*SingleNodeConsolidation) ComputeCommand

func (c *SingleNodeConsolidation) ComputeCommand(ctx context.Context, candidates ...CandidateNode) (Command, error)

ComputeCommand generates a deprovisioning command given deprovisionable nodes

func (*SingleNodeConsolidation) ShouldDeprovision

func (c *SingleNodeConsolidation) ShouldDeprovision(ctx context.Context, n *state.Node, provisioner *v1alpha5.Provisioner, _ []*v1.Pod) bool

ShouldDeprovision is a predicate used to filter deprovisionable nodes

func (*SingleNodeConsolidation) String

func (c *SingleNodeConsolidation) String() string

string is the string representation of the deprovisioner

func (*SingleNodeConsolidation) ValidateCommand

func (c *SingleNodeConsolidation) ValidateCommand(ctx context.Context, cmd Command, candidateNodes []CandidateNode) (bool, error)

ValidateCommand validates a command for a 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) *Validation

func (*Validation) IsValid

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

func (*Validation) ShouldDeprovision

func (v *Validation) ShouldDeprovision(_ context.Context, n *state.Node, provisioner *v1alpha5.Provisioner, _ []*v1.Pod) bool

ShouldDeprovision is a predicate used to filter deprovisionable nodes

func (*Validation) ValidateCommand

func (v *Validation) ValidateCommand(ctx context.Context, cmd Command, candidateNodes []CandidateNode) (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