Skip to content

fix(config): validate EnvoyProxySpec in EnvoyGateway - #9961

Open
zirain wants to merge 3 commits into
envoyproxy:mainfrom
zirain:envoyproxy-type
Open

fix(config): validate EnvoyProxySpec in EnvoyGateway#9961
zirain wants to merge 3 commits into
envoyproxy:mainfrom
zirain:envoyproxy-type

Conversation

@zirain

@zirain zirain commented Sep 7, 2026

Copy link
Copy Markdown
Member

fixes: #9956

  1. validate EnvoyProxy in EnvoyGateway
  2. print the effective configuration for better debugging

Signed-off-by: zirain <zirain2009@gmail.com>
@zirain
zirain requested a review from a team as a code owner September 7, 2026 01:01
@netlify

netlify Bot commented Sep 7, 2026

Copy link
Copy Markdown

Deploy Preview for cerulean-figolla-1f9435 ready!

Name Link
🔨 Latest commit 5487328
🔍 Latest deploy log https://app.netlify.com/projects/cerulean-figolla-1f9435/deploys/6a9e20b5b6a94d0008277776
😎 Deploy Preview https://deploy-preview-9961--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.

Signed-off-by: zirain <zirain2009@gmail.com>

@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: 4828415db6

ℹ️ 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".


cfgCopy := r.snapshotConfig()
if cfgCopy != nil && cfgCopy.EnvoyGateway != nil {
r.logger.Info("running hook", "envoyGateway", cfgCopy.EnvoyGateway.EnvoyGatewaySpec)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Avoid logging the complete effective configuration

When envoyProxy.bootstrap.value or a raw Kubernetes workload patch contains inline credentials or other sensitive values, this Info-level log reflect-serializes the entire EnvoyGatewaySpec on every startup or reload, exposing those values to anyone with access to controller logs. Log only non-sensitive identifiers here, or move a redacted representation behind debug-level logging.

Useful? React with 👍 / 👎.

Comment on lines +79 to +82
if eg.EnvoyProxy != nil {
if err := validateEnvoyProxySpec(eg.EnvoyProxy); err != nil {
return fmt.Errorf("invalid EnvoyProxy template: %w", err)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Validate embedded bootstrap overrides before accepting config

When the file-backed default contains an invalid or prohibited envoyProxy.bootstrap override, this call still succeeds because validateEnvoyProxySpec explicitly skips bootstrap validation. Standalone EnvoyProxy resources additionally pass through bootstrap.Validate in internal/gatewayapi/translator.go, but the merged default spec is never sent through that path; an override that changes dynamic_resources or the xDS cluster can therefore be accepted and leave Envoy unable to connect to the control plane. Add the internal bootstrap validation in the config-loading validation path.

Useful? React with 👍 / 👎.

Comment on lines +79 to +82
if eg.EnvoyProxy != nil {
if err := validateEnvoyProxySpec(eg.EnvoyProxy); err != nil {
return fmt.Errorf("invalid EnvoyProxy template: %w", err)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Enforce EnvoyProxy CEL invariants for file configuration

When the embedded default sets mergeGateways: true together with mergeBackends: {}, the new validation returns nil because the mutual-exclusion rule exists only as an EnvoyProxy CRD CEL annotation and validateEnvoyProxySpec does not mirror it. EnvoyGateway files do not pass through Kubernetes admission, so the controller accepts the configuration and the translator subsequently marks every affected Gateway NotAccepted for this exact conflict. Mirror the EnvoyProxy CEL invariants in the validation used for embedded file configuration.

Useful? React with 👍 / 👎.

@codecov

codecov Bot commented Sep 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 81.33%. Comparing base (56518d2) to head (5487328).

Files with missing lines Patch % Lines
...nternal/envoygateway/config/loader/configloader.go 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9961      +/-   ##
==========================================
- Coverage   81.34%   81.33%   -0.01%     
==========================================
  Files         264      264              
  Lines       40967    40972       +5     
==========================================
  Hits        33326    33326              
- Misses       7640     7645       +5     
  Partials        1        1              

☔ 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.

Signed-off-by: zirain <zirain2009@gmail.com>
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.

EnvoyProxy in EnvoyGateway without type cause infra error

1 participant