fix(operator): rename skyhook -> nodewright in fmt.Errorf text - #414
fix(operator): rename skyhook -> nodewright in fmt.Errorf text#414mohityadav8 wants to merge 6 commits into
Conversation
Part 2/3 of NVIDIA#403 -- error text surfaced to callers via wrapped errors. Event/condition text landed in PR1, log messages/keys are PR3. Refs NVIDIA#403 Signed-off-by: Mohit Yadav <ymohit799057@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Enterprise Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughController and DAL error messages now use NodeWright terminology instead of Skyhook terminology. Legacy workload reconciliation now queries legacy node-metadata ConfigMaps, relabels matching objects, and removes package ConfigMap discovery and reparenting. Estimated code review effort: 3 (Moderate) | ~20 minutes Mergeability Score: ⚪ Minimal · up to This change renames surfaced error text without introducing an actionable merge-blocking risk in the supplied evidence; it is merge-ready after normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Head branch was pushed to by a user without write access
|
@lockwobr their was a conflict in oine file so i resolved that can u run workflow again |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
operator/internal/controller/skyhook_controller.go (2)
768-780: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winReport ConfigMap mutations through
workloadsChanged.Line 777 updates a ConfigMap, but
changedremains false. If legacy ConfigMaps are the only objects changed,HandleMigrationsleavesupdatesfalse despite writing cluster state.Set
changed = trueafter a successfulr.Update.Proposed fix
if mutated { if err := r.Update(ctx, cm); err != nil { return false, false, fmt.Errorf("updating legacy configmap labels [%s]: %w", cm.Name, err) } + changed = true }🤖 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 `@operator/internal/controller/skyhook_controller.go` around lines 768 - 780, Set changed = true after the successful r.Update call in the ConfigMap mutation loop, before continuing iteration, so HandleMigrations reports updates when relabelLegacyMetadataPrefix or addNodeWrightMetaLabel modifies ConfigMaps.
692-700: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse the declared label-key constants.
Use
legacyNameLabelandlegacyNodeMetaLabelin the pod and ConfigMap selectors. This removes duplicated label-key construction and makes the selectors match the documented legacy keys.As per coding guidelines, extract repeated literals such as label values into named constants near their owner.
Proposed refactor
- client.MatchingLabels{fmt.Sprintf("%s/name", legacyMetadataPrefix): skyhookName}); err != nil { + client.MatchingLabels{legacyNameLabel: skyhookName}); err != nil { ... - client.MatchingLabels{fmt.Sprintf("%s/skyhook-node-meta", legacyMetadataPrefix): skyhookName}); err != nil { + client.MatchingLabels{legacyNodeMetaLabel: skyhookName}); err != nil {Also applies to: 741-743, 760-763
🤖 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 `@operator/internal/controller/skyhook_controller.go` around lines 692 - 700, Replace duplicated legacy label-key construction in the pod and ConfigMap selectors with the declared constants legacyNameLabel and legacyNodeMetaLabel. Update the selector logic near the affected ranges while preserving the existing resource-kind behavior, and extract any repeated label values into named constants near their owner.Source: Coding guidelines
🤖 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.
Outside diff comments:
In `@operator/internal/controller/skyhook_controller.go`:
- Around line 768-780: Set changed = true after the successful r.Update call in
the ConfigMap mutation loop, before continuing iteration, so HandleMigrations
reports updates when relabelLegacyMetadataPrefix or addNodeWrightMetaLabel
modifies ConfigMaps.
- Around line 692-700: Replace duplicated legacy label-key construction in the
pod and ConfigMap selectors with the declared constants legacyNameLabel and
legacyNodeMetaLabel. Update the selector logic near the affected ranges while
preserving the existing resource-kind behavior, and extract any repeated label
values into named constants near their owner.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Enterprise
Run ID: f4a34bf1-4ff6-4415-b99d-a1dfa4c7f204
📒 Files selected for processing (1)
operator/internal/controller/skyhook_controller.go
ayuskauskas
left a comment
There was a problem hiding this comment.
The -70 in operator/internal/controller/skyhook_controller.go isn't part of the rename — it reverts code that's already on main.
Where it came from
f49c695a ("Merge branch 'main' into fix/403-errorf-text-rename") merged main at 84df6448 = #380 (repair three Skyhook to NodeWright migration defects), which rewrote reconcileLegacyLabeledWorkloads. That conflicted with the rename touching the same function, and the resolution kept the branch's pre-#380 side. git diff 84df6448 f49c695a shows the same +35 -70 on this file, so the merge itself dropped the code — no later commit did.
What's lost
- The two-key legacy ConfigMap sweep.
mainlists legacy ConfigMaps by both<legacy>/skyhook-node-metaand<legacy>/name(two Lists, sinceMatchingLabelsANDs its terms, plus a dedupe set). This branch lists onlyskyhook-node-meta, so package ConfigMaps — which carry<legacy>/name— never converge.UpsertConfigmapslists by the new<nodewright>/namelabel, doesn't find them, falls through toCreate, and failsAlreadyExistson every reconcile. That is the wedged-upgrade defect #380 fixed; the comment explaining it is deleted along with the code. - The
reparentToNodeWrightcall on those ConfigMaps. Legacyskyhook.nvidia.comownerReferences stay in place, so the migration guide's "delete the old Skyhook CR" step cascade-deletes the package and per-node metadata ConfigMaps out from under the live NodeWright. changed = trueafter a successful ConfigMapUpdate. The ConfigMap is updated butchangedis never set, soworkloadsChangedcomes back false andHandleMigrationsdoesn't record the update.
Side effects: the pod List reverts to inline fmt.Sprintf("%s/name", legacyMetadataPrefix) instead of the legacyNameLabel constant, and at head legacyNodeMetaLabel, legacyNameLabel, and the entire reparentToNodeWright helper are dead — declared, never referenced. It still compiles (unused consts are legal in Go), which is why CI is green.
Suggested fix
Take main's version of the file and re-apply only the string renames on top:
git checkout origin/main -- operator/internal/controller/skyhook_controller.go
# re-apply the ~10 fmt.Errorf skyhook->nodewright edits, then:
git diff origin/main -- operator/internal/controller/skyhook_controller.go # should be text-onlyWorth re-checking the other three files the same way — they're small and look clean, but they went through the same merges.
| return false, false, fmt.Errorf("updating legacy configmap labels [%s]: %w", cm.Name, err) | ||
| } | ||
| changed = true | ||
| cms := &corev1.ConfigMapList{} |
There was a problem hiding this comment.
This block is a revert of #380, not a rename. On main this sweeps legacy ConfigMaps by both <legacy>/skyhook-node-meta and <legacy>/name (two Lists + dedupe, because MatchingLabels ANDs), and calls reparentToNodeWright on each. Here only skyhook-node-meta is listed, so package ConfigMaps labeled <legacy>/name never converge and UpsertConfigmaps wedges on AlreadyExists; legacy ownerReferences also survive, making these ConfigMaps cascade-delete bait when the old Skyhook CR is removed.
The changed = true after a successful r.Update(ctx, cm) is also gone, so workloadsChanged returns false even when ConfigMaps were relabeled.
It came in via the f49c695a merge of main@84df6448 — restoring main's version of this function and re-applying just the fmt.Errorf renames should resolve it.
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
|
@mohityadav8 Can you please fix the merge issue that @ayuskauskas found above, want to merge this. |
yes today i will fix this and and complete the remaining third part of the issue |
Part 2/3 of #403 -- error text surfaced to callers via wrapped errors. Event/condition text landed in PR1, log messages/keys are PR3.
Refs #403