Skip to content

fix: validate tracing provider completeness after EnvoyProxy merge instead of at admission - #9641

Open
kadircanyildirm-crypto wants to merge 4 commits into
envoyproxy:mainfrom
kadircanyildirm-crypto:fix/tracing-cel-strategic-merge
Open

fix: validate tracing provider completeness after EnvoyProxy merge instead of at admission#9641
kadircanyildirm-crypto wants to merge 4 commits into
envoyproxy:mainfrom
kadircanyildirm-crypto:fix/tracing-cel-strategic-merge

Conversation

@kadircanyildirm-crypto

@kadircanyildirm-crypto kadircanyildirm-crypto commented Aug 2, 2026

Copy link
Copy Markdown

What this PR does

Removes the host or backendRefs needs to be set CEL rule from TracingProvider and enforces completeness in processTracing instead, after the GatewayClass-level and Gateway-level EnvoyProxy configs are merged. An incomplete merged provider now surfaces as an InvalidParameters Gateway condition rather than an admission failure, so a per-Gateway EnvoyProxy can override a single field (e.g. serviceName) and inherit the rest via mergeType: StrategicMerge.

Follows the approach suggested by @zirain in the issue.

Fixes #9527

Notes

  • The same CEL rule exists on the metrics sink and access log sink types; left untouched to keep this diff small — happy to follow up if wanted.
  • Was opened as draft while CI settled; the generated CRD and helm snapshots are regenerated and checks are clean, so marking it ready.
  • Developed with AI assistance (Claude Code), reviewed and understood per the contributing guide's generative AI policy.

🤖 Generated with Claude Code

@netlify

netlify Bot commented Aug 2, 2026

Copy link
Copy Markdown

Deploy Preview for cerulean-figolla-1f9435 ready!

Name Link
🔨 Latest commit 14f4852
🔍 Latest deploy log https://app.netlify.com/projects/cerulean-figolla-1f9435/deploys/6a7446ca3d439e000872ab48
😎 Deploy Preview https://deploy-preview-9641--cerulean-figolla-1f9435.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@arkodg
arkodg requested a review from zirain August 3, 2026 01:17
@codecov

codecov Bot commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.05%. Comparing base (8dcac65) to head (4ded8cc).
⚠️ Report is 20 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9641      +/-   ##
==========================================
+ Coverage   76.04%   76.05%   +0.01%     
==========================================
  Files         259      260       +1     
  Lines       43258    43366     +108     
==========================================
+ Hits        32896    32984      +88     
- Misses       8174     8182       +8     
- Partials     2188     2200      +12     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kadircanyildirm-crypto
kadircanyildirm-crypto marked this pull request as ready for review August 4, 2026 12:07
@kadircanyildirm-crypto
kadircanyildirm-crypto requested a review from a team as a code owner August 4, 2026 12:07
@zirain

zirain commented Aug 5, 2026

Copy link
Copy Markdown
Member

@codex review

// Validated here instead of by a CRD CEL rule so that a partial provider
// (e.g. only serviceName) can be completed by the GatewayClass-level and
// Gateway-level EnvoyProxy merge before the check runs.
if tracing.Provider.Host == nil {

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.

will this block the whole fleet provisioning, can we add a warning message instead of blocking it?

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4ded8cc6f1

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +39 to +42
// A provider is only required to set host or backendRefs after the
// GatewayClass-level and Gateway-level EnvoyProxy configs are merged
// (see EnvoyProxySpec.MergeType), so completeness is validated during
// translation instead of by a CEL rule here.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve the inherited tracing provider type

With this admission relaxation, a Gateway EnvoyProxy can now set only provider.serviceName and rely on merge to inherit the rest, but provider.type is still defaulted to OpenTelemetry before the EnvoyProxy merge. If the GatewayClass provider is Datadog or Zipkin and the Gateway override omits type, the stored override carries type: OpenTelemetry, so the merge changes the provider kind instead of only overriding serviceName; xDS generation then builds the wrong tracing provider. The merge path needs to distinguish an omitted/defaulted type from an intentional override, or this partial-provider path should not be allowed for inherited non-OpenTelemetry providers.

Useful? React with 👍 / 👎.

Comment thread internal/gatewayapi/listener.go Outdated
Comment on lines +997 to +999
// Validated here instead of by a CRD CEL rule so that a partial provider
// (e.g. only serviceName) can be completed by the GatewayClass-level and
// Gateway-level EnvoyProxy merge before the check runs.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Resolve inherited backendRefs in their source namespace

This new partial-provider path is documented as being completed by the GatewayClass/Gateway EnvoyProxy merge, but inherited backendRefs with no explicit namespace are later resolved relative to the merged EnvoyProxy's namespace. When a Gateway override now sets only serviceName and inherits a GatewayClass provider whose backendRef omits namespace, the merged object has the Gateway-level EnvoyProxy namespace, so the collector is looked up in the Gateway namespace and the Gateway is marked invalid even though the class-level reference was valid. Preserve the source EnvoyProxy namespace for inherited refs or rewrite/default namespaces during merge.

Useful? React with 👍 / 👎.

kadircanyildirm-crypto and others added 3 commits August 6, 2026 10:36
Drop the 'host or backendRefs needs to be set' CEL rule from
TracingProvider so a per-Gateway EnvoyProxy can override a single
field (e.g. serviceName) and inherit the rest via mergeType. The
completeness check now runs in processTracing after the
GatewayClass-level and Gateway-level configs are merged, surfacing
an InvalidParameters Gateway condition instead of an admission error.

Fixes envoyproxy#9527

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Kadir Can Yildirim <252162627+kadircanyildirm-crypto@users.noreply.github.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Kadir Can Yildirim <252162627+kadircanyildirm-crypto@users.noreply.github.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Kadir Can Yildirim <252162627+kadircanyildirm-crypto@users.noreply.github.com>
@kadircanyildirm-crypto
kadircanyildirm-crypto force-pushed the fix/tracing-cel-strategic-merge branch from 4ded8cc to 1e85b90 Compare August 6, 2026 08:12
@kadircanyildirm-crypto

Copy link
Copy Markdown
Author

Rebased onto current main, no content change.

The red checks on the previous run were not from this PR. BackendTLSPolicySANValidation fails the same way on main (run 31067661691), osv-scan was flagging dependency versions that main has since bumped, and the five e2e jobs each failed on a different unrelated test (MultipleGC, PreserveCase, WeightedRoute, OIDC, RateLimitGlobalSharedCidrMatch). None of those configure tracing, so processTracing never runs for them.

@zirain this is ready whenever you have time.

An incomplete tracing provider now turns tracing off for that Gateway
instead of setting Accepted=False, so an observability misconfiguration
does not stop the proxy from being provisioned.

Signed-off-by: Kadir Can Yildirim <252162627+kadircanyildirm-crypto@users.noreply.github.com>
@kadircanyildirm-crypto

Copy link
Copy Markdown
Author

@zirain switched to a warning — an incomplete provider now logs and skips tracing for that Gateway instead of setting Accepted=False, so provisioning is not blocked.

Codex's two findings are both real. I reproduced them with the exact config from #9527: class proxy with type: Datadog and backendRefs in envoy-gateway-system, Gateway proxy in app-ns overriding only serviceName. The merged result is:

mergedNamespace="app-ns"  type="OpenTelemetry"  serviceName="my-custom-service"  backendRefs=1
backendRef namespace=<nil>

type is +kubebuilder:default=OpenTelemetry with no omitempty, so it is always present in the merge patch and replaces Datadog; and the merged proxy carries the Gateway proxy's namespace, so the inherited backendRef is looked up in app-ns instead of envoy-gateway-system. Relaxing the CEL rule alone does not make the issue's own example work.

Do you want the type fix in this PR (make it optional and default it during translation), and the namespace one as a separate PR since it applies to accessLog and metrics backendRefs too?

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.

EnvoyProxy CRD validation blocks per-Gateway tracing overrides that rely on merged backendRefs

2 participants