Documentation
¶
Index ¶
- func GetPodEvictionCost(ctx context.Context, p *v1.Pod) float64
- func PodsPreventEviction(pods []*v1.Pod) (string, bool)
- type CandidateFilter
- type CandidateNode
- type Command
- type Controller
- type Deprovisioner
- type Drift
- type Emptiness
- type EmptyNodeConsolidation
- func (c *EmptyNodeConsolidation) ComputeCommand(ctx context.Context, candidates ...CandidateNode) (Command, error)
- func (c *EmptyNodeConsolidation) RecordLastState(currentState int64)
- func (c *EmptyNodeConsolidation) ShouldAttemptConsolidation() bool
- func (c *EmptyNodeConsolidation) ShouldDeprovision(ctx context.Context, n *state.Node, provisioner *v1alpha5.Provisioner, ...) bool
- func (c *EmptyNodeConsolidation) String() string
- func (c *EmptyNodeConsolidation) ValidateCommand(ctx context.Context, cmd Command, candidateNodes []CandidateNode) (bool, error)
- type Expiration
- func (e *Expiration) ComputeCommand(ctx context.Context, candidates ...CandidateNode) (Command, error)
- func (e *Expiration) ShouldDeprovision(ctx context.Context, n *state.Node, provisioner *v1alpha5.Provisioner, ...) bool
- func (e *Expiration) SortCandidates(nodes []CandidateNode) []CandidateNode
- func (e *Expiration) String() string
- type MultiNodeConsolidation
- func (m *MultiNodeConsolidation) ComputeCommand(ctx context.Context, candidates ...CandidateNode) (Command, error)
- func (c *MultiNodeConsolidation) RecordLastState(currentState int64)
- func (c *MultiNodeConsolidation) ShouldAttemptConsolidation() bool
- func (c *MultiNodeConsolidation) ShouldDeprovision(ctx context.Context, n *state.Node, provisioner *v1alpha5.Provisioner, ...) bool
- func (c *MultiNodeConsolidation) String() string
- func (c *MultiNodeConsolidation) ValidateCommand(ctx context.Context, cmd Command, candidateNodes []CandidateNode) (bool, error)
- type PDBLimits
- type Reporter
- type Result
- type SingleNodeConsolidation
- func (c *SingleNodeConsolidation) ComputeCommand(ctx context.Context, candidates ...CandidateNode) (Command, error)
- func (c *SingleNodeConsolidation) RecordLastState(currentState int64)
- func (c *SingleNodeConsolidation) ShouldAttemptConsolidation() bool
- func (c *SingleNodeConsolidation) ShouldDeprovision(ctx context.Context, n *state.Node, provisioner *v1alpha5.Provisioner, ...) bool
- func (c *SingleNodeConsolidation) String() string
- func (c *SingleNodeConsolidation) ValidateCommand(ctx context.Context, cmd Command, candidateNodes []CandidateNode) (bool, error)
- type Validation
- func (v *Validation) IsValid(ctx context.Context, cmd Command) (bool, error)
- func (v *Validation) ShouldDeprovision(_ context.Context, n *state.Node, provisioner *v1alpha5.Provisioner, ...) bool
- func (v *Validation) ValidateCommand(ctx context.Context, cmd Command, candidateNodes []CandidateNode) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetPodEvictionCost ¶
GetPodEvictionCost returns the disruption cost computed for evicting the given pod.
Types ¶
type CandidateFilter ¶
type CandidateNode ¶
CandidateNode is a node that we are considering for deprovisioning along with extra information to be used in making that determination
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 (c *Controller) Builder(_ context.Context, m manager.Manager) controller.Builder
func (*Controller) Name ¶
func (c *Controller) Name() string
func (*Controller) ProcessCluster ¶
func (c *Controller) ProcessCluster(ctx context.Context) (Result, error)
ProcessCluster is exposed for unit testing purposes ProcessCluster loops through implemented deprovisioners
type Deprovisioner ¶
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) *Drift
func (*Drift) ComputeCommand ¶
ComputeCommand generates a deprovisioning command given deprovisionable nodes
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 (*Emptiness) ComputeCommand ¶
ComputeCommand generates a deprovisioning command given deprovisionable nodes
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, reporter *Reporter) *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) RecordLastState ¶
func (c *EmptyNodeConsolidation) RecordLastState(currentState int64)
RecordLastState is used to record the last state that the consolidation implementation failed to work in to allow skipping future consolidation attempts until the state changes.
func (*EmptyNodeConsolidation) ShouldAttemptConsolidation ¶
func (c *EmptyNodeConsolidation) ShouldAttemptConsolidation() bool
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) *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, reporter *Reporter) *MultiNodeConsolidation
func (*MultiNodeConsolidation) ComputeCommand ¶
func (m *MultiNodeConsolidation) ComputeCommand(ctx context.Context, candidates ...CandidateNode) (Command, error)
func (*MultiNodeConsolidation) RecordLastState ¶
func (c *MultiNodeConsolidation) RecordLastState(currentState int64)
RecordLastState is used to record the last state that the consolidation implementation failed to work in to allow skipping future consolidation attempts until the state changes.
func (*MultiNodeConsolidation) ShouldAttemptConsolidation ¶
func (c *MultiNodeConsolidation) ShouldAttemptConsolidation() bool
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 ¶
type Reporter ¶
type Reporter struct {
// contains filtered or unexported fields
}
Reporter is used to periodically report node statuses regarding deprovisioning. This gives observers awareness of why deprovisioning of a particular node isn't occurring.
func NewReporter ¶
type Result ¶
type Result byte
Result is used to indicate the action of consolidating so we can optimize by not trying to consolidate if we were unable to consolidate the cluster and it hasn't changed state with respect to pods/nodes.
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, reporter *Reporter) *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) RecordLastState ¶
func (c *SingleNodeConsolidation) RecordLastState(currentState int64)
RecordLastState is used to record the last state that the consolidation implementation failed to work in to allow skipping future consolidation attempts until the state changes.
func (*SingleNodeConsolidation) ShouldAttemptConsolidation ¶
func (c *SingleNodeConsolidation) ShouldAttemptConsolidation() bool
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) 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