diff --git a/controllers/state_manager.go b/controllers/state_manager.go index 65ea23ce8..542672bbc 100644 --- a/controllers/state_manager.go +++ b/controllers/state_manager.go @@ -600,12 +600,17 @@ func (n *ClusterPolicyController) getGPUNodeOSInfo() (string, string, error) { if !ok { return "", "", fmt.Errorf("unable to retrieve OS version from label %s", nfdOSVersionIDLabelKey) } - // If the OS is RockyLinux, Oracle Linux or RHEL, we will omit the minor version when constructing the os image tag + // If the OS is RockyLinux, Oracle Linux or RHEL, we will omit the minor version when constructing the os image tag. + // CentOS Stream / SCOS (OKD) reports ID=centos, but published driver images use the rhel tag family. + osTagName := osName switch osName { + case "centos": + osTagName = "rhel" + fallthrough case "ol", "rocky", "rhel": osVersion = strings.Split(osVersion, ".")[0] } - osTag := fmt.Sprintf("%s%s", osName, osVersion) + osTag := fmt.Sprintf("%s%s", osTagName, osVersion) return osName, osTag, nil } diff --git a/controllers/state_manager_test.go b/controllers/state_manager_test.go index d72a08cc4..9231bcb77 100644 --- a/controllers/state_manager_test.go +++ b/controllers/state_manager_test.go @@ -106,6 +106,18 @@ func TestGetGPUNodeOSInfo(t *testing.T) { osVersion: "rolling", expected: "archlinuxrolling", }, + { + name: "centos stream / scos maps to rhel major tag", + osName: "centos", + osVersion: "10", + expected: "rhel10", + }, + { + name: "centos with minor version maps to rhel major tag", + osName: "centos", + osVersion: "10.0", + expected: "rhel10", + }, } for _, tc := range testCases { diff --git a/internal/state/nodepool.go b/internal/state/nodepool.go index c9123c3ca..f6763e015 100644 --- a/internal/state/nodepool.go +++ b/internal/state/nodepool.go @@ -153,13 +153,18 @@ func getNodePools(ctx context.Context, k8sClient client.Client, cr *nvidiav1alph } func getOSTag(osRelease, osVersion string) (string, error) { + osID := osRelease var osTagSuffix string - // If the OS is RockyLinux, Oracle Linux or RHEL, we will omit the minor version when constructing the os image tag + // If the OS is RockyLinux, Oracle Linux or RHEL, we will omit the minor version when constructing the os image tag. + // CentOS Stream / SCOS (OKD) reports ID=centos, but published driver images use the rhel tag family. switch osRelease { + case "centos": + osID = "rhel" + fallthrough case "ol", "rocky", "rhel": osTagSuffix = strings.Split(osVersion, ".")[0] default: osTagSuffix = osVersion } - return fmt.Sprintf("%s%s", osRelease, osTagSuffix), nil + return fmt.Sprintf("%s%s", osID, osTagSuffix), nil } diff --git a/internal/state/nodepool_test.go b/internal/state/nodepool_test.go index 278f5e95b..13b8d08f8 100644 --- a/internal/state/nodepool_test.go +++ b/internal/state/nodepool_test.go @@ -95,6 +95,20 @@ func TestGetOSTag(t *testing.T) { expected: "archlinuxrolling", expectError: false, }, + { + description: "centos stream / scos maps to rhel major tag", + osRelease: "centos", + osVersion: "10", + expected: "rhel10", + expectError: false, + }, + { + description: "centos with minor version maps to rhel major tag", + osRelease: "centos", + osVersion: "10.0", + expected: "rhel10", + expectError: false, + }, } for _, test := range tests {