Skip to content

Fix ConfigMap-derived volume names - #3227

Open
shenyv1 wants to merge 2 commits into
NVIDIA:mainfrom
shenyv1:fix/configmap-volume-names
Open

shenyv1 wants to merge 2 commits into
NVIDIA:mainfrom
shenyv1:fix/configmap-volume-names

Conversation

@shenyv1

@shenyv1 shenyv1 commented Nov 12, 2026 •

Copy link
Copy Markdown

Issue

Fixes #3204

Description

ConfigMap names may contain dots and exceed 63 characters, while Pod volume names must be DNS labels of at most 63 characters. The driver configuration helpers currently use the ConfigMap name directly for both volumes and mounts, so valid ConfigMap names such as driver.config produce invalid DaemonSet Pod templates.

Add ConfigMapVolumeName and use it for repoConfig, certConfig, and kernelModuleConfig volumes and mounts in both the ClusterPolicy and NVIDIADriver paths:

  • Preserve names that already satisfy volume naming rules, avoiding unnecessary changes to existing Pod templates.
  • For other valid ConfigMap names, replace dots with hyphens, truncate the prefix as needed, and append a 16-character hexadecimal suffix derived from the SHA-256 hash of the full original name. The resulting volume name stays within 63 characters.
  • Keep configMap.name pointing to the original ConfigMap; mounted files and paths are unchanged.

The device-plugin configuration path also uses the shared createConfigMapVolume helper but constructs its mounts separately. Update addSharedMountsForPluginConfig to use the same naming helper so its mounts continue to match the volume.

Add regression tests for naming boundaries, both driver configuration paths (including NVIDIADriver template rendering), and device-plugin volume/mount matching.

A generated name can still match another ConfigMap's preserved valid name. Resolving conflicts across all volumes in a Pod is outside the scope of this fix.

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

Using Go 1.27.4 and golangci-lint 2.14.0:

  • make fmt unit-test: passed.
  • make check: passed, including lint, license, module, and generated-asset checks. No generated or dependency changes.

No live Kubernetes/GPU cluster or end-to-end testing.


Devin Review

Generate deterministic DNS-label volume names while preserving original
ConfigMap references and existing valid volume names. Use the same names
for driver and device-plugin volume mounts.

Signed-off-by: Jiale Su <122144270+shenyv1@users.noreply.github.com>
@shenyv1
shenyv1 requested a review from a team as a code owner November 12, 2026 11:27
@copy-pr-bot

copy-pr-bot Bot commented Nov 12, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@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: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@coderabbitai

coderabbitai Bot commented Nov 12, 2026

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change adds ConfigMapVolumeName to return DNS-1123-valid volume names. Controller and driver rendering use the derived name for ConfigMap volumes and mounts while retaining the original ConfigMap name as the volume’s ConfigMap reference. Tests cover name validity, uniqueness in selected cases, and rendered mounts and volumes.

Severity of issue fixed: Medium

Merge Risk: Minimal · up to 09785

This change makes ConfigMap-backed volume and mount names valid for dotted ConfigMap names while leaving already-valid names unchanged. No actionable merge-blocking risk was identified. No end-to-end cluster testing was reported, which is normal for this kind of change.

Security architecture risk: Minimal · up to 09785

The change consistently derives matching volume and mount names while preserving ConfigMap references, namespaces, and mounted file paths. Already-valid volume names remain unchanged. No material security risk introduced or worsened by this PR was identified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The changed data flow affects Pod-local identifiers in workloads consuming these configured ConfigMaps, including shared driver-container mounts and plugin/config-manager mounts. It does not expand the ConfigMap namespace or object selection used by the inspected paths.

Trust Boundaries and Controls

  • observed — Configuration-provided names still identify the original ConfigMap source. Derivation occurs only for volume/mount linkage, so the inspected change does not replace the existing source-selection boundary with a truncated or hashed identity.

Resilience and Maintainability Implications

  • observed — ConfigMap read failures return before constructing mounts, and callers check errors before appending the affected pair. NVIDIADriver configuration/rendering failures return before cleanup or object publication. Stable hashing and sorted filenames preserve deterministic reconstruction on retries.
  • inferred — The helper does not guarantee uniqueness across all volumes: a preserved valid name can equal another ConfigMap's generated name. This is a residual Pod-validation limitation, not an established source-substitution attack. It does not rename previously valid configurations, while the configuration requiring normalization already produced an invalid identifier before this PR.
- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 2442a9b and 0978507.

Files selected for processing: 6

  • controllers/object_controls.go
  • controllers/transforms_test.go
  • internal/state/driver.go
  • internal/state/driver_test.go
  • internal/utils/utils.go
  • internal/utils/utils_test.go

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

@shenyv1 thanks for your contribution ! While reviewing the PR I was wondering that it will be simpler if we just made the volume name static, I feel that will simplify the code substantially
something along the lines of

Config field                                   Fixed volume name      Pods that use it
---------------------------------------------  ---------------------  ------------------------------------------------------------
driver.repoConfig / spec.repoConfig            repo-config            Driver (also mounted in GDS and GDRCopy containers)
driver.certConfig / spec.certConfig            cert-config            Driver (also mounted in GDS and GDRCopy containers)
driver.kernelModuleConfig /                    kernel-module-config   Driver (also mounted in peermem container), vGPU manager
  spec.kernelModuleConfig /
  vgpuManager.kernelModuleConfig
devicePlugin.config                            operand-configs      Device plugin, GFD, MPS control daemon (incl. config-manager)

It will change the Pod template for the existing Pods as well, but I feel that might be okay.

wdyt ?

Use role-specific fixed names for ConfigMap volumes while preserving the
referenced ConfigMap names. Update shared mounts and regression tests, and
remove the ConfigMap volume-name hashing helper.

Signed-off-by: Leo_Su <122144270+shenyv1@users.noreply.github.com>
@shenyv1

shenyv1 commented Nov 18, 2026

Copy link
Copy Markdown
Author

@kvalliyurnatt Thanks for the suggestion! I think you're right — fixed volume names make this much simpler. I've updated the PR accordingly.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[gpu-op] Dotted ConfigMap names generate invalid driver volumes in ClusterPolicy and NVIDIADriver

2 participants