Documentation
¶
Index ¶
- Constants
- func RestoreIrqBalanceConfig(ctx context.Context, ...) error
- type CommandRunner
- type CompositeHooks
- func (c *CompositeHooks) PostStop(ctx context.Context, cont *oci.Container, s *sandbox.Sandbox) error
- func (c *CompositeHooks) PreCreate(ctx context.Context, specgen *generate.Generator, s *sandbox.Sandbox, ...) error
- func (c *CompositeHooks) PreStart(ctx context.Context, cont *oci.Container, s *sandbox.Sandbox) error
- func (c *CompositeHooks) PreStop(ctx context.Context, cont *oci.Container, s *sandbox.Sandbox) error
- type DefaultCPULoadBalanceHooks
- func (d *DefaultCPULoadBalanceHooks) PostStop(ctx context.Context, c *oci.Container, s *sandbox.Sandbox) error
- func (*DefaultCPULoadBalanceHooks) PreCreate(context.Context, *generate.Generator, *sandbox.Sandbox, *oci.Container) error
- func (*DefaultCPULoadBalanceHooks) PreStart(context.Context, *oci.Container, *sandbox.Sandbox) error
- func (*DefaultCPULoadBalanceHooks) PreStop(context.Context, *oci.Container, *sandbox.Sandbox) error
- type GomaxprocsHooks
- func (*GomaxprocsHooks) PostStop(context.Context, *oci.Container, *sandbox.Sandbox) error
- func (g *GomaxprocsHooks) PreCreate(ctx context.Context, specgen *generate.Generator, s *sandbox.Sandbox, ...) error
- func (*GomaxprocsHooks) PreStart(context.Context, *oci.Container, *sandbox.Sandbox) error
- func (*GomaxprocsHooks) PreStop(context.Context, *oci.Container, *sandbox.Sandbox) error
- type HighPerformanceHook
- type HighPerformanceHooks
- func (h *HighPerformanceHooks) PostStop(ctx context.Context, c *oci.Container, s *sandbox.Sandbox) error
- func (h *HighPerformanceHooks) PreCreate(ctx context.Context, specgen *generate.Generator, s *sandbox.Sandbox, ...) error
- func (h *HighPerformanceHooks) PreStart(ctx context.Context, c *oci.Container, s *sandbox.Sandbox) error
- func (h *HighPerformanceHooks) PreStop(ctx context.Context, c *oci.Container, s *sandbox.Sandbox) error
- type HooksRetriever
- type RuntimeHandlerHooks
- type ServiceManager
Constants ¶
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" )
const ( IsolatedCPUsEnvVar = "OPENSHIFT_ISOLATED_CPUS" HousekeepingCPUsEnvVar = "OPENSHIFT_HOUSEKEEPING_CPUS" )
Variables ¶
This section is empty.
Functions ¶
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.
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) PreCreate ¶ added in v1.28.4
func (*DefaultCPULoadBalanceHooks) PreCreate(context.Context, *generate.Generator, *sandbox.Sandbox, *oci.Container) error
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.
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
func (h *HighPerformanceHooks) PostStop(ctx context.Context, c *oci.Container, s *sandbox.Sandbox) error
If CPU load balancing is enabled, then *all* containers must run this PostStop hook.
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
}