disruption

package
v0.33.5 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const MultiNodeConsolidationTimeoutDuration = 1 * time.Minute
View Source
const SingleNodeConsolidationTimeoutDuration = 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

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

type Candidate

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

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

func GetCandidates

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

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

func NewCandidate

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

type CandidateFilter

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

type Command

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

func (Command) Action

func (o Command) Action() Action

func (Command) String

func (o Command) String() string

type Controller

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

func NewController

func NewController(clk clock.Clock, kubeClient client.Client, provisioner *provisioning.Provisioner,
	cp cloudprovider.CloudProvider, recorder events.Recorder, cluster *state.Cluster, queue *orchestration.Queue) *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 Drift

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

Drift is a subreconciler that deletes drifted candidates.

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 ...*Candidate) (Command, error)

ComputeCommand generates a disruption command given candidates

func (*Drift) ConsolidationType

func (d *Drift) ConsolidationType() string

func (*Drift) ShouldDisrupt

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

ShouldDisrupt is a predicate used to filter candidates

func (*Drift) Type

func (d *Drift) Type() string

type Emptiness

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

Emptiness is a subreconciler that deletes empty candidates. 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 disruption command given candidates

func (*Emptiness) ConsolidationType

func (e *Emptiness) ConsolidationType() string

func (*Emptiness) ShouldDisrupt

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

ShouldDisrupt is a predicate used to filter candidates

func (*Emptiness) Type

func (e *Emptiness) Type() string

type EmptyNodeConsolidation

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

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

func NewEmptyNodeConsolidation

func NewEmptyNodeConsolidation(consolidation consolidation) *EmptyNodeConsolidation

func (*EmptyNodeConsolidation) ComputeCommand

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

ComputeCommand generates a disruption command given candidates

func (*EmptyNodeConsolidation) ConsolidationType

func (c *EmptyNodeConsolidation) ConsolidationType() string

func (*EmptyNodeConsolidation) ShouldDisrupt

func (c *EmptyNodeConsolidation) ShouldDisrupt(_ context.Context, cn *Candidate) bool

ShouldDisrupt is a predicate used to filter candidates

func (*EmptyNodeConsolidation) Type

func (c *EmptyNodeConsolidation) Type() string

type Expiration

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

Expiration is a subreconciler that deletes empty candidates. 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 ...*Candidate) (Command, error)

ComputeCommand generates a disrpution command given candidates

func (*Expiration) ConsolidationType

func (e *Expiration) ConsolidationType() string

func (*Expiration) ShouldDisrupt

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

ShouldDisrupt is a predicate used to filter candidates

func (*Expiration) Type

func (e *Expiration) Type() string

type Method

type Method interface {
	ShouldDisrupt(context.Context, *Candidate) bool
	ComputeCommand(context.Context, ...*Candidate) (Command, error)
	Type() string
	ConsolidationType() string
}

type MultiNodeConsolidation

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

func NewMultiNodeConsolidation

func NewMultiNodeConsolidation(consolidation consolidation) *MultiNodeConsolidation

func (*MultiNodeConsolidation) ComputeCommand

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

func (*MultiNodeConsolidation) ConsolidationType

func (m *MultiNodeConsolidation) ConsolidationType() string

func (*MultiNodeConsolidation) ShouldDisrupt

func (c *MultiNodeConsolidation) ShouldDisrupt(_ context.Context, cn *Candidate) bool

ShouldDisrupt is a predicate used to filter candidates

func (*MultiNodeConsolidation) Type

func (m *MultiNodeConsolidation) Type() string

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(consolidation consolidation) *SingleNodeConsolidation

func (*SingleNodeConsolidation) ComputeCommand

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

ComputeCommand generates a disruption command given candidates nolint:gocyclo

func (*SingleNodeConsolidation) ConsolidationType

func (s *SingleNodeConsolidation) ConsolidationType() string

func (*SingleNodeConsolidation) ShouldDisrupt

func (c *SingleNodeConsolidation) ShouldDisrupt(_ context.Context, cn *Candidate) bool

ShouldDisrupt is a predicate used to filter candidates

func (*SingleNodeConsolidation) Type

func (s *SingleNodeConsolidation) Type() string

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, queue *orchestration.Queue) *Validation

func (*Validation) IsValid

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

func (*Validation) ShouldDisrupt

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

ShouldDisrupt is a predicate used to filter candidates

func (*Validation) ValidateCommand

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

ValidateCommand validates a command for a Method

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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