cri: annotations for controlling RDT class

Use goresctrl for parsing container and pod annotations related to RDT.

In practice, from the users' point of view, this patchs adds support for
a container annotation and two separate pod annotations for controlling
the RDT class of containers.

Container annotation can be used by a CRI client:
  "io.kubernetes.cri.rdt-class"

Pod annotations for specifying the RDT class in the K8s pod spec level:
  "rdt.resources.beta.kubernetes.io/pod"
  (pod-wide default for all containers within)

  "rdt.resources.beta.kubernetes.io/container.<container_name>"
  (container-specific overrides)

Annotations are intended as an intermediate step before the CRI API
supports RDT.

Signed-off-by: Markus Lehtonen <markus.lehtonen@intel.com>
This commit is contained in:
Markus Lehtonen
2021-11-03 20:53:33 +02:00
parent eae14688c6
commit f4a191917b
4 changed files with 79 additions and 0 deletions

View File

@@ -31,7 +31,13 @@ const (
ResctrlPrefix = ""
)
var rdtEnabled bool
func RdtEnabled() bool { return rdtEnabled }
func initRdt(configFilePath string) error {
rdtEnabled = false
if configFilePath == "" {
log.L.Debug("No RDT config file specified, RDT not configured")
return nil
@@ -45,6 +51,8 @@ func initRdt(configFilePath string) error {
return err
}
rdtEnabled = true
return nil
}