node

package
v0.0.0-...-6018a90 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 15 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateConfigsForEachLatencyProfile

func GenerateConfigsForEachLatencyProfile(latencyConfigs []LatencyConfigProfileTuple) (profileConfigs map[configv1.WorkerLatencyProfileType]map[string]interface{}, err error)

GenerateConfigsForEachLatencyProfile is used to generate config for each latency profile using known arg val pairs provided in latencyConfigs

func GetUsedLatencyConfigPaths

func GetUsedLatencyConfigPaths(latencyConfigs []LatencyConfigProfileTuple) [][]string

GetUsedLatencyConfigPaths is used to get list of config paths that were used for latency profiles

func IsDayZero

func IsDayZero(currentRevisions []int32) bool

IsDayZero returns true when currentRevisions is empty or when all current revision equal to 0

func NewLatencyProfileObserver

func NewLatencyProfileObserver(latencyConfigs []LatencyConfigProfileTuple, shouldSuppressConfigUpdatesFuncs []ShouldSuppressConfigUpdatesFunc) configobserver.ObserveConfigFunc

NewLatencyProfileObserver is used to create ObserveConfigFunc that can be used with an configobservation controller to trigger changes to different arg val pairs in observedConfig.* fields and update them on the basis of current worker latency profile. ShouldSuppressConfigUpdatesFunc is used to pass a function that returns a boolean and config updates by the observer function are only passed iff the bool value is false, it is helpful to gate the config updates in case a pre-req condition is not satisfied.

func ShouldRejectProfileTransition

func ShouldRejectProfileTransition(
	fromLatencyConfig map[string]interface{}, toProfile configv1.WorkerLatencyProfileType,
	knownProfileConfigs map[configv1.WorkerLatencyProfileType]map[string]interface{},
	profileRejectionScenarios []LatencyProfileRejectionScenario,
) (isRejected bool, fromProfile configv1.WorkerLatencyProfileType)

ShouldRejectProfileTransition is used to determine the profile passed in fromLatencyConfig (fromLatencyConfig should be config that already has only usedLatencyConfigPaths pruned) and in case the transition fromProfile -> toProfile is one of the rejected scenarios, reject it i.e. isRejected flag will be true

Types

type LatencyConfigProfileTuple

type LatencyConfigProfileTuple struct {
	// path to required argument in observed config
	// eg. extendedArguments.node-monitor-grace-period from observed config
	// is []string{"extendedArguments", "node-monitor-grace-period"}
	ConfigPath          []string
	ProfileConfigValues map[configv1.WorkerLatencyProfileType]string
}

LatencyConfigProfileTuple is used to set arg value pairs for each worker latency profile

type LatencyProfileRejectionScenario

type LatencyProfileRejectionScenario struct {
	FromProfile configv1.WorkerLatencyProfileType
	ToProfile   configv1.WorkerLatencyProfileType
}

LatencyProfileRejectionScenario is used to describe a scenario from and to a profile type when updates should be rejected in favour of cluster stability

type NodeLister

type NodeLister interface {
	NodeLister() configlistersv1.NodeLister
}

type ShouldSuppressConfigUpdatesFunc

type ShouldSuppressConfigUpdatesFunc func() (suppress bool, reason string, err error)

func NewSuppressConfigUpdateForExtremeProfilesFunc

func NewSuppressConfigUpdateForExtremeProfilesFunc(
	operatorClient v1helpers.StaticPodOperatorClient,
	configNodeLister configlistersv1.NodeLister,
	latencyConfigs []LatencyConfigProfileTuple,
	rejectionScenarios []LatencyProfileRejectionScenario,
) (ShouldSuppressConfigUpdatesFunc, error)

NewSuppressConfigUpdateForExtremeProfilesFunc is used to create a conditional func (ShouldSuppressConfigUpdatesFunc) that can be used by the latency profile config observer to determine if a new update to observedConfig should be rolled out or not. It checks the current value of observedConfig from operator's state (static pod operator resource), tries to determine the latency profile that was applied by the config observer and compares the same against the desired profile set on the cluster. In case, the update from the active profile to the desired profile is an extreme scenario i.e. one of the scenarios specified in rejectionScenarios, the suppressor suppresses the update.

func NewSuppressConfigUpdateUntilSameProfileFunc

func NewSuppressConfigUpdateUntilSameProfileFunc(
	operatorClient v1helpers.StaticPodOperatorClient,
	configMapLister listersv1.ConfigMapNamespaceLister,
	latencyConfigs []LatencyConfigProfileTuple,
) ShouldSuppressConfigUpdatesFunc

NewSuppressConfigUpdateUntilSameProfileFunc is used to create a conditional func (ShouldSuppressConfigUpdatesFunc) that can be used by the latency profile config observer to determine if a new update to observedConfig should be rolled out or not. It uses a config map lister and status obtained from a static pod operator client to check if all active revisions on the cluster have common values for the required latency config paths or not. Config maps generated by installer controller are read in order to determine the current active static pod revision and compare observedConfig values from it.

Jump to

Keyboard shortcuts

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