← Back to Pull requests

api: add ipTagging to ClientTrafficPolicy #10741

Open
unknown opened this pull request with 481 lines diff across 6 files
View on GitHub
unknown unknown commented on Nov 30, 2026 18:38 UTC
Author

What this PR does / why we need it:
This is an API proposal PR introducing ipTagging under ClientTrafficPolicy.spec to expose Envoy's IP Tagging HTTPfilter (envoy.extensions.filters.http.ip_tagging.v3.IPTagging).

With ipTagging, Gateway operators can match incoming client IPs (resolved via clientIPDetection) against IPv4/IPv6 CIDR lists and attach semantic tag headers (default x-envoy-ip-tags) for downstream processing—such as HTTPRoute header-based routing, BackendTrafficPolicy rate-limit rules, authorization, or upstream inspection—while sanitizing untrusted client-supplied tag headers by default.

Proposed API Summary (api/v1alpha1/clienttrafficpolicy_types.go)


  • ClientTrafficPolicySpec.ipTagging (IPTagging, optional):

  • requestType (IPTaggingRequestType, optional, default Both): Both, Internal, or

  • External.
  • header (IPTaggingHeader, optional):

  • - name (
    string, optional, pattern ^[A-Za-z0-9-]+$): custom header name (defaults to
    x-envoy-ip-tags in Envoy when unset).
    - action (*IPTaggingHeaderAction, optional, default Sanitize): Sanitize or Append.
  • ipTags ([]IPTag, required, MinItems=1, +listType=map, +listMapKey=name):

  • - name (string, required, length 1–256): unique tag name.
    - cidrs ([]CIDR, required, MinItems=1): IPv4/IPv6 CIDR ranges mapped to name.

    Scope & Follow-up


  • This PR covers API types, generated CRDs/deepcopy/docs, and CEL validation tests (test/cel-validation/clienttrafficpolicy_test.go) for API review first. - IR/GatewayAPI/xDS translation (internal/ir, internal/gatewayapi, internal/xds/translator) and file-based ip_tags_datasource are intentionally deferred to follow-up implementation once the API is agreed upon.
  • Which issue(s) this PR fixes:
    Relates to #5198

    ---

    PR Checklist

  • Authorship & ownership: Coding agents / AI assistants are welcome, but I have reviewed every change, understand how and why it works, can explain and maintain it, and take full responsibility for this PR. I have not submitted generated output I do not understand.

  • DCO: All commits are signed off (git commit -s). See DCO: Sign your work.

  • API agreed first: If this PR contains API changes (changes under /api), the API was discussed and agreed before the implementation. The API change can be in a separate PR, or in the same PR, but the API must be agreed before implementation. N/A if this PR does not contain API changes.

  • Required checks pass: make generate gen-check, make lint, and the unit-test/coverage build pass. (Flaky e2e failures are not considered breakages, but gen-check, lint, and coverage MUST pass.)

  • Tests added/updated: New/changed code is covered by appropriate tests. N/A if this PR does not contain code changes.

  • Docs: User-facing changes update the

  • docs, either in this PR or a follow-up PR. N/A if this PR does not contain user-facing changes.
  • Release notes: N/A: API proposal only; release note will be added with the implementation PR.

  • Generated files committed: Ran make gen-check and committed the result if API/helm charts/modules changed.

  • Scope & compatibility: The PR is reasonably scoped (no unrelated changes) and preserves backward compatibility, or any breaking change is called out above and documented in release-notes/current/breaking_changes/.

  • Codex review: Requested a Codex review and addressed all of its comments.

  • Copilot review: Requested a Copilot review and addressed all of its comments.
  • Diff: 481 lines (+360 / -121) across 6 files Reviewer: zirain Review duration: 1391m
    All Vouch review confidence checks passed
    Residual risk 0.25 = Change Risk (0.47) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.47 · 481 lines diff across 6 files
    0.47
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    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.370
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #10741"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% 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: 47.3% (MEDIUM) · Higher = larger blast radius
    47.3%
    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: 46.7% · Lower = rushed or shallow review
    46.7%
    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: 25.2% · Safe to merge
    25.2%