runtimehandlerhooks

package
v1.35.3 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// HighPerformance contains the high-performance runtime handler name.
	HighPerformance = "high-performance"
	// IrqSmpAffinityProcFile contains the default smp affinity mask configuration.
	IrqSmpAffinityProcFile = "/proc/irq/default_smp_affinity"
)
View Source
const (
	IsolatedCPUsEnvVar     = "OPENSHIFT_ISOLATED_CPUS"
	SharedCPUsEnvVar       = "OPENSHIFT_SHARED_CPUS"
	HousekeepingCPUsEnvVar = "OPENSHIFT_HOUSEKEEPING_CPUS"
)

Variables

This section is empty.

Functions

func RestoreIrqBalanceConfig added in v1.20.2

func RestoreIrqBalanceConfig(ctx context.Context, irqBalanceConfigFile, irqBannedCPUConfigFile, irqSmpAffinityProcFile string) error

RestoreIrqBalanceConfig restores irqbalance service with original banned cpu mask settings.

Types

type CommandRunner added in v1.33.9

type CommandRunner interface {
	LookPath(file string) (string, error)
	RunCommand(name string, env []string, arg ...string) error
}

CommandRunner interface for running external commands.

type CompositeHooks added in v1.33.12

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

CompositeHooks chains multiple RuntimeHandlerHooks implementations. Each hook method is called in order; if any returns an error, execution stops.

This exists because HooksRetriever.Get() returns a single RuntimeHandlerHooks. When a pod needs multiple hooks (e.g. a burstable pod on a high-performance runtime handler needs both HighPerformanceHooks and GomaxprocsHooks), CompositeHooks wraps them so Get() can still return one interface. When only one hook applies, Get() returns it directly without wrapping.

func (*CompositeHooks) PostStop added in v1.33.12

func (c *CompositeHooks) PostStop(ctx context.Context, cont *oci.Container, s *sandbox.Sandbox) error

func (*CompositeHooks) PreCreate added in v1.33.12

func (c *CompositeHooks) PreCreate(ctx context.Context, specgen *generate.Generator, s *sandbox.Sandbox, cont *oci.Container) error

func (*CompositeHooks) PreStart added in v1.33.12

func (c *CompositeHooks) PreStart(ctx context.Context, cont *oci.Container, s *sandbox.Sandbox) error

func (*CompositeHooks) PreStop added in v1.33.12

func (c *CompositeHooks) PreStop(ctx context.Context, cont *oci.Container, s *sandbox.Sandbox) error

type DefaultCPULoadBalanceHooks added in v1.26.4

type DefaultCPULoadBalanceHooks struct {
	cgmgr.CgroupManager
}

DefaultCPULoadBalanceHooks is used to run additional hooks that will configure containers for CPU load balancing. Specifically, it will define a PostStop that disables `cpuset.sched_load_balance` for a recently stopped container. This must be done because guaranteed pods with exclusive cpu access may be created after other containers are terminated, but before their cgroup is cleaned up. In this case, cpumanager will not load balancing the exclusive CPUs away from those pods, thus causing their `cpuset.sched_load_balance=1` to prevent the kernel from disabling load balancing. This is the only case it seeks to fix, and thus does not define any other members of the RuntimeHandlerHooks functions.

func (*DefaultCPULoadBalanceHooks) PostStop added in v1.26.4

func (*DefaultCPULoadBalanceHooks) PreCreate added in v1.28.4

No-op.

func (*DefaultCPULoadBalanceHooks) PreStart added in v1.26.4

No-op.

func (*DefaultCPULoadBalanceHooks) PreStop added in v1.26.4

No-op.

type GomaxprocsHooks added in v1.33.12

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

GomaxprocsHooks injects the GOMAXPROCS environment variable into containers for burstable and best-effort pods. The fallback value acts as a minimum floor; for burstable pods with a CPU request, GOMAXPROCS is auto-calculated from the request's CPU shares and only used if it exceeds the floor.

func (*GomaxprocsHooks) PostStop added in v1.33.12

No-op.

func (*GomaxprocsHooks) PreCreate added in v1.33.12

func (g *GomaxprocsHooks) PreCreate(ctx context.Context, specgen *generate.Generator, s *sandbox.Sandbox, c *oci.Container) error

func (*GomaxprocsHooks) PreStart added in v1.33.12

No-op.

func (*GomaxprocsHooks) PreStop added in v1.33.12

No-op.

type HighPerformanceHook added in v1.28.3

type HighPerformanceHook interface {
	RuntimeHandlerHooks
}

type HighPerformanceHooks

type HighPerformanceHooks struct {
	cgmgr.CgroupManager
	// contains filtered or unexported fields
}

HighPerformanceHooks used to run additional hooks that will configure a system for the latency sensitive workloads.

func (*HighPerformanceHooks) PostStop added in v1.26.4

If CPU load balancing is enabled, then *all* containers must run this PostStop hook.

func (*HighPerformanceHooks) PreCreate added in v1.28.4

func (*HighPerformanceHooks) PreStart

func (*HighPerformanceHooks) PreStop

type HooksRetriever added in v1.33.3

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

HooksRetriever allows retrieving the runtime hooks for a given sandbox.

func NewHooksRetriever added in v1.33.3

func NewHooksRetriever(ctx context.Context, config *libconfig.Config) *HooksRetriever

NewHooksRetriever returns a pointer to a new retriever. Log a warning if deprecated configuration is detected.

func (*HooksRetriever) Get added in v1.33.3

func (hr *HooksRetriever) Get(ctx context.Context, runtimeName string, sandboxAnnotations map[string]string) RuntimeHandlerHooks

Get checks runtime name or the sandbox's annotations for allowed high performance annotations and the config for GOMAXPROCS injection. It returns a single hook, a CompositeHooks chain, or nil.

type RuntimeHandlerHooks

type RuntimeHandlerHooks interface {
	PreCreate(ctx context.Context, specgen *generate.Generator, s *sandbox.Sandbox, c *oci.Container) error
	PreStart(ctx context.Context, c *oci.Container, s *sandbox.Sandbox) error
	PreStop(ctx context.Context, c *oci.Container, s *sandbox.Sandbox) error
	PostStop(ctx context.Context, c *oci.Container, s *sandbox.Sandbox) error
}

type ServiceManager added in v1.33.9

type ServiceManager interface {
	IsServiceEnabled(serviceName string) bool
	RestartService(serviceName string) error
}

ServiceManager interface for managing system services.

Jump to

Keyboard shortcuts

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