Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions controllers/state_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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":

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dundysm thanks for your contribution!

I think we don't want to map centos to rhel in our code this way ( while this may work fine in the case of OKD)

  1. We never supported CentOS
  2. There is no guarantee that a rhel image will always work smoothly on centos

So doing this mapping in the code feels wrong, if you do want to do this you can duplicate images, put it in a public repository and override the driver image to point to yours, I don't think we want to embed this logic in code

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @kvalliyurnatt; that makes sense. i'll close this pr rather than embed a centos→rhel mapping.

for okd/scos the path is overriding the driver image (or digest pin) instead of teaching the operator that centos is rhel. appreciate the clarification on the support model.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kvalliyurnatt would you be open to allowing the user to choose the suffix of the image?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aqeelat what would that look like, also can you elaborate the use case for that ? what would that solve that can't be solved with just overriding the whole image ?

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
}
Expand Down
12 changes: 12 additions & 0 deletions controllers/state_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
9 changes: 7 additions & 2 deletions internal/state/nodepool.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
14 changes: 14 additions & 0 deletions internal/state/nodepool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down