labeling

package
v0.7.0 Latest Latest
Warning

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

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

Documentation

Overview

Package labeling provides the labeling strategy. Violation conditions and enforcement behavior are defined here. When a node is violating the labeling strategy, the enforcer labels it as violating according to the policy label. This label can then be used externally to act on the strategy violation.

Index

Constants

View Source
const (
	StrategyType = "labeling"
)

StrategyType is set to "labeling".

Variables

This section is empty.

Functions

This section is empty.

Types

type Strategy

type Strategy telempol.TASPolicyStrategy

Strategy type for labeling from a single policy.

func (*Strategy) Cleanup

func (d *Strategy) Cleanup(enforcer *strategy.MetricEnforcer, policyName string) error

Cleanup remove node labels for violating when policy is deleted.

func (*Strategy) Enforce

func (d *Strategy) Enforce(enforcer *strategy.MetricEnforcer, cache cache.Reader) (int, error)

Enforce describes the behavior followed by this strategy to return associated pods to non-violating status. The labels can be used externally for different purposes, e.g. by a descheduler. Here we make an api call to list all nodes first. This may be improved by using a controller instead or some other way of not waiting for the API call every time Enforce is called.

func (*Strategy) Equals

func (d *Strategy) Equals(other core.Interface) bool

Equals checks if a strategy is the same as the passed strategy. It can be used to prevent duplication of strategies in the API and is also used to find strategies for deletion. TODO: Remedial action if equal, i.e. point to other strategies. Make method order ambivalent.

func (*Strategy) GetPolicyName

func (d *Strategy) GetPolicyName() string

GetPolicyName returns the name of the policy that originated strategy.

func (*Strategy) SetPolicyName

func (d *Strategy) SetPolicyName(name string)

SetPolicyName adds a policy name to be associated with this strategy.

func (*Strategy) StrategyType

func (d *Strategy) StrategyType() string

StrategyType returns the name of the strategy type. This is used to place it in the registry.

func (*Strategy) Violated

func (d *Strategy) Violated(cache cache.Reader) map[string]interface{}

Violated checks if the strategy is violated by searching for nodes that have metrics that don't accord with the target in labeling strategy. Returns a map of nodeNames as key with a slice of violated rules and metric quantities in the result type.

Jump to

Keyboard shortcuts

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