← Back to Pull requests

fix(chart): create vgpu cache dirs 1777 in libsync #25

Closed
unknown closed this pull request without merging on Sep 28, 2026 03:53 UTC
View on GitHub
unknown unknown commented on Sep 26, 2026 13:35 UTC
Author

What type of PR is this?
Bug fix. Chart-only, no new values, no image or webhook change.

What this PR does / why we need it:
The libsync DaemonSet only created /usr/local/vgpu and copied libvgpu.so into it. The two directories the webhook mounts into workload containers, {paths.containerVgpuMount}/containers and the host /tmp/vgpulock, were left to be created by the kubelet as root with mode 0755, because the webhook declares both hostPaths as DirectoryOrCreate.

libvgpu creates its per-container metrics cache at {CONTAINER_VGPU_MOUNT}/containers/{POD_UID}_{CONTAINER_NAME}/usage.cache as the workload user, so a non-root container cannot create it in a root-owned 0755 directory. It then fails with errno=13 and falls back to /tmp/cudevshr.cache inside the container, where kai-vgpu-monitor never sees it, and the hami_ per-container metrics go missing for every non-root workload.

This PR has the libsync script, which already runs privileged as root, create both directories at install and leave them mode 1777. It is the change proposed in https://github.com/Project-HAMi/KAI-resource-isolator/pull/22, closed unmerged on 2026-09-22 by a stale sweep with no maintainer objection.

Which issue(s) this PR fixes:

Fixes #24

Special notes for your reviewer:

Scope is exactly the libsync command block. The security context, the mounts, the image, values.yaml and every other template are byte-identical to main. No readiness probe, no mount narrowing, no new value.

Verified on a single-node kind v0.32.0 cluster (Kubernetes v1.36.1, darwin/arm64) with the published image v1.1.0, using the assertion from kai-scheduler/KAI-Scheduler#2033:

| | chart at main | with this change |
|---|---|---|
| stat -c '%n %a %U' /usr/local/vgpu/containers /tmp/vgpulock | 755 root for both | 1777 root for both |
| kubectl exec as uid 1000: mkdir $CONTAINER_VGPU_MOUNT/containers/${POD_UID}_${CONTAINER_NAME} | Permission denied | succeeds |
| kubectl exec as uid 1000: touch /tmp/vgpulock/probe | Permission denied | succeeds |

An in-place helm upgrade over a node that already had both directories at 0755 brings them back to 1777 root, and the mkdir -p plus chmod pair is idempotent across restarts. The rendered-manifest diff against main is confined to the six added lines of the libsync script.

On /tmp/vgpulock: at the pinned libvgpu revision 5496322 the try_lock_unified_lock helpers in src/utils.c have no callers, so nothing writes there today. The directory is still created because the HAMi maintainer decision in kai-scheduler/KAI-Scheduler#1821 requires libsync to create it at install, and KAI #2033 asserts 1777 for it. The 1777 sticky mode is what upstream asserts and what HAMi uses for this directory.

Related:

  • https://github.com/Project-HAMi/KAI-resource-isolator/pull/22 (same change, closed unmerged by a stale sweep; credit to dttung2905)

  • https://github.com/kai-scheduler/KAI-Scheduler/issues/1821 (maintainer decision: libsync creates /tmp/vgpulock at install)

  • https://github.com/kai-scheduler/KAI-Scheduler/pull/2033 (merged, blocked on this repository, verifies both directories are 1777)
  • Hardware validation: no GPU was available, so everything above was validated on a GPU-less kind cluster with the non-root write path exercised directly as uid 1000. The libvgpu errno=13 log line is quoted from the real GPU node report in #22; actual hami_ values through kai-vgpu-monitor were not measured, as that needs a GPU.

    Does this PR introduce a user-facing change?:

    Yes, a narrow one. On every node, libsync now creates /usr/local/vgpu/containers and /tmp/vgpulock with mode 1777 at install instead of leaving them to be created 0755 root by the kubelet on the first scheduled pod. No values, flags, images, mounts or webhook behaviour change.

    AI Disclosure:
    AI assistance was used to review repository context and help draft this change and its description. All changes were manually reviewed, verified locally, and submitted by the author.

    <!-- This is an auto-generated comment: release notes by coderabbit.ai -->

    Summary by CodeRabbit

    Bug Fixes
    The libsync DaemonSet now prepares required container and temporary directories with permissions that allow shared access.

    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 558 lines (+418 / -140) across 6 files Reviewer: archlitchi Review duration: 2298m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.48) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.48 · 558 lines diff across 6 files
    0.48
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.378
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #25"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 48.2% (MEDIUM) · Higher = larger blast radius
    48.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 19% · Safe to merge
    19%