X Tutup
Skip to content

Commit 9b1fb82

Browse files
committed
cri: fix handling of ignore_rdt_not_enabled_errors config option
We were not properly ignoring errors from gorestrl.rdt.ContainerClassFromAnnotations() causing the config option to be ineffective, in practice. Signed-off-by: Markus Lehtonen <markus.lehtonen@intel.com>
1 parent 4f5ce56 commit 9b1fb82

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

pkg/cri/server/rdt_linux.go

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,21 @@ import (
3131
// container and returns its effective RDT class.
3232
func (c *criService) rdtClassFromAnnotations(containerName string, containerAnnotations, podAnnotations map[string]string) (string, error) {
3333
cls, err := rdt.ContainerClassFromAnnotations(containerName, containerAnnotations, podAnnotations)
34-
if err != nil {
35-
return "", err
34+
35+
if err == nil {
36+
// Our internal check that RDT has been enabled
37+
if cls != "" && !tasks.RdtEnabled() {
38+
err = fmt.Errorf("RDT disabled, refusing to set RDT class of container %q to %q", containerName, cls)
39+
}
3640
}
3741

38-
if cls != "" && !tasks.RdtEnabled() {
39-
if c.config.ContainerdConfig.IgnoreRdtNotEnabledErrors {
40-
cls = ""
42+
if err != nil {
43+
if !tasks.RdtEnabled() && c.config.ContainerdConfig.IgnoreRdtNotEnabledErrors {
4144
logrus.Debugf("continuing create container %s, ignoring rdt not enabled (%v)", containerName, err)
42-
} else {
43-
return "", fmt.Errorf("RDT disabled, refusing to set RDT class of container %q to %q", containerName, cls)
45+
return "", nil
4446
}
47+
return "", err
4548
}
49+
4650
return cls, nil
4751
}

0 commit comments

Comments
 (0)
X Tutup