armnotify

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package armnotify carries the arming verdict for a claimed sandbox from the post-start hook runner to the create request waiting on it.

Both live in the same process — cmd/sandbox runs the controller manager and the API server together — so this is a channel handoff, not a distributed problem. The alternative was to record the verdict on the Pod and have the create path watch for it, which spends one API-server write per sandbox, fanned out to every Pod informer in the cluster, to move a fact between two goroutines that already share an address space.

The registry is deliberately not a cache: an entry exists only while someone is waiting for it, and a verdict with no waiter is dropped. Nothing here is state, so nothing here needs cleaning up on restart.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Registry

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

Registry routes arming verdicts to the goroutine waiting for them.

func New

func New() *Registry

New returns an empty Registry.

func (*Registry) Notify

func (r *Registry) Notify(sandboxID string, err error)

Notify delivers a verdict. err nil means the sandbox is armed.

A verdict for a sandbox nobody is waiting on is dropped, which is the normal case for the re-arm that follows a configuration change: that work has no requester.

func (*Registry) Wait

func (r *Registry) Wait(sandboxID string) (<-chan error, func())

Wait registers interest in a sandbox's arming verdict and returns the channel it will arrive on, plus a cancel function the caller must defer.

Register before the work can start, not after: a verdict that arrives while no waiter is registered is dropped, and the caller would then wait for one that has already been delivered.

A second Wait for the same sandbox replaces the first, and the displaced waiter is failed rather than left hanging: one request claims one sandbox, so this cannot happen for a live claim, but a waiter that can never be notified would block for its whole deadline if it ever did.

func (*Registry) Waiting

func (r *Registry) Waiting() int

Waiting reports how many sandboxes currently have someone waiting on them. Used by tests and by the metric that would reveal a leak.

Jump to

Keyboard shortcuts

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