Documentation
¶
Index ¶
- Constants
- func AuditUnavailableSlots(ctx context.Context, statusWriter client.Client, apiReader client.Reader, ...) (bool, error)
- func EventIsForThisNode(meta v1.Object) bool
- func FilterReady(nodes []corev1.Node) []corev1.Node
- func MaxUnavailableNodeCount(ctx context.Context, cli client.Reader, ...) (int, error)
- func NetworkStateRefreshWithJitter() time.Duration
- func NodesRunningNmstate(ctx context.Context, cli client.Reader, nodeSelector map[string]string) ([]corev1.Node, error)
- func ScaledMaxUnavailableNodeCount(matchingNodes int, intOrPercent intstr.IntOrString) (int, error)
- func StaleEnactmentThreshold() time.Duration
- type InvalidMaxUnavailableError
- type MaxUnavailableLimitReachedError
Constants ¶
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 )
const ( )
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
Return true if the event name is the name of the pods's node (reading the env var NODE_NAME)
func MaxUnavailableNodeCount ¶ added in v0.44.0
func NetworkStateRefreshWithJitter ¶ added in v0.37.4
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 ScaledMaxUnavailableNodeCount ¶ added in v0.44.0
func ScaledMaxUnavailableNodeCount(matchingNodes int, intOrPercent intstr.IntOrString) (int, error)
func StaleEnactmentThreshold ¶ added in v0.87.1
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
func (e InvalidMaxUnavailableError) Error() string
type MaxUnavailableLimitReachedError ¶ added in v0.52.12
type MaxUnavailableLimitReachedError struct{}
func (MaxUnavailableLimitReachedError) Error ¶ added in v0.52.12
func (f MaxUnavailableLimitReachedError) Error() string