Skip to content

fix(config): respect ConfigMap values when CLI flag is not explicitly set#119

Merged
hami-robot[bot] merged 1 commit into
Project-HAMi:mainfrom
xiilab:fix/cli-flag-precedence
May 9, 2026
Merged

fix(config): respect ConfigMap values when CLI flag is not explicitly set#119
hami-robot[bot] merged 1 commit into
Project-HAMi:mainfrom
xiilab:fix/cli-flag-precedence

Conversation

@100milliongold

Copy link
Copy Markdown

Summary

LoadNvidiaConfig() (pkg/util/util.go) loads the device-plugin
ConfigMap (volcano-vgpu-device-config) into nvidiaConfig, and then
unconditionally overwrites DeviceSplitCount, DeviceCoreScaling,
and GPUMemoryFactor with the matching CLI flag values:

nvidiaConfig.DeviceSplitCount  = config.DeviceSplitCount
nvidiaConfig.DeviceCoreScaling = config.DeviceCoresScaling
nvidiaConfig.GPUMemoryFactor   = config.GPUMemoryFactor

Because each flag carries a per-flag default (--gpu-memory-factor=1,
--device-split-count=2, etc.), this silently discards whatever the
operator put in the ConfigMap, even when the flag is never passed on
the command line.

Symptom that surfaced this

On a node with 2 × 46 GiB GPUs, an operator sets
gpuMemoryFactor: 1024 in the ConfigMap so the device-plugin advertises
~88 vgpu-memory devices instead of ~92 K (so the kubelet ↔ plugin
ListAndWatch gRPC stays under the default 4 MiB receive limit). The
CLI default (1) silently overrode the ConfigMap, the plugin advertised
~92 K devices, kubelet dropped the advertise, and kubectl describe node reported:

Allocatable:
  volcano.sh/vgpu-cores:  "200"
  volcano.sh/vgpu-memory: "0"     # <- dropped
  volcano.sh/vgpu-number: "20"

The Volcano scheduler's capacity plugin then computes
realCapability = min(cluster_total, queue.capability) = 0 and rejects
every Pod with queue resource quota insufficient: insufficient volcano.sh/vgpu-memory — even when the queue capability is set
correctly.

The only way to make the ConfigMap-supplied value take effect today is
to also pass the same value via the DaemonSet args:, which makes the
ConfigMap field useless.

Fix

Gate the CLI-flag override on cli.Context.IsSet() so the flag wins
only when the user actually passed it on the command line.

if c.IsSet("device-split-count") {
    nvidiaConfig.DeviceSplitCount = config.DeviceSplitCount
}
if c.IsSet("device-cores-scaling") {
    nvidiaConfig.DeviceCoreScaling = config.DeviceCoresScaling
}
if c.IsSet("gpu-memory-factor") {
    nvidiaConfig.GPUMemoryFactor = config.GPUMemoryFactor
}

Compatibility

  • No flags + no ConfigMap → values remain zero (unchanged).
  • No flags + ConfigMap set → ConfigMap wins (was previously: flag default silently won).
  • Flag explicitly passed → flag wins (unchanged).
  • Flag explicitly passed + ConfigMap set → flag wins (unchanged, matches typical CLI-over-config precedence).

The only behavior change is the second case — and that is the case the
ConfigMap fields exist for, so it's the bug-fix direction.

Test plan

  • go build ./pkg/util/...
  • Reproduced the original 0-allocatable symptom on RTX 6000 Ada × 2 with the upstream binary.
  • Built the plugin from this branch, kept the --gpu-memory-factor flag out of the DaemonSet args, set gpuMemoryFactor: 1024 only in the ConfigMap → node Allocatable correctly reports volcano.sh/vgpu-memory: 88 and Pods with volcano.sh/vgpu-memory: 23 (chunks) schedule and run.

Related

The 4 MiB ListAndWatch limit and the gpuMemoryFactor mitigation are
documented in #118's README troubleshooting section. That PR is purely docs; this is the underlying behavior fix.

… set

LoadNvidiaConfig() loaded the ConfigMap into nvidiaConfig and then
unconditionally overwrote DeviceSplitCount, DeviceCoreScaling, and
GPUMemoryFactor with the corresponding CLI flag values. Because the
flags carry per-flag defaults (e.g. --gpu-memory-factor=1), this
silently discarded whatever the operator configured in the
volcano-vgpu-device-config ConfigMap, even when the operator never
passed the flag.

The symptom that surfaced this is large-GPU nodes where the operator
sets `gpuMemoryFactor: 1024` in the ConfigMap to keep the device-plugin
ListAndWatch advertise under kubelet's 4 MiB gRPC window. The CLI
default (1) overrode it, the device-plugin advertised ~92 K devices,
kubelet dropped the advertise, and node Allocatable for
volcano.sh/vgpu-memory was reported as 0.

Gate the override on cli.Context.IsSet() so the flag wins only when
the user actually passed it. Default behavior when the user supplies
no flags and no ConfigMap is unchanged (zero values stay zero).

Signed-off-by: Jea-Eok-Kim <je.kim@xiilab.com>

@DSFans2014 DSFans2014 left a comment

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.

/lgtm

@archlitchi archlitchi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/lgtm

@hami-robot

hami-robot Bot commented May 9, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 100milliongold, archlitchi

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@hami-robot hami-robot Bot added the approved label May 9, 2026
@hami-robot hami-robot Bot merged commit a556eae into Project-HAMi:main May 9, 2026
4 checks passed
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.

4 participants