node

package
v0.87.3 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: Apache-2.0 Imports: 20 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// DefaultStaleEnactmentThreshold is how old a Progressing enactment's
	// heartbeat must be before the audit considers its holder dead. It must
	// exceed the worst-case apply cycle (worstCaseApplyCycle) with margin;
	// otherwise the audit could classify a node that is still legitimately
	// applying as stale, free its slot, and let more than maxUnavailable
	// nodes reconfigure concurrently. The extra margin absorbs the gap
	// between stamping the heartbeat and entering the apply, plus clock skew.
	DefaultStaleEnactmentThreshold = worstCaseApplyCycle + 5*time.Minute

	// StaleEnactmentThresholdEnvVar overrides DefaultStaleEnactmentThreshold
	// (time.ParseDuration format, e.g. "1h").
	StaleEnactmentThresholdEnvVar = "NMSTATE_ENACTMENT_STALE_THRESHOLD"

	// AuditGraceWindow: if LastUnavailableNodeCountUpdate is younger than
	// this, the audit defers. A legitimate incrementer's NotifyProgressing
	// write may still be in flight; ghost slots are by definition old.
	AuditGraceWindow = 30 * time.Second
)
View Source
const (
	DefaultMaxunavailable = "50%"
	MinMaxunavailable     = 1
)
View Source
const (
	NetworkStateRefresh          = time.Minute
	NetworkStateRefreshMaxFactor = 0.1
)

Variables

This section is empty.

Functions

func AuditUnavailableSlots added in v0.87.1

func AuditUnavailableSlots(
	ctx context.Context,
	statusWriter client.Client,
	apiReader client.Reader,
	policyKey types.NamespacedName,
	staleThreshold time.Duration,
) (bool, error)

AuditUnavailableSlots recomputes UnavailableNodeCountMap[currentGeneration] from enactments and repairs it downward if it exceeds the number of slot holders (see countSlotHolders). Returns true if a repair was written.

The repair is set-to-truth (never a blind decrement), so concurrent audits from multiple nodes are idempotent. The count is never raised.

func EventIsForThisNode added in v0.75.0

func EventIsForThisNode(meta v1.Object) bool

Return true if the event name is the name of the pods's node (reading the env var NODE_NAME)

func FilterReady added in v0.64.7

func FilterReady(nodes []corev1.Node) []corev1.Node

func MaxUnavailableNodeCount added in v0.44.0

func MaxUnavailableNodeCount(ctx context.Context, cli client.Reader, policy *nmstatev1.NodeNetworkConfigurationPolicy) (int, error)

func NetworkStateRefreshWithJitter added in v0.37.4

func NetworkStateRefreshWithJitter() time.Duration

NodeNetworkStateRefreshWithJitter add some jitter to to the refresh rate so it does not hit apiserver at the same time.

func NodesRunningNmstate added in v0.44.0

func NodesRunningNmstate(ctx context.Context, cli client.Reader, nodeSelector map[string]string) ([]corev1.Node, error)

func ScaledMaxUnavailableNodeCount added in v0.44.0

func ScaledMaxUnavailableNodeCount(matchingNodes int, intOrPercent intstr.IntOrString) (int, error)

func StaleEnactmentThreshold added in v0.87.1

func StaleEnactmentThreshold() time.Duration

StaleEnactmentThreshold returns the configured staleness threshold. An override is honored only if it still exceeds the worst-case apply cycle; an equal or smaller value would let the audit free a slot held by a node that is still legitimately applying (a holder is stale once its heartbeat age reaches the threshold) and break maxUnavailable, so it is rejected in favor of the safe default.

Types

type InvalidMaxUnavailableError added in v0.87.1

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

InvalidMaxUnavailableError indicates that a policy's maxUnavailable resolves to a non-positive number of nodes. This should normally be rejected at admission time by the CRD CEL rule, but it can still be observed for policies persisted before the CRD was upgraded. It is a terminal validation error: reconciliation must fail the enactment rather than retry, since the value can only be fixed by editing the policy.

func (InvalidMaxUnavailableError) Error added in v0.87.1

type MaxUnavailableLimitReachedError added in v0.52.12

type MaxUnavailableLimitReachedError struct{}

func (MaxUnavailableLimitReachedError) Error added in v0.52.12

Jump to

Keyboard shortcuts

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