← Back to Pull requests

fix invalid ifname and add a test for webhook-whereabouts #231

Closed
unknown closed this pull request without merging on Jun 26, 2026 14:56 UTC
View on GitHub
unknown unknown commented on Jun 18, 2026 04:19 UTC
Author

<!-- Thanks for sending a pull request! Here are some tips for you:

1. If this is your first time, please read our contributor guidelines:
https://git.k8s.io/community/contributors/guide/first-contribution.md#your-first-contribution
and developer guide
https://git.k8s.io/community/contributors/devel/development.md#development-guide
2. Please label this pull request according to what type of issue you are
addressing, especially if this is a release targeted pull request. For
reference on required PR/issue labels, read here:
https://git.k8s.io/community/contributors/devel/sig-release/release.md#issuepr-kind-label
3. Ensure you have added or ran the appropriate tests for your PR:
https://git.k8s.io/community/contributors/devel/sig-testing/testing.md
4. If the PR is unfinished, see how to mark it:
https://git.k8s.io/community/contributors/guide/pull-requests.md#marking-unfinished-pull-requests
-->

What type of PR is this?

<!--
Add one of the following kinds:
/kind bug
/kind dependency
/kind cleanup
/kind documentation
/kind feature

Optionally add one or more of the following kinds if applicable:
/kind api-change
/kind deprecation
/kind failing-test
/kind flake
/kind regression
-->

/kind bug

What this PR does / why we need it:

webhook-whereabouts passes req.Device.Name verbatim as CNI_IFNAME when invoking the whereabouts IPAM plugin.
For PCI devices such as SR-IOV VFs, Device.Name is PCI-derived (pkg/names.NormalizePCIAddress: 0000:27:00.2 → pci-0000-27-00-2, 16 chars). This exceeds the CNI interface-name limit (IFNAMSIZ - 1 = 15), so CNI's interface-name validation rejects it and the IPAM ADD fails — IP allocation does not work for these devices.

This PR fixes the bug using the following approach:
Device.Name already valid (short, non-PCI names) → used verbatim;
PCI name → strip the pci- prefix (pci-0000-27-00-2 → 0000-27-00-2), re-validating the result so we never emit an over-length name on the assumption it fit;

  • anything still invalid after the above (e.g. base32-encoded non-DNS-1123 names, already unreadable upstream) → a deterministic hash as a last resort.
  • Which issue(s) this PR is related to:


    <!--
    Please link relevant issues to help with tracking.

    To automatically close the linked issue(s) when this PR is merged,
    add the word "Fixes" before the issue number or link.
    Do not use "Fixes" if the PR is of kind failing-test or flake.

    Reference KEPs when applicable in addition to specific issues.

    Examples:
    Fixes #<issue number>
    <issue link> (issue in a different repository)
    KEP: https://github.com/kubernetes/enhancements/issues/<kep-issue-number>

    If there is no associated issue, then write "N/A".
    -->

    Fixes #225

    Special notes for your reviewer:

    None.

    Does this PR introduce a user-facing change?


    <!--
    If no, just write "NONE" in the release-note block below.
    If yes, a release note is required:

    Enter your extended release note in the block below. If the PR requires
    additional action from users switching to the new release, include the string
    "action required".

    For more information on release notes see: https://git.k8s.io/community/contributors/guide/release-notes.md
    -->
    ``release-note
    NOTE
    ``

    Diff: 413 lines (+309 / -104) across 5 files Reviewer: tamilmani1989 Review duration: 12156m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.45) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.45 · 413 lines diff across 5 files
    0.45
    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%
    56%
    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.361
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #231"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% 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: 44.9% (MEDIUM) · Higher = larger blast radius
    44.9%
    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: 56.8% · Lower = rushed or shallow review
    56.8%
    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.4% · Safe to merge
    19.4%