Skip to content

feat(slinky-slurm): add conformance validator and CUJ demo - #1394

Merged
mchmarny merged 6 commits into
NVIDIA:mainfrom
kaynetu:feat/slinky-slurm-conformance-validator
Jun 22, 2026
Merged

mchmarny merged 6 commits into
NVIDIA:mainfrom
kaynetu:feat/slinky-slurm-conformance-validator

Conversation

@kaynetu

@kaynetu kaynetu commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds the slinky-slurm-health conformance validator (pod-exec checks for scontrol ping, idle/mixed node inventory, and bounded srun), wires it into slurm training leaves and the validator catalog, documents the EKS/GKE/Kind CUJ in demos/cuj1-slinky-slurm.md, and tunes the Slurm deployment Chainsaw assert timeout under the expected-resources envelope.

Motivation / Context

Slinky Slurm leaves already deploy via --platform slurm, but conformance had no workload-specific signal that slurmctld is reachable, workers are idle/mixed, and a minimal job can run through slurmd. This closes that gap and documents the full recipe → bundle → deploy → validate workflow (without snapshot) for EKS, GKE, and Kind.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)
  • Build/CI/tooling

Component(s) Affected

  • CLI (cmd/aicr, pkg/cli)
  • API server (cmd/aicrd, pkg/server)
  • Recipe engine / data (pkg/recipe)
  • Bundlers (pkg/bundler, pkg/component/*)
  • Collectors / snapshotter (pkg/collector, pkg/snapshotter)
  • Validator (pkg/validator, validators/conformance)
  • Core libraries (pkg/errors, pkg/k8s)
  • Docs/examples (docs/, demos/)
  • Other: recipes/validators/catalog.yaml, recipes/checks/slinky-slurm/, slurm overlays, vendor/

Implementation Notes

  • slinky-slurm-health conformance check — discovers login/worker pods via Slinky LoginSet/NodeSet CR selectors, then execs from the login pod: scontrol ping, sinfo -h -Ne -t idle,mix | grep -q ., and srun --immediate=5 --time=0:03 hostname. Shared pod-exec helper in validators/conformance/pod_exec.go (pulls in k8s.io/client-go/tools/remotecommand + vendored deps).
  • Recipe wiring — slinky-slurm-health added to slurm leaves' validation.conformance.checks; inherited performance.checks cleared ([]) so K8s-native nccl-all-reduce-bw does not bypass slurmd. Deployment checks (including expected-resources + Chainsaw health check) remain inherited from parent training leaves.
  • Deployment Chainsaw timeout — recipes/checks/slinky-slurm/health-check.yaml assert reduced from 10m → 7m to fit under the 8m expected-resources catalog envelope; contributor note added in docs/contributor/validator.md.
  • CUJ — demos/cuj1-slinky-slurm.md covers Query Mode recipe generation, bundle scheduling overrides for EKS/GKE/Kind, validate phases, and manual srun smoke.

Testing

unset GITLAB_TOKEN
make qualify

Unit / CI: make qualify passed locally (tests with -race, lint, e2e, scan).

Live cluster — conformance — built and pushed a custom conformance validator image to the cluster registry, then pointed aicr validate at it:

COMMIT=$(git rev-parse HEAD)
REG=<cluster-registry>   # ECR for EKS; local/registry mirror for Kind as documented in CUJ

make image-validators IMAGE_REGISTRY=${REG} IMAGE_TAG=sha-${COMMIT}

AICR_VALIDATOR_IMAGE_REGISTRY=${REG} \
  AICR_VALIDATOR_IMAGE_TAG=sha-${COMMIT} \
  ./dist/aicr_darwin_arm64_v8.0/aicr validate \
    -r /tmp/aws-slurm-recipe.yaml \
    --toleration dedicated=worker-workload:NoSchedule \
    --toleration dedicated=worker-workload:NoExecute \
    --phase conformance -o /tmp/report4.json \
    --no-cleanup

(Kind runs used the same pattern with Kind-appropriate REG, recipe path, and tolerations/node-selector from the CUJ.)

Other inherited conformance checks failed/skipped on Kind (no GPU/DRA) — expected.

Kind — healthy stack (slinky-slurm-health passed):

slinky-slurm-worker-slinky-0   ready=1/1 phase=Running
...
stdout: Slurmctld(primary) at slinky-slurm-controller-0 is UP
stdout: PARTITION ... NODES STATE ... idle slinky-0
stdout: slinky-0          # srun hostname
status: passed

EKS — healthy worker (slinky-slurm-health passed):

slinky-slurm-worker-slinky-0   ready=1/1 phase=Running
scontrol ping  ExitCode: 0   → Slurmctld(primary) at slinky-slurm-controller-0 is UP
sinfo idle/mix ExitCode: 0
srun hostname  ExitCode: 0   → slinky-0
status: passed

EKS — unhealthy worker (slinky-slurm-health failed as expected):

slinky-slurm-worker-slinky-0   ready=0/1 phase=Running
scontrol ping  ExitCode: 0   → Slurmctld(primary) at slinky-slurm-controller-0 is UP
sinfo idle/mix ExitCode: 1
srun hostname  ExitCode: 1
stderr: srun: Unable to allocate resources: Requested nodes are busy
message: Slinky Slurm health commands failed: sinfo idle/mix: exit code 1; srun hostname: exit code 1
status: failed

Manual smoke: srun hostname on the login pod (documented in demos/cuj1-slinky-slurm.md).

Risk Assessment

  • Low — New conformance check is gated on slinky-slurm component presence; slurm leaves only. Vendor bump is indirect deps for pod-exec. No change to default non-slurm recipes.
  • Medium
  • High

Rollout notes: Requires rebuilding/pushing the conformance validator image for live testing off main CI tags. Slurm leaves pick up the check via recipe merge; no migration.

Checklist

  • Tests pass locally (make test with -race)
  • Linter passes (make lint)
  • I did not skip/disable tests to make CI green
  • I added/updated tests for new functionality (slinky_slurm_health_check_test.go, pod_exec_test.go)
  • I updated docs if user-facing behavior changed (demos/cuj1-slinky-slurm.md, docs/user/component-catalog.md, docs/contributor/validator.md)
  • Changes follow existing patterns in the codebase
  • Commits are cryptographically signed (git commit -S)

@kaynetu
kaynetu requested review from a team as code owners June 17, 2026 17:35
@copy-pr-bot

copy-pr-bot Bot commented Jun 17, 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.

@github-actions

Copy link
Copy Markdown
Contributor

Welcome to AICR, @kaynetu! Thanks for your first pull request.

Before review, please ensure:

  • All commits are signed off per the DCO
  • CI checks pass (tests, lint, security scan)
  • The PR description explains the why behind your changes

A maintainer will review this soon.

@coderabbitai

coderabbitai Bot commented Jun 17, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 148def65-c42b-4442-9560-67e8fc4eef96

📥 Commits

Reviewing files that changed from the base of the PR and between cdd1684 and fa8e378.

📒 Files selected for processing (4)
  • validators/conformance/pod_exec.go
  • validators/conformance/pod_exec_test.go
  • validators/conformance/slinky_slurm_health_check.go
  • validators/conformance/slinky_slurm_health_check_test.go

📝 Walkthrough

Walkthrough

This PR introduces a slinky-slurm-health conformance validator for Kubernetes Slurm clusters managed by the Slinky operator. It adds pod_exec.go implementing pod command execution via Kubernetes REST API using SPDY remotecommand, with container selection by annotation/preference and proper error/exit-code handling. slinky_slurm_health_check.go implements CheckSlinkySlurmHealth which validates context fields, gates on component presence, discovers slinky.slurm.net/v1beta1 APIs, skips KWOK virtual clusters, selects a ready LoginSet pod, and runs scontrol/sinfo/srun health checks with exec. The validator is wired into the catalog (5m timeout), dispatch map, and three Slurm recipe overlays (EKS, GKE, Kind). A bug fix to recipeHasComponent now checks enabled state in addition to name matching. The health-check Chainsaw timeout is reduced from 10m to 7m. Three indirect Go dependencies are added for SPDY transport. A 279-line CUJ1 demo walkthrough covers recipe generation, bundle building, deployment, validation, and job execution across cloud providers. Supporting documentation includes timeout-budgeting guidance for validators, a component-catalog reference linking to the demo, and Apache 2.0 license headers on evidence files.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~65 minutes

Suggested labels

area/tests, size/L, theme/validation

Suggested reviewers

  • njhensley
  • xdu31
  • mchmarny
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat(slinky-slurm): add conformance validator and CUJ demo' accurately summarizes the main changes: adding a slinky-slurm-health conformance validator and a corresponding demo guide.
Description check ✅ Passed The description comprehensively documents the changes, motivation, implementation details, testing approach, and risk assessment, directly relating to the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

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

Actionable comments posted: 3

🤖 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 `@demos/cuj1-slinky-slurm.md`:
- Line 11: The Markdown spans on line 11 and line 51 have malformed inline code
with unmatched bold markers. The pattern `**nodeGroup**` incorrectly places bold
delimiters inside backticks creating invalid Markdown. Fix this by either
removing the double asterisks and keeping only the backtick code formatting as
`nodeGroup`, or by repositioning the bold markers outside the backticks to
render as **`nodeGroup`** if bold emphasis is intended.
- Around line 154-158: Update the documented srun command timeout in the
conformance phase row of the table to match the actual implementation. Change
the timeout value from --time=0:01 to --time=0:03 in the conformance row to
align with what CheckSlinkySlurmHealth in
validators/conformance/slinky_slurm_health_check.go actually executes, ensuring
the documentation accurately reflects the validator's behavior.

In `@validators/conformance/slinky_slurm_health_check.go`:
- Around line 263-316: The controllerRef field extraction in the
listSlinkySetsForController function at lines 287-288 discards error and found
return values from NestedString calls, which could hide type mismatches or other
errors. Refactor the controllerName and controllerNamespace extraction to
capture all three return values from NestedString instead of using blanks, then
add explicit error checking similar to the selector extraction pattern at lines
295-299. Check if the error is not nil and return an appropriate error, and
optionally verify that the fields are found before proceeding with the
controller name comparison logic.
🪄 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: ASSERTIVE

Plan: Enterprise

Run ID: d5da9b2a-04d2-4b28-ba2a-41fdfe830cba

📥 Commits

Reviewing files that changed from the base of the PR and between eea2a81 and 9999034.

⛔ Files ignored due to path filters (79)
  • go.sum is excluded by !**/*.sum
  • vendor/github.com/gorilla/websocket/.gitignore is excluded by !vendor/**
  • vendor/github.com/gorilla/websocket/AUTHORS is excluded by !vendor/**
  • vendor/github.com/gorilla/websocket/LICENSE is excluded by !vendor/**
  • vendor/github.com/gorilla/websocket/README.md is excluded by !vendor/**
  • vendor/github.com/gorilla/websocket/client.go is excluded by !vendor/**
  • vendor/github.com/gorilla/websocket/compression.go is excluded by !vendor/**
  • vendor/github.com/gorilla/websocket/conn.go is excluded by !vendor/**
  • vendor/github.com/gorilla/websocket/doc.go is excluded by !vendor/**
  • vendor/github.com/gorilla/websocket/join.go is excluded by !vendor/**
  • vendor/github.com/gorilla/websocket/json.go is excluded by !vendor/**
  • vendor/github.com/gorilla/websocket/mask.go is excluded by !vendor/**
  • vendor/github.com/gorilla/websocket/mask_safe.go is excluded by !vendor/**
  • vendor/github.com/gorilla/websocket/prepared.go is excluded by !vendor/**
  • vendor/github.com/gorilla/websocket/proxy.go is excluded by !vendor/**
  • vendor/github.com/gorilla/websocket/server.go is excluded by !vendor/**
  • vendor/github.com/gorilla/websocket/util.go is excluded by !vendor/**
  • vendor/github.com/moby/spdystream/CONTRIBUTING.md is excluded by !vendor/**
  • vendor/github.com/moby/spdystream/LICENSE is excluded by !vendor/**
  • vendor/github.com/moby/spdystream/MAINTAINERS is excluded by !vendor/**
  • vendor/github.com/moby/spdystream/NOTICE is excluded by !vendor/**
  • vendor/github.com/moby/spdystream/README.md is excluded by !vendor/**
  • vendor/github.com/moby/spdystream/connection.go is excluded by !vendor/**
  • vendor/github.com/moby/spdystream/handlers.go is excluded by !vendor/**
  • vendor/github.com/moby/spdystream/priority.go is excluded by !vendor/**
  • vendor/github.com/moby/spdystream/spdy/LICENSE is excluded by !vendor/**
  • vendor/github.com/moby/spdystream/spdy/PATENTS is excluded by !vendor/**
  • vendor/github.com/moby/spdystream/spdy/dictionary.go is excluded by !vendor/**
  • vendor/github.com/moby/spdystream/spdy/options.go is excluded by !vendor/**
  • vendor/github.com/moby/spdystream/spdy/read.go is excluded by !vendor/**
  • vendor/github.com/moby/spdystream/spdy/types.go is excluded by !vendor/**
  • vendor/github.com/moby/spdystream/spdy/write.go is excluded by !vendor/**
  • vendor/github.com/moby/spdystream/stream.go is excluded by !vendor/**
  • vendor/github.com/moby/spdystream/utils.go is excluded by !vendor/**
  • vendor/golang.org/x/net/internal/socks/client.go is excluded by !vendor/**
  • vendor/golang.org/x/net/internal/socks/socks.go is excluded by !vendor/**
  • vendor/golang.org/x/net/proxy/dial.go is excluded by !vendor/**
  • vendor/golang.org/x/net/proxy/direct.go is excluded by !vendor/**
  • vendor/golang.org/x/net/proxy/per_host.go is excluded by !vendor/**
  • vendor/golang.org/x/net/proxy/proxy.go is excluded by !vendor/**
  • vendor/golang.org/x/net/proxy/socks5.go is excluded by !vendor/**
  • vendor/golang.org/x/net/websocket/client.go is excluded by !vendor/**
  • vendor/golang.org/x/net/websocket/dial.go is excluded by !vendor/**
  • vendor/golang.org/x/net/websocket/hybi.go is excluded by !vendor/**
  • vendor/golang.org/x/net/websocket/server.go is excluded by !vendor/**
  • vendor/golang.org/x/net/websocket/websocket.go is excluded by !vendor/**
  • vendor/k8s.io/apimachinery/pkg/util/httpstream/doc.go is excluded by !vendor/**
  • vendor/k8s.io/apimachinery/pkg/util/httpstream/httpstream.go is excluded by !vendor/**
  • vendor/k8s.io/apimachinery/pkg/util/httpstream/spdy/doc.go is excluded by !vendor/**
  • vendor/k8s.io/apimachinery/pkg/util/httpstream/spdy/spdy.go is excluded by !vendor/**
  • vendor/k8s.io/apimachinery/pkg/util/remotecommand/constants.go is excluded by !vendor/**
  • vendor/k8s.io/client-go/tools/remotecommand/OWNERS is excluded by !vendor/**
  • vendor/k8s.io/client-go/tools/remotecommand/doc.go is excluded by !vendor/**
  • vendor/k8s.io/client-go/tools/remotecommand/errorstream.go is excluded by !vendor/**
  • vendor/k8s.io/client-go/tools/remotecommand/fallback.go is excluded by !vendor/**
  • vendor/k8s.io/client-go/tools/remotecommand/reader.go is excluded by !vendor/**
  • vendor/k8s.io/client-go/tools/remotecommand/remotecommand.go is excluded by !vendor/**
  • vendor/k8s.io/client-go/tools/remotecommand/resize.go is excluded by !vendor/**
  • vendor/k8s.io/client-go/tools/remotecommand/spdy.go is excluded by !vendor/**
  • vendor/k8s.io/client-go/tools/remotecommand/v1.go is excluded by !vendor/**
  • vendor/k8s.io/client-go/tools/remotecommand/v2.go is excluded by !vendor/**
  • vendor/k8s.io/client-go/tools/remotecommand/v3.go is excluded by !vendor/**
  • vendor/k8s.io/client-go/tools/remotecommand/v4.go is excluded by !vendor/**
  • vendor/k8s.io/client-go/tools/remotecommand/v5.go is excluded by !vendor/**
  • vendor/k8s.io/client-go/tools/remotecommand/websocket.go is excluded by !vendor/**
  • vendor/k8s.io/client-go/transport/spdy/spdy.go is excluded by !vendor/**
  • vendor/k8s.io/client-go/transport/websocket/roundtripper.go is excluded by !vendor/**
  • vendor/k8s.io/client-go/util/exec/exec.go is excluded by !vendor/**
  • vendor/k8s.io/streaming/LICENSE is excluded by !vendor/**
  • vendor/k8s.io/streaming/pkg/httpstream/doc.go is excluded by !vendor/**
  • vendor/k8s.io/streaming/pkg/httpstream/httpstream.go is excluded by !vendor/**
  • vendor/k8s.io/streaming/pkg/httpstream/spdy/connection.go is excluded by !vendor/**
  • vendor/k8s.io/streaming/pkg/httpstream/spdy/roundtripper.go is excluded by !vendor/**
  • vendor/k8s.io/streaming/pkg/httpstream/spdy/upgrade.go is excluded by !vendor/**
  • vendor/k8s.io/streaming/pkg/httpstream/wsstream/conn.go is excluded by !vendor/**
  • vendor/k8s.io/streaming/pkg/httpstream/wsstream/doc.go is excluded by !vendor/**
  • vendor/k8s.io/streaming/pkg/httpstream/wsstream/stream.go is excluded by !vendor/**
  • vendor/k8s.io/streaming/pkg/runtime/runtime.go is excluded by !vendor/**
  • vendor/modules.txt is excluded by !vendor/**
📒 Files selected for processing (17)
  • demos/README.md
  • demos/cuj1-slinky-slurm.md
  • docs/contributor/validator.md
  • docs/user/component-catalog.md
  • go.mod
  • recipes/checks/slinky-slurm/health-check.yaml
  • recipes/evidence/gb200-eks-ubuntu-training.yaml
  • recipes/evidence/h100-gke-cos-training.yaml
  • recipes/overlays/h100-eks-ubuntu-training-slurm.yaml
  • recipes/overlays/h100-gke-cos-training-slurm.yaml
  • recipes/overlays/h100-kind-training-slurm.yaml
  • recipes/validators/catalog.yaml
  • validators/conformance/main.go
  • validators/conformance/pod_exec.go
  • validators/conformance/pod_exec_test.go
  • validators/conformance/slinky_slurm_health_check.go
  • validators/conformance/slinky_slurm_health_check_test.go

Comment thread demos/cuj1-slinky-slurm.md Resolved
Comment thread demos/cuj1-slinky-slurm.md Resolved
@github-actions

github-actions Bot commented Jun 22, 2026 •

Copy link
Copy Markdown
Contributor

Recipe evidence check

Affected leaf overlays: 5

Recipe Pointer Verify Digest match
gb200-eks-ubuntu-training ✅ present ✅ passed ⚠️ stale (9aeea19f5b75… vs current 07a8ff1e9d4b…)
h100-eks-ubuntu-training-slurm ⚠️ missing — —
h100-gke-cos-training-slurm ⚠️ missing — —
h100-gke-cos-training ✅ present ✅ passed ⚠️ stale (b82cade51fd2… vs current 064f27fa945d…)
h100-kind-training-slurm ⚠️ missing — —

How to refresh evidence

Run on a cluster matching the recipe's criteria:

aicr snapshot -o snapshot.yaml
aicr validate \
  -r recipes/overlays/<slug>.yaml \
  -s snapshot.yaml \
  --emit-attestation ./out \
  --push ghcr.io/<your-fork>/aicr-evidence
cp ./out/pointer.yaml recipes/evidence/<slug>.yaml

This gate is warning-only and never blocks merge. See ADR-007 for the trust model.

@github-actions

Copy link
Copy Markdown
Contributor

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

Solid, well-tested addition. The check follows project patterns closely — pkg/errors with codes, fail-closed validators.Skip on missing Slinky API and KWOK-only nodes, test-injectable seams (newPodExecExecutor, slinkyExecCommand), and genuinely thorough table-driven tests (multi-failure aggregation, malformed controllerRef, custom CR selectors). Catalog 5m timeout and the 10m→7m assert trim under the 8m envelope are reasonable and well-documented in validator.md.

Two non-blocking comments inline: one medium robustness concern on first-container exec selection (pod_exec.go), one nit on a near-duplicate component-presence helper. Neither blocks merge.

CI: ClamAV + grype green; Tier-1 e2e still running at review time — worth a glance before merge.

Comment thread validators/conformance/pod_exec.go Resolved

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

Solid, well-tested validator — clean exec seam, exact-message assertions, KWOK skip, and selector-based pod discovery. go test ./validators/conformance/... is green locally.

One thing to settle before merge: the slurm overlays declare a validation.conformance.checks block, and the recipe merge replaces the inherited conformance phase rather than appending to it (pkg/recipe/metadata.go: s.Validation.Conformance = cloneValidationPhase(other.Validation.Conformance)). Net effect — each slurm leaf resolves to conformance = [slinky-slurm-health] only, dropping the 10 checks inherited from the eks/gke training parents (platform-health, gpu-operator-health, dra-support, secure-accelerator-access, …). That may be intended, but the overlay comments and the PR testing notes ("other inherited conformance checks failed/skipped on Kind — expected") read as if the checks are additive, which they aren't. Please confirm intent and either fix the comments or re-list the checks. Details plus two smaller notes (hardcoded namespace, first-container exec) are inline.

Non-blocking: catalog image is :latest (matches every existing entry, so out of scope here).

Comment thread validators/conformance/pod_exec.go Resolved

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (4)
validators/conformance/pod_exec.go (1)

136-136: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Wrap non-exit stream failures with pkg/errors.

Line 136 returns the raw remotecommand error, so transport/stream failures lose the structured AICR error code and pod context. Wrap this path the same way the pre-stream failures are wrapped.

Suggested fix
-	return result, streamErr
+	return result, errors.Wrap(errors.ErrCodeInternal,
+		fmt.Sprintf("pod exec stream failed for %s/%s", namespace, podName), streamErr)

As per coding guidelines, “Never return bare errors — wrap all errors with context using errors.Wrap or errors.WrapWithContext.”

🤖 Prompt for 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.

In `@validators/conformance/pod_exec.go` at line 136, The return statement at line
136 returns the raw streamErr without wrapping it with pkg/errors, which causes
loss of structured AICR error codes and pod context. Wrap the streamErr using
errors.Wrap or errors.WrapWithContext (following the same pattern used for
pre-stream failures elsewhere in the function) to ensure consistent error
handling and preserve context information.

Source: Coding guidelines

validators/conformance/slinky_slurm_health_check.go (3)

254-259: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Avoid selecting a terminating or stale login pod.

Kubernetes list order is not stable. Returning the first Running/Ready pod can choose an older terminating login pod while a newer ready replacement exists, causing avoidable exec failures.

Proposed fix
 	var summary strings.Builder
-	for _, pod := range pods {
+	var selected *corev1.Pod
+	for i := range pods {
+		pod := &pods[i]
 		fmt.Fprintf(&summary, "%s phase=%s ready=%t node=%s\n",
-			pod.Name, pod.Status.Phase, podIsReady(&pod), valueOrUnknown(pod.Spec.NodeName))
-		if pod.Status.Phase == corev1.PodRunning && podIsReady(&pod) {
-			return &pod, nil
+			pod.Name, pod.Status.Phase, podIsReady(pod), valueOrUnknown(pod.Spec.NodeName))
+		if pod.DeletionTimestamp != nil || pod.Status.Phase == corev1.PodFailed {
+			continue
+		}
+		if pod.Status.Phase == corev1.PodRunning && podIsReady(pod) &&
+			(selected == nil || pod.CreationTimestamp.After(selected.CreationTimestamp.Time)) {
+			selected = pod
 		}
 	}
+	if selected != nil {
+		return selected, nil
+	}

As per coding guidelines, "Filter DeletionTimestamp != nil and PodFailed, pick by youngest CreationTimestamp when accessing pods.Items[0] after label-selector List"; this first-ready selection has the same list-order failure mode.

🤖 Prompt for 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.

In `@validators/conformance/slinky_slurm_health_check.go` around lines 254 - 259,
The current logic in the pod selection loop returns the first pod that has Phase
RunningI and is ready, but this is unreliable because Kubernetes list order is
not stable and may return a terminating pod while a newer replacement exists.
Instead of returning immediately when finding the first Running/Ready pod,
modify the loop to collect candidate pods that meet the criteria (exclude pods
with non-nil DeletionTimestamp, exclude pods with PodFailed status, and ensure
Phase is Running and podIsReady returns true), then after the loop completes,
select and return the pod with the youngest (most recent) CreationTimestamp from
the candidates. This ensures you always get the newest healthy pod rather than
the first one encountered.

Source: Coding guidelines


284-288: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Do not turn namespace 404s into skips.

discoverSlinkySetAPIs already checks API availability before this list. A NotFound here can also mean the resolved Slurm namespace is missing, so returning validators.Skip hides a broken deployment as “not applicable.”

Proposed fix
 	list, err := dynClient.Resource(gvr).Namespace(namespace).List(ctx.Ctx, metav1.ListOptions{})
 	if err != nil {
-		if apierrors.IsNotFound(err) {
-			return nil, validators.Skip(fmt.Sprintf("Slinky Slurm %s API not available", kind))
-		}
-		return nil, errors.Wrap(errors.ErrCodeInternal, fmt.Sprintf("failed to list Slinky Slurm %ss", kind), err)
+		code := errors.ErrCodeInternal
+		if apierrors.IsNotFound(err) {
+			code = errors.ErrCodeNotFound
+		}
+		return nil, errors.Wrap(code,
+			fmt.Sprintf("failed to list Slinky Slurm %ss in namespace %s", kind, namespace), err)
 	}
🤖 Prompt for 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.

In `@validators/conformance/slinky_slurm_health_check.go` around lines 284 - 288,
The error handling in the dynamic client List operation is incorrectly treating
NotFound errors as skip conditions, but since API availability is already
verified by discoverSlinkySetAPIs, a NotFound error here indicates a missing
Slinky Slurm namespace rather than an unavailable API. Remove the
apierrors.IsNotFound check and corresponding validators.Skip return statement
from the error handling block after the List call, so that NotFound errors are
treated as real errors that indicate a broken deployment rather than being
masked as "not applicable."

192-208: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Only skip KWOK when every NodeSet pod is bound to a KWOK node.

Line 194 ignores unbound NodeSet pods, but Line 207 skips when all resolved pods are KWOK. A pending/unbound worker plus one KWOK worker would bypass Slurm health validation even though not all NodeSet pods are on KWOK nodes.

Proposed fix
-	if resolved > 0 && kwok == resolved {
+	if resolved == len(pods) && kwok == resolved {
 		return validators.Skip("Slinky NodeSet pods are on KWOK nodes; skipping Slurm health validation")
 	}
🤖 Prompt for 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.

In `@validators/conformance/slinky_slurm_health_check.go` around lines 192 - 208,
The skip condition at line 207 checks whether all *resolved* pods are KWOK
nodes, but doesn't account for unbound NodeSet pods that are skipped earlier. To
fix this, count the total number of NodeSet pods at the beginning of the loop
and change the condition to check whether all pods in the list (not just
resolved ones) are on KWOK nodes. The skip should only occur when the kwok count
equals the total number of pods, ensuring that every single NodeSet pod,
including pending/unbound ones, is on a KWOK node before bypassing Slurm health
validation.
🤖 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 `@validators/conformance/slinky_slurm_health_check.go`:
- Around line 141-143: The loop iterating over slinkySlurmHealthCommands does
not check for context cancellation before launching each slinkyExecCommand call.
Add a check for ctx.Ctx.Done() at the start of each loop iteration to
immediately stop execution and return if the context has been canceled, rather
than continuing to launch remaining Kubernetes exec calls and reporting them as
failures.

---

Outside diff comments:
In `@validators/conformance/pod_exec.go`:
- Line 136: The return statement at line 136 returns the raw streamErr without
wrapping it with pkg/errors, which causes loss of structured AICR error codes
and pod context. Wrap the streamErr using errors.Wrap or errors.WrapWithContext
(following the same pattern used for pre-stream failures elsewhere in the
function) to ensure consistent error handling and preserve context information.

In `@validators/conformance/slinky_slurm_health_check.go`:
- Around line 254-259: The current logic in the pod selection loop returns the
first pod that has Phase RunningI and is ready, but this is unreliable because
Kubernetes list order is not stable and may return a terminating pod while a
newer replacement exists. Instead of returning immediately when finding the
first Running/Ready pod, modify the loop to collect candidate pods that meet the
criteria (exclude pods with non-nil DeletionTimestamp, exclude pods with
PodFailed status, and ensure Phase is Running and podIsReady returns true), then
after the loop completes, select and return the pod with the youngest (most
recent) CreationTimestamp from the candidates. This ensures you always get the
newest healthy pod rather than the first one encountered.
- Around line 284-288: The error handling in the dynamic client List operation
is incorrectly treating NotFound errors as skip conditions, but since API
availability is already verified by discoverSlinkySetAPIs, a NotFound error here
indicates a missing Slinky Slurm namespace rather than an unavailable API.
Remove the apierrors.IsNotFound check and corresponding validators.Skip return
statement from the error handling block after the List call, so that NotFound
errors are treated as real errors that indicate a broken deployment rather than
being masked as "not applicable."
- Around line 192-208: The skip condition at line 207 checks whether all
*resolved* pods are KWOK nodes, but doesn't account for unbound NodeSet pods
that are skipped earlier. To fix this, count the total number of NodeSet pods at
the beginning of the loop and change the condition to check whether all pods in
the list (not just resolved ones) are on KWOK nodes. The skip should only occur
when the kwok count equals the total number of pods, ensuring that every single
NodeSet pod, including pending/unbound ones, is on a KWOK node before bypassing
Slurm health validation.
🪄 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: ASSERTIVE

Plan: Enterprise

Run ID: 0850e163-682f-4411-984d-0a2f3981031f

📥 Commits

Reviewing files that changed from the base of the PR and between ea2b7ec and cdd1684.

📒 Files selected for processing (9)
  • pkg/recipe/metadata_store_test.go
  • recipes/overlays/h100-eks-ubuntu-training-slurm.yaml
  • recipes/overlays/h100-gke-cos-training-slurm.yaml
  • validators/conformance/pod_exec.go
  • validators/conformance/pod_exec_test.go
  • validators/conformance/robust_controller_check.go
  • validators/conformance/robust_controller_check_test.go
  • validators/conformance/slinky_slurm_health_check.go
  • validators/conformance/slinky_slurm_health_check_test.go

@kaynetu

kaynetu commented Jun 22, 2026 •

Copy link
Copy Markdown
Contributor Author

After the update, tested again on AWS H100 cluster

[cli] running validation phase: phase=conformance catalog=12 selected=1
[cli] running validator: name=slinky-slurm-health phase=conformance
[cli] validator completed: name=slinky-slurm-health status=passed
[cli] phase completed: phase=conformance status=passed validators=1 passed=1 failed=0 duration=5.967721042s
[cli] all phases completed: runID=20260622-152206-1cd5fafb3497a95f phases=1
[cli] phase result: phase=conformance status=passed duration=5.967721042s

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

Both of my earlier comments are addressed and verified at fa8e3781:

  • Container selection (pod_exec.go): selectExecContainer now honors the kubectl.kubernetes.io/default-container annotation → preferred name → index-0 fallback, is actually wired into execPodCommand, and is covered by TestSelectExecContainer (incl. the sidecar-first case).
  • Duplicate helper (slinky_slurm_health_check.go): consolidated onto the shared recipeHasComponent, which adopted the IsEnabled() gate package-wide.

Approving on that basis. Scoped to my two threads — I haven't done a full line-level pass of the rest of this large PR (other open CodeRabbit/namespace threads stand on their own).

@mchmarny
mchmarny merged commit 15c16f3 into NVIDIA:main Jun 22, 2026
154 checks passed
mohityadav8 pushed a commit to mohityadav8/aicr that referenced this pull request Jul 14, 2026
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.

3 participants