Documentation
¶
Index ¶
- Constants
- type Generator
- func (g *Generator) AddCreateContainerHook(hook rspec.Hook)
- func (g *Generator) AddCreateRuntimeHook(hook rspec.Hook)
- func (g *Generator) AddLinuxNetDevice(hostDev string, device *nri.LinuxNetDevice)
- func (g *Generator) AddStartContainerHook(hook rspec.Hook)
- func (g *Generator) Adjust(adjust *nri.ContainerAdjustment) error
- func (g *Generator) AdjustAnnotations(annotations map[string]string) error
- func (g *Generator) AdjustArgs(args []string)
- func (g *Generator) AdjustBlockIOClass(blockIOClass *string) error
- func (g *Generator) AdjustCgroupsPath(path string)
- func (g *Generator) AdjustDevices(devices []*nri.LinuxDevice)
- func (g *Generator) AdjustEnv(env []*nri.KeyValue)
- func (g *Generator) AdjustHooks(hooks *nri.Hooks)
- func (g *Generator) AdjustIOPriority(ioprio *nri.LinuxIOPriority)
- func (g *Generator) AdjustLinuxNetDevices(devices map[string]*nri.LinuxNetDevice) error
- func (g *Generator) AdjustLinuxScheduler(sch *nri.LinuxScheduler)
- func (g *Generator) AdjustMounts(mounts []*nri.Mount) error
- func (g *Generator) AdjustNamespaces(namespaces []*nri.LinuxNamespace) error
- func (g *Generator) AdjustOomScoreAdj(score *nri.OptionalInt)
- func (g *Generator) AdjustRdt(r *nri.LinuxRdt)
- func (g *Generator) AdjustRdtClass(rdtClass *string) error
- func (g *Generator) AdjustRdtClosID(value *string)
- func (g *Generator) AdjustRdtEnableMonitoring(value *bool)
- func (g *Generator) AdjustRdtSchemata(value *[]string)
- func (g *Generator) AdjustResources(r *nri.LinuxResources) error
- func (g *Generator) AdjustRlimits(rlimits []*nri.POSIXRlimit) error
- func (g *Generator) AdjustSeccompPolicy(policy *nri.LinuxSeccomp) error
- func (g *Generator) AdjustSysctl(sysctl map[string]string) error
- func (g *Generator) ClearLinuxIntelRdt()
- func (g *Generator) ClearLinuxResourcesBlockIO()
- func (g *Generator) InjectCDIDevices(devices []*nri.CDIDevice) error
- func (g *Generator) RemoveLinuxNetDevice(hostDev string)
- func (g *Generator) SetLinuxIntelRdt(rdt *rspec.LinuxIntelRdt)
- func (g *Generator) SetLinuxIntelRdtClosID(closID string)
- func (g *Generator) SetLinuxIntelRdtEnableMonitoring(value bool)
- func (g *Generator) SetLinuxIntelRdtSchemata(schemata []string)
- func (g *Generator) SetLinuxResourcesBlockIO(blockIO *rspec.LinuxBlockIO)
- func (g *Generator) SetLinuxResourcesPidsLimit(limit int64)
- func (g *Generator) SetProcessIOPriority(ioprio *rspec.LinuxIOPriority)
- type GeneratorOption
- func WithAnnotationFilter(fn func(map[string]string) (map[string]string, error)) GeneratorOption
- func WithBlockIOResolver(fn func(string) (*rspec.LinuxBlockIO, error)) GeneratorOption
- func WithCDIDeviceInjector(fn func(*rspec.Spec, []string) error) GeneratorOption
- func WithLabelFilter(fn func(map[string]string) (map[string]string, error)) GeneratorOption
- func WithRdtResolver(fn func(string) (*rspec.LinuxIntelRdt, error)) GeneratorOption
- func WithResourceChecker(fn func(*rspec.LinuxResources) error) GeneratorOption
- type UnderlyingGenerator
Constants ¶
const (
// UnlimitedPidsLimit indicates unlimited Linux PIDs limit.
UnlimitedPidsLimit = -1
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Generator ¶
type Generator struct {
UnderlyingGenerator
Config *rspec.Spec
// contains filtered or unexported fields
}
Generator extends a stock runtime-tools Generator and extends it with a few functions for handling NRI container adjustment.
func SpecGenerator ¶
func SpecGenerator(gg UnderlyingGenerator, opts ...GeneratorOption) *Generator
SpecGenerator returns a wrapped OCI Spec Generator.
func (*Generator) AddCreateContainerHook ¶
AddCreateContainerHook adds a hooks new CreateContainer hooks.
func (*Generator) AddCreateRuntimeHook ¶
AddCreateRuntimeHook adds a hooks new CreateRuntime hooks.
func (*Generator) AddLinuxNetDevice ¶ added in v0.11.0
func (g *Generator) AddLinuxNetDevice(hostDev string, device *nri.LinuxNetDevice)
AddLinuxNetDevice adds a new Linux net device.
func (*Generator) AddStartContainerHook ¶
AddStartContainerHook adds a hooks new StartContainer hooks.
func (*Generator) Adjust ¶
func (g *Generator) Adjust(adjust *nri.ContainerAdjustment) error
Adjust adjusts all aspects of the OCI Spec that NRI knows/cares about.
func (*Generator) AdjustAnnotations ¶
AdjustAnnotations adjusts the annotations in the OCI Spec.
func (*Generator) AdjustArgs ¶ added in v0.10.0
AdjustArgs adjusts the process arguments in the OCI Spec.
func (*Generator) AdjustBlockIOClass ¶
AdjustBlockIOClass adjusts the block I/O class in the OCI Spec.
func (*Generator) AdjustCgroupsPath ¶
AdjustCgroupsPath adjusts the cgroup pseudofs path in the OCI Spec.
func (*Generator) AdjustDevices ¶
func (g *Generator) AdjustDevices(devices []*nri.LinuxDevice)
AdjustDevices adjusts the (Linux) devices in the OCI Spec.
func (*Generator) AdjustHooks ¶
AdjustHooks adjusts the OCI hooks in the OCI Spec.
func (*Generator) AdjustIOPriority ¶ added in v0.10.0
func (g *Generator) AdjustIOPriority(ioprio *nri.LinuxIOPriority)
AdjustIOPriority adjusts the IO priority of the container.
func (*Generator) AdjustLinuxNetDevices ¶ added in v0.11.0
func (g *Generator) AdjustLinuxNetDevices(devices map[string]*nri.LinuxNetDevice) error
AdjustLinuxNetDevices adjusts the linux net devices in the OCI Spec.
func (*Generator) AdjustLinuxScheduler ¶ added in v0.11.0
func (g *Generator) AdjustLinuxScheduler(sch *nri.LinuxScheduler)
AdjustLinuxScheduler adjusts linux scheduling policy parameters.
func (*Generator) AdjustMounts ¶
AdjustMounts adjusts the mounts in the OCI Spec.
func (*Generator) AdjustNamespaces ¶ added in v0.10.0
func (g *Generator) AdjustNamespaces(namespaces []*nri.LinuxNamespace) error
AdjustNamespaces adds or replaces namespaces in the OCI Spec.
func (*Generator) AdjustOomScoreAdj ¶ added in v0.7.0
func (g *Generator) AdjustOomScoreAdj(score *nri.OptionalInt)
AdjustOomScoreAdj adjusts the kernel's Out-Of-Memory (OOM) killer score for the container. This may override kubelet's settings for OOM score.
func (*Generator) AdjustRdt ¶ added in v0.11.0
AdjustRdt adjusts the intelRdt object in the OCI Spec.
func (*Generator) AdjustRdtClass ¶
AdjustRdtClass adjusts the RDT class in the OCI Spec.
func (*Generator) AdjustRdtClosID ¶ added in v0.11.0
AdjustRdtClosID adjusts the RDT CLOS id in the OCI Spec.
func (*Generator) AdjustRdtEnableMonitoring ¶ added in v0.11.0
AdjustRdtEnableMonitoring adjusts the RDT monitoring in the OCI Spec.
func (*Generator) AdjustRdtSchemata ¶ added in v0.11.0
AdjustRdtSchemata adjusts the RDT schemata in the OCI Spec.
func (*Generator) AdjustResources ¶
func (g *Generator) AdjustResources(r *nri.LinuxResources) error
AdjustResources adjusts the (Linux) resources in the OCI Spec.
func (*Generator) AdjustRlimits ¶ added in v0.4.0
func (g *Generator) AdjustRlimits(rlimits []*nri.POSIXRlimit) error
AdjustRlimits adjusts the (Linux) POSIX resource limits in the OCI Spec.
func (*Generator) AdjustSeccompPolicy ¶ added in v0.10.0
func (g *Generator) AdjustSeccompPolicy(policy *nri.LinuxSeccomp) error
AdjustSeccompPolicy adjusts the seccomp policy for the container, which may override kubelet's settings for the seccomp policy.
func (*Generator) AdjustSysctl ¶ added in v0.11.0
AdjustSysctl adds, replaces, or removes the sysctl settings in the OCI Spec.
func (*Generator) ClearLinuxIntelRdt ¶
func (g *Generator) ClearLinuxIntelRdt()
ClearLinuxIntelRdt clears RDT CLOS.
func (*Generator) ClearLinuxResourcesBlockIO ¶
func (g *Generator) ClearLinuxResourcesBlockIO()
ClearLinuxResourcesBlockIO clears Block I/O settings.
func (*Generator) InjectCDIDevices ¶ added in v0.7.0
InjectCDIDevices injects the requested CDI devices into the OCI Spec. Devices are given by their fully qualified CDI device names. The actual device injection is done using a runtime-specific CDI injection function, set using the WithCDIDeviceInjector option.
func (*Generator) RemoveLinuxNetDevice ¶ added in v0.11.0
RemoveLinuxNetDevice removes a Linux net device.
func (*Generator) SetLinuxIntelRdt ¶
func (g *Generator) SetLinuxIntelRdt(rdt *rspec.LinuxIntelRdt)
SetLinuxIntelRdt sets RDT CLOS.
func (*Generator) SetLinuxIntelRdtClosID ¶ added in v0.11.0
SetLinuxIntelRdtClosID sets g.Config.Linux.IntelRdt.ClosID
func (*Generator) SetLinuxIntelRdtEnableMonitoring ¶ added in v0.11.0
SetLinuxIntelRdtEnableMonitoring sets g.Config.Linux.IntelRdt.EnableMonitoring
func (*Generator) SetLinuxIntelRdtSchemata ¶ added in v0.11.0
SetLinuxIntelRdtSchemata sets g.Config.Linux.IntelRdt.Schemata
func (*Generator) SetLinuxResourcesBlockIO ¶
func (g *Generator) SetLinuxResourcesBlockIO(blockIO *rspec.LinuxBlockIO)
SetLinuxResourcesBlockIO sets Block I/O settings.
func (*Generator) SetLinuxResourcesPidsLimit ¶ added in v0.11.0
SetLinuxResourcesPidsLimit sets Linux PID limit. Starting with v1.3.0 opencontainers/runtime-spec switched the PID limit to *int64 from int64 with nil meaning "unlimited". We don't want to change our API types though, so instead we use a dedicated value for unlimited.
func (*Generator) SetProcessIOPriority ¶ added in v0.10.0
func (g *Generator) SetProcessIOPriority(ioprio *rspec.LinuxIOPriority)
SetProcessIOPriority sets the (Linux) IO priority of the container.
type GeneratorOption ¶
type GeneratorOption func(*Generator)
GeneratorOption is an option for Generator().
func WithAnnotationFilter ¶
WithAnnotationFilter provides an option for filtering or rejecting annotations.
func WithBlockIOResolver ¶
func WithBlockIOResolver(fn func(string) (*rspec.LinuxBlockIO, error)) GeneratorOption
WithBlockIOResolver specifies a function for resolving Block I/O classes by name.
func WithCDIDeviceInjector ¶ added in v0.7.0
func WithCDIDeviceInjector(fn func(*rspec.Spec, []string) error) GeneratorOption
WithCDIDeviceInjector specifies a runtime-specific function to use for CDI device resolution and injection into an OCI Spec.
func WithLabelFilter ¶
WithLabelFilter provides an option for filtering or rejecting labels.
func WithRdtResolver ¶
func WithRdtResolver(fn func(string) (*rspec.LinuxIntelRdt, error)) GeneratorOption
WithRdtResolver specifies a function for resolving RDT classes by name.
func WithResourceChecker ¶
func WithResourceChecker(fn func(*rspec.LinuxResources) error) GeneratorOption
WithResourceChecker specifies a function to perform final resource adjustment.
type UnderlyingGenerator ¶ added in v0.11.0
type UnderlyingGenerator interface {
AddAnnotation(key, value string)
AddDevice(device rspec.LinuxDevice)
AddOrReplaceLinuxNamespace(ns string, path string) error
AddPostStartHook(postStartHook rspec.Hook)
AddPostStopHook(postStopHook rspec.Hook)
AddPreStartHook(preStartHook rspec.Hook)
AddProcessEnv(name, value string)
AddLinuxResourcesDevice(allow bool, devType string, major, minor *int64, access string)
AddLinuxResourcesHugepageLimit(pageSize string, limit uint64)
AddLinuxResourcesUnified(key, val string)
AddMount(mnt rspec.Mount)
AddLinuxSysctl(key, value string)
ClearMounts()
ClearProcessEnv()
Mounts() []rspec.Mount
RemoveAnnotation(key string)
RemoveDevice(path string)
RemoveLinuxNamespace(ns string) error
RemoveMount(dest string)
RemoveLinuxSysctl(key string)
SetProcessArgs(args []string)
SetLinuxCgroupsPath(path string)
SetLinuxResourcesCPUCpus(cpus string)
SetLinuxResourcesCPUMems(mems string)
SetLinuxResourcesCPUPeriod(period uint64)
SetLinuxResourcesCPUQuota(quota int64)
SetLinuxResourcesCPURealtimePeriod(period uint64)
SetLinuxResourcesCPURealtimeRuntime(time int64)
SetLinuxResourcesMemoryLimit(limit int64)
SetLinuxResourcesMemorySwap(swap int64)
SetLinuxRootPropagation(rp string) error
SetProcessOOMScoreAdj(adj int)
Spec() *rspec.Spec
}
UnderlyingGenerator is the interface for github.com/opencontainers/runtime-tools/generate.Generator.