Skip to content

[fix]: Fix host subscription mounts with custom driver repositories - #3109

Merged
rahulait merged 2 commits into
NVIDIA:mainfrom
rahulait:fix-rhel-subscription-mounts
Oct 23, 2026
Merged

rahulait merged 2 commits into
NVIDIA:mainfrom
rahulait:fix-rhel-subscription-mounts

Conversation

@rahulait

@rahulait rahulait commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Description

Restore RHEL subscription mounts when repoConfig is configured. Use DirectoryOrCreate and FileOrCreate to tolerate missing subscription paths on RHEL, SLES, and SL Micro.

Mount the RHEL repository parent directory only in the driver-manager init container to support file creation without exposing additional host repository files to regular driver containers.

Apply changes to both ClusterPolicy and NVIDIADriver rendering paths, preserving existing OS and runtime eligibility checks.

This PR reverts the changes done in #2391 and fixes the regression.

Fixes #2817

Checklist

  • No secrets, sensitive information, or unrelated changes
  • Lint checks passing (make lint)
  • Generated assets in-sync (make validate-generated-assets)
  • Go mod artifacts in-sync (make validate-modules)
  • Test cases are added for new code paths

Testing

Tested it on a single node rhel k8s cluster and verified it passes all tests mentioned in the guide attached.
rhel-host-subscription-pr3109-public.md


Devin Review

@rahulait
rahulait requested a review from a team as a code owner October 22, 2026 13:21

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

Devin Review

HostPath: &corev1.HostPathVolumeSource{
Path: "/etc/pki/entitlement",
Type: ptr.To(corev1.HostPathDirectory),
Type: new(corev1.HostPathDirectoryOrCreate),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟨 Absent subscriptions modify host configuration

On unsubscribed nodes, DirectoryOrCreate and FileOrCreate create subscription paths on the host. Kubelet changes protected host configuration instead of leaving missing subscription data untouched.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

@rahulait
rahulait force-pushed the fix-rhel-subscription-mounts branch from ece7708 to 0ddf476 Compare October 22, 2026 13:23
@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

📝 Walkthrough

RHEL subscription mounts are retained when custom repository configuration is enabled. The yum repository directory mount is assigned to the driver-manager init container, and other subscription mounts remain with the driver container. RHEL and SUSE host-path definitions use create-capable types. The DaemonSet template renders the configured driver-manager mounts.

Priority: ⚪ Pending latest changes

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to ece77

The change restores RHEL host subscription mounts alongside custom repositories, and no concrete merge-blocking runtime risk was established. Two tests could assert mount destinations and rendered driver mounts more strictly, which is a reasonable follow-up.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments: 2
controllers/transforms_test.go: 1

4878-4878: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert driver subscription mount destinations and names.

The driver assertion counts mounts and checks only ReadOnly. The host-path helper validates volume sources, not mount destinations. A wrong driver MountPath, or a changed name that still starts with subscription-config-, can therefore pass. Compare the driver subscription mounts against expected corev1.VolumeMount values, including Name, MountPath, and ReadOnly, while keeping the RHEL parent-directory mount assertion on the manager container.

internal/state/driver_test.go: 1

743-745: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Assert required mounts in the rendered driver container.

The configs.VolumeMounts assertions run before rendering. The DaemonSet check only rejects /run/secrets/yum.repos.d. If the template stops rendering AdditionalConfigs.VolumeMounts into nvidia-driver-ctr, this test still passes. Assert that the rendered driver container contains the expected subscription and custom repository mounts.


ℹ️ Review info
⚙️ Run configuration
📥 Commits

Reviewing files that changed from the base of the PR and between 8b109be and ece7708.

📒 Files selected for processing: 6
  • controllers/object_controls.go
  • controllers/transforms_test.go
  • internal/state/driver.go
  • internal/state/driver_test.go
  • internal/state/driver_volumes.go
  • manifests/state-driver/0500_daemonset.yaml

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

@kvalliyurnatt

Copy link
Copy Markdown
Contributor

The changes mostly look good, my only concern is we don't have an explicit repoConfig only mode now with the changes, we always create/mount the subscription folders and I am not sure if that can cause weird errors on air gapped hosts (I am not sure it will, it is just speculative on my part). Also it is not great that we will create these subscription folders on the host and leave them behind when they don't actually exist on the host. would it be possible for us to do some tests in an actual air gapped environment ?

Comment thread controllers/object_controls.go
Comment thread controllers/object_controls.go
This reverts commit 835c3c0, reversing changes made to
its first parent.

Restore RHEL host subscription mounts when custom repositories are
configured. Retain shared test helpers required by subsequent tests.

Signed-off-by: Rahul Sharma <rahulsharm@nvidia.com>
Create missing RHEL subscription files and directories, and missing
SUSE credentials directories, so hosts using mirrored repositories
can mount subscription paths without new API fields or driver images.

Mount the RHEL repository parent directory only in the driver-manager
init container to support file creation without exposing additional
host repository files to regular driver containers.

Apply the changes to both ClusterPolicy and NVIDIADriver rendering,
preserving existing OS/runtime eligibility checks. Add regression tests
for exact subscription mounts and rendered custom repository mounts.

Signed-off-by: Rahul Sharma <rahulsharm@nvidia.com>
@rahulait
rahulait force-pushed the fix-rhel-subscription-mounts branch from 0ddf476 to 21c6d32 Compare October 23, 2026 02:42
Comment thread controllers/object_controls.go
@tariq1890

Copy link
Copy Markdown
Contributor

@cdesiniotis can you take a look at this as well?

@rahulait

Copy link
Copy Markdown
Contributor Author

/cherry-pick release-26.7

@rahulait
rahulait merged commit 3c3ed57 into NVIDIA:main Oct 23, 2026
21 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🤖 Backport PR created for release-26.7: #3117 ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Cannot use custom repoConfig together with RHEL host subscription repositories after #2391

4 participants