Skip to content

Commit a7832a2

Browse files
committed
api: add rdt
Add new message for directly managing the linux.intelRdt object of the runtime-spec. NOTE: the old RdtClass field resides under LinuxResources message but the IntelRdt message is sepate from LinuxResources. This is to maintain parity with the OCI runtime-spec. It is also much more logical because the LinuxResources message is used in many places (like pod overhead, update resources etc) where the RDT fields don't make sense or cannot be applied. Also note that the Rdt object cannot be modified on container update (missing from UpdateContainerRequest) as this functionality is missing from the runtime spec and runtimes (runc/crun). Signed-off-by: Markus Lehtonen <[email protected]>
1 parent dc0990d commit a7832a2

8 files changed

Lines changed: 1349 additions & 760 deletions

File tree

pkg/api/adjustment.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,24 @@ func (a *ContainerAdjustment) SetLinuxRDTClass(value string) {
298298
a.Linux.Resources.RdtClass = String(value)
299299
}
300300

301+
// SetLinuxRDTClosID records setting the RDT CLOS id for a container.
302+
func (a *ContainerAdjustment) SetLinuxRDTClosID(value string) {
303+
a.initLinuxRdt()
304+
a.Linux.Rdt.ClosId = String(value)
305+
}
306+
307+
// SetLinuxRDTSchemata records setting the RDT schemata for a container.
308+
func (a *ContainerAdjustment) SetLinuxRDTSchemata(value []string) {
309+
a.initLinuxRdt()
310+
a.Linux.Rdt.Schemata = RepeatedString(value)
311+
}
312+
313+
// SetLinuxRDTEnableMonitoring records enabling RDT monitoring for a container.
314+
func (a *ContainerAdjustment) SetLinuxRDTEnableMonitoring(value bool) {
315+
a.initLinuxRdt()
316+
a.Linux.Rdt.EnableMonitoring = Bool(value)
317+
}
318+
301319
// AddLinuxUnified sets a cgroupv2 unified resource.
302320
func (a *ContainerAdjustment) AddLinuxUnified(key, value string) {
303321
a.initLinuxResourcesUnified()
@@ -419,3 +437,10 @@ func (a *ContainerAdjustment) initLinuxNetDevices() {
419437
a.Linux.NetDevices = make(map[string]*LinuxNetDevice)
420438
}
421439
}
440+
441+
func (a *ContainerAdjustment) initLinuxRdt() {
442+
a.initLinux()
443+
if a.Linux.Rdt == nil {
444+
a.Linux.Rdt = &LinuxRdt{}
445+
}
446+
}

0 commit comments

Comments
 (0)