Merge pull request #6514 from marquiz/fixes/rdt

This commit is contained in:
Fu Wei 2022-02-08 09:31:49 +08:00 committed by GitHub
commit 6a628b64ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -31,17 +31,21 @@ import (
// container and returns its effective RDT class. // container and returns its effective RDT class.
func (c *criService) rdtClassFromAnnotations(containerName string, containerAnnotations, podAnnotations map[string]string) (string, error) { func (c *criService) rdtClassFromAnnotations(containerName string, containerAnnotations, podAnnotations map[string]string) (string, error) {
cls, err := rdt.ContainerClassFromAnnotations(containerName, containerAnnotations, podAnnotations) cls, err := rdt.ContainerClassFromAnnotations(containerName, containerAnnotations, podAnnotations)
if err == nil {
// Our internal check that RDT has been enabled
if cls != "" && !tasks.RdtEnabled() {
err = fmt.Errorf("RDT disabled, refusing to set RDT class of container %q to %q", containerName, cls)
}
}
if err != nil { if err != nil {
if !tasks.RdtEnabled() && c.config.ContainerdConfig.IgnoreRdtNotEnabledErrors {
logrus.Debugf("continuing create container %s, ignoring rdt not enabled (%v)", containerName, err)
return "", nil
}
return "", err return "", err
} }
if cls != "" && !tasks.RdtEnabled() {
if c.config.ContainerdConfig.IgnoreRdtNotEnabledErrors {
cls = ""
logrus.Debugf("continuing create container %s, ignoring rdt not enabled (%v)", containerName, err)
} else {
return "", fmt.Errorf("RDT disabled, refusing to set RDT class of container %q to %q", containerName, cls)
}
}
return cls, nil return cls, nil
} }