Skip to content

fix(icms-translate): run LLM sidecars as a shared UID so pylon can read the worker-token#409

Closed
Max-NV wants to merge 3 commits into
mainfrom
fix/llm-worker-token-runasuser
Closed

fix(icms-translate): run LLM sidecars as a shared UID so pylon can read the worker-token#409
Max-NV wants to merge 3 commits into
mainfrom
fix/llm-worker-token-runasuser

Conversation

@Max-NV

@Max-NV Max-NV commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Why

Managed LLM workers reach the request router but never register, so gateway invokes return no_eligible_candidates. The llm-credential-manager writes the worker auth token to the shared llm emptyDir as mode 0600, but pylon (llm-router-client) runs as the distroless non-root user nvs (1000) while the credential-manager runs as root, so pylon cannot read it and fails before dialing the router.

What changed

Run both LLM sidecars as one UID so they share the token owner; the token stays 0600 and the customer workload container (its own user) still cannot read it. Also set the pod fsGroup to that UID so the non-root credential-manager can write the shared emptyDir.

The UID is configurable via TranslateConfig.LLMSidecarRunAsUser and the NVCA WorkloadConfig field: default 1000, and a negative value leaves runAsUser unset so a platform such as OpenShift can assign a UID from its SCC range. Regenerated the container/llm and helmchart/llm goldens and synced the NVCA vendored copies.

Customer Release Notes

LLM function workers now register with the request router in managed deployments; OpenAI-compatible invocations no longer fail with no_eligible_candidates due to the worker-token permission mismatch.

Testing

go test ./pkg/icms-translate/translate/function/... (default, configured-override, and platform-managed UID cases, plus the pod fsGroup helper) and the NVCA pkg/storage workload translation test. Golden diff is the sidecar securityContexts plus the pod fsGroup.

References

Closes #410

Summary by CodeRabbit

  • New Features
    • LLM sidecars now use a consistent shared run-as identity to reliably access shared worker credentials.
    • Added configuration for the shared sidecar UID/GID, with a secure non-root default (UID 1000).
    • Negative configuration now delegates identity assignment to the platform.
  • Bug Fixes
    • Improved shared-volume permissions for LLM workloads and related utility pods by applying pod-level fsGroup when applicable.
  • Tests
    • Added coverage to verify the shared identity behavior and edge cases (including negative values).

@Max-NV
Max-NV requested review from a team as code owners July 24, 2026 03:04
@Max-NV
Max-NV requested a review from balajinvda July 24, 2026 03:04
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 42cf8661-e08a-40bb-a108-05e5100239f4

📥 Commits

Reviewing files that changed from the base of the PR and between 4f410ca and 67f2cf2.

⛔ Files ignored due to path filters (6)
  • src/compute-plane-services/nvca/vendor/github.com/NVIDIA/nvcf/src/libraries/go/lib/pkg/icms-translate/translate/function/llm.go is excluded by !**/vendor/**
  • src/compute-plane-services/nvca/vendor/github.com/NVIDIA/nvcf/src/libraries/go/lib/pkg/icms-translate/translate/function/translate.go is excluded by !**/vendor/**
  • src/compute-plane-services/nvca/vendor/github.com/NVIDIA/nvcf/src/libraries/go/lib/pkg/icms-translate/translate/function/translate_container.go is excluded by !**/vendor/**
  • src/compute-plane-services/nvca/vendor/github.com/NVIDIA/nvcf/src/libraries/go/lib/pkg/icms-translate/translate/function/translate_helm.go is excluded by !**/vendor/**
  • src/compute-plane-services/nvca/vendor/github.com/NVIDIA/nvcf/src/libraries/go/lib/pkg/types/nvca/config/types.go is excluded by !**/vendor/**
  • src/compute-plane-services/nvca/vendor/github.com/NVIDIA/nvcf/src/libraries/go/lib/pkg/types/nvca/config/zz_generated.deepcopy.go is excluded by !**/vendor/**, !**/zz_generated.*
📒 Files selected for processing (3)
  • src/compute-plane-services/nvca/internal/miniservice/translate_workload.go
  • src/compute-plane-services/nvca/pkg/nvca/k8scomputebackend.go
  • src/compute-plane-services/nvca/pkg/storage/translate_workload.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/compute-plane-services/nvca/internal/miniservice/translate_workload.go
  • src/compute-plane-services/nvca/pkg/nvca/k8scomputebackend.go

📝 Walkthrough

Walkthrough

LLM workload configuration now propagates a configurable sidecar UID. Both LLM sidecars receive matching user/group security contexts, and generated LLM pods set the corresponding filesystem group when applicable. Tests cover defaults, overrides, and negative values.

Changes

LLM sidecar security

Layer / File(s) Summary
Identity contract and configuration propagation
src/libraries/go/lib/pkg/types/nvca/config/types.go, src/libraries/go/lib/pkg/icms-translate/translate/function/translate.go, src/compute-plane-services/nvca/...
Adds LLMSidecarRunAsUser and passes it from workload configuration into translation.
Sidecar security context implementation
src/libraries/go/lib/pkg/icms-translate/translate/function/llm.go
Resolves the default or configured UID and applies matching RunAsUser and RunAsGroup settings to both LLM sidecars.
Pod security wiring and validation
src/libraries/go/lib/pkg/icms-translate/translate/function/translate_*.go, src/libraries/go/lib/pkg/icms-translate/translate/function/llm_test.go
Applies the UID as pod FSGroup and tests default, override, and negative-value behavior.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant WorkloadConfig
  participant TranslateConfig
  participant LLMTranslator
  participant LLMRouterClient
  participant CredentialManager
  WorkloadConfig->>TranslateConfig: LLMSidecarRunAsUser
  TranslateConfig->>LLMTranslator: configured UID
  LLMTranslator->>LLMRouterClient: RunAsUser/RunAsGroup
  LLMTranslator->>CredentialManager: RunAsUser/RunAsGroup
  LLMTranslator->>LLMTranslator: apply pod FSGroup
Loading

Suggested reviewers: estroz

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title follows Conventional Commits and accurately describes the bug fix for shared LLM sidecar UID access.
Linked Issues check ✅ Passed The changes implement the shared UID/GID fix, configurable override, and pod fsGroup behavior required by issue #410.
Out of Scope Changes check ✅ Passed No clearly unrelated code changes are evident; the diff stays focused on LLM sidecar security context plumbing and tests.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/llm-worker-token-runasuser

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies"


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

@Max-NV
Max-NV requested review from estroz and kristinapathak and removed request for balajinvda July 24, 2026 03:06

@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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/libraries/go/lib/pkg/icms-translate/translate/function/llm.go`:
- Around line 50-57: Add a permission mechanism for the shared LLM emptyDir
mounted at /var/run/llm, such as configuring the pod security context with the
sidecars’ shared group via fsGroup or adding an initContainer to chown the
directory before startup. Update the relevant pod construction alongside
newLLMSidecarSecurityContext and add a test verifying worker-token is writable
by the non-root sidecars.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 4718fbcb-08cb-4c72-a788-b52a8c568a86

📥 Commits

Reviewing files that changed from the base of the PR and between 582fd3c and 67f9f7d.

⛔ Files ignored due to path filters (3)
  • src/compute-plane-services/nvca/vendor/github.com/NVIDIA/nvcf/src/libraries/go/lib/pkg/icms-translate/translate/function/llm.go is excluded by !**/vendor/**
  • src/libraries/go/lib/testdata/icms-translate/function/container/llm/exp.yaml is excluded by !**/testdata/**
  • src/libraries/go/lib/testdata/icms-translate/function/helmchart/llm/exp.yaml is excluded by !**/testdata/**
📒 Files selected for processing (2)
  • src/libraries/go/lib/pkg/icms-translate/translate/function/llm.go
  • src/libraries/go/lib/pkg/icms-translate/translate/function/llm_test.go

Comment thread src/libraries/go/lib/pkg/icms-translate/translate/function/llm.go
Comment thread src/libraries/go/lib/pkg/icms-translate/translate/function/llm.go Outdated
@Max-NV
Max-NV requested a review from mikeyrcamp July 24, 2026 17:14

@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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/libraries/go/lib/pkg/icms-translate/translate/function/llm_test.go`:
- Around line 466-472: Update the “configured UID overrides the default on both
sidecars” test to first assert both pylon.SecurityContext and
cred.SecurityContext are non-nil, then verify both sidecars’ RunAsUser and
RunAsGroup values match the configured shared UID/GID. Avoid dereferencing
either security context before the nil checks.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 008c7220-8296-4790-94fd-6b8bf66d22d5

📥 Commits

Reviewing files that changed from the base of the PR and between 67f9f7d and 4f410ca.

⛔ Files ignored due to path filters (9)
  • src/compute-plane-services/nvca/vendor/github.com/NVIDIA/nvcf/src/libraries/go/lib/pkg/icms-translate/translate/function/llm.go is excluded by !**/vendor/**
  • src/compute-plane-services/nvca/vendor/github.com/NVIDIA/nvcf/src/libraries/go/lib/pkg/icms-translate/translate/function/translate.go is excluded by !**/vendor/**
  • src/compute-plane-services/nvca/vendor/github.com/NVIDIA/nvcf/src/libraries/go/lib/pkg/icms-translate/translate/function/translate_container.go is excluded by !**/vendor/**
  • src/compute-plane-services/nvca/vendor/github.com/NVIDIA/nvcf/src/libraries/go/lib/pkg/icms-translate/translate/function/translate_helm.go is excluded by !**/vendor/**
  • src/compute-plane-services/nvca/vendor/github.com/NVIDIA/nvcf/src/libraries/go/lib/pkg/types/nvca/config/types.go is excluded by !**/vendor/**
  • src/compute-plane-services/nvca/vendor/github.com/NVIDIA/nvcf/src/libraries/go/lib/pkg/types/nvca/config/zz_generated.deepcopy.go is excluded by !**/vendor/**, !**/zz_generated.*
  • src/libraries/go/lib/pkg/types/nvca/config/zz_generated.deepcopy.go is excluded by !**/zz_generated.*
  • src/libraries/go/lib/testdata/icms-translate/function/container/llm/exp.yaml is excluded by !**/testdata/**
  • src/libraries/go/lib/testdata/icms-translate/function/helmchart/llm/exp.yaml is excluded by !**/testdata/**
📒 Files selected for processing (9)
  • src/compute-plane-services/nvca/internal/miniservice/translate_workload.go
  • src/compute-plane-services/nvca/pkg/nvca/k8scomputebackend.go
  • src/compute-plane-services/nvca/pkg/storage/translate_workload.go
  • src/libraries/go/lib/pkg/icms-translate/translate/function/llm.go
  • src/libraries/go/lib/pkg/icms-translate/translate/function/llm_test.go
  • src/libraries/go/lib/pkg/icms-translate/translate/function/translate.go
  • src/libraries/go/lib/pkg/icms-translate/translate/function/translate_container.go
  • src/libraries/go/lib/pkg/icms-translate/translate/function/translate_helm.go
  • src/libraries/go/lib/pkg/types/nvca/config/types.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/libraries/go/lib/pkg/icms-translate/translate/function/llm.go

@Max-NV
Max-NV requested a review from apartha-nv July 24, 2026 17:18
Max-NV added 2 commits July 24, 2026 10:23
…ad the worker-token

The llm-credential-manager writes the worker auth token to the shared
"llm" emptyDir with mode 0600, but pylon (llm-router-client) runs as the
distroless non-root user nvs (1000) while the credential-manager runs as
root, so pylon cannot read it. Registration fails at token read before
pylon dials the router, leaving the model unregistered and gateway
invokes returning no_eligible_candidates.

Render both sidecars with runAsUser/runAsGroup 1000 so they share the
token owner while keeping 0600; the customer workload container runs as
its own user and still cannot read it. Regenerate the container/llm and
helmchart/llm goldens and sync the NVCA vendored copy.

NO-REF
…Group

Addressing review. Hardcoding runAsUser 1000 conflicts with OpenShift SCC
UID-range admission, and the non-root sidecars need the shared emptyDir
writable.

- Add TranslateConfig.LLMSidecarRunAsUser and the NVCA WorkloadConfig
  field. Defaults to 1000; a negative value leaves runAsUser unset so the
  platform (e.g. OpenShift) can assign a UID from its allowed range.
- Set the pod fsGroup to the same UID so the credential-manager can write
  the worker-token to the shared emptyDir.

NO-REF
@Max-NV
Max-NV force-pushed the fix/llm-worker-token-runasuser branch from 4f410ca to 67f2cf2 Compare July 24, 2026 17:23
@Max-NV Max-NV self-assigned this Jul 24, 2026
@Max-NV
Max-NV added this pull request to the merge queue Jul 24, 2026
@estroz
estroz removed this pull request from the merge queue due to a manual request Jul 24, 2026
@estroz

estroz commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

I'm hoping we can just use 0644 perms on the token mount, although i'm not completely against the changes as-is

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.

LLM workers fail to register: pylon cannot read the 0600 worker-token (sidecar UID mismatch)

4 participants