Skip to content

feat: mergeType in envoy extension policy#9047

Draft
kkk777-7 wants to merge 1 commit into
envoyproxy:mainfrom
kkk777-7:feat-merge-eep
Draft

feat: mergeType in envoy extension policy#9047
kkk777-7 wants to merge 1 commit into
envoyproxy:mainfrom
kkk777-7:feat-merge-eep

Conversation

@kkk777-7
Copy link
Copy Markdown
Member

@kkk777-7 kkk777-7 commented May 20, 2026

What this PR does / why we need it:

Support mergeType in EEP.
Before implementing #8092 , I'd like to support this.

Which issue(s) this PR fixes:

Fixes #6733

Release Notes: Yes

@netlify
Copy link
Copy Markdown

netlify Bot commented May 20, 2026

Deploy Preview for cerulean-figolla-1f9435 ready!

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

@codecov
Copy link
Copy Markdown

codecov Bot commented May 20, 2026

Codecov Report

❌ Patch coverage is 80.95238% with 40 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.77%. Comparing base (dd3fe7b) to head (a31dda1).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
internal/gatewayapi/envoyextensionpolicy.go 80.19% 32 Missing and 8 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9047      +/-   ##
==========================================
- Coverage   74.78%   74.77%   -0.02%     
==========================================
  Files         252      252              
  Lines       40567    40696     +129     
==========================================
+ Hits        30340    30430      +90     
- Misses       8157     8190      +33     
- Partials     2070     2076       +6     

☔ View full report in Codecov by Sentry.
📢 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: kkk777-7 <kota.kimura0725@gmail.com>
@kkk777-7
Copy link
Copy Markdown
Member Author

@codex

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

// Set conditions for translation error if it got any
if err := t.translateEnvoyExtensionPolicyForGateway(policy, currTarget, targetedGateway, xdsIR, resources); err != nil {
status.SetTranslationErrorForPolicyAncestor(&policy.Status,

P2 Badge Reject mergeType on Gateway-targeted policies

The new API field documents that mergeType is only valid for route-targeted EnvoyExtensionPolicies, but Gateway/Listener-targeted policies are still translated normally with no validation gate. In practice, a misconfigured policy with mergeType + Gateway target will be accepted and applied instead of being marked invalid, which violates the API contract and makes configuration errors hard to detect.

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

return ""
}

func getOverriddenTargetsMessageForGateway(
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

now, this function isn't used by anyplace.

@kkk777-7 kkk777-7 marked this pull request as ready for review May 23, 2026 09:42
@kkk777-7 kkk777-7 requested a review from a team as a code owner May 23, 2026 09:42
@kkk777-7
Copy link
Copy Markdown
Member Author

/retest

@kkk777-7 kkk777-7 added this to the v1.9.0-rc.1 Release milestone May 23, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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: a31dda10c0

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

// This field cannot be set when targeting a parent resource (Gateway).
// If unset, no merging occurs, and only the most specific configuration takes effect.
//
// +kubebuilder:validation:XValidation:rule="self != 'Replace'",message="Replace is not a valid MergeType for EnvoyExtensionPolicy"
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 Reject mergeType on Gateway-targeted policies

The spec comment added for MergeType says it "cannot be set when targeting a parent resource (Gateway)", but the only validation here is self != 'Replace', so Gateway-targeted EnvoyExtensionPolicy objects with mergeType: StrategicMerge/JSONMerge are still admitted. At runtime those policies are processed by processEnvoyExtensionPolicyForGateway without any MergeType guard (so merge intent is effectively ignored), which creates a silent misconfiguration path for users. Please add a CEL/runtime validation that forbids mergeType when any target ref resolves to kind: Gateway.

Useful? React with 👍 / 👎.

@zirain
Copy link
Copy Markdown
Member

zirain commented May 23, 2026

what will happen if I have multiple EEPs target to a same HTTPRoute?
Can them be merged?

@kkk777-7
Copy link
Copy Markdown
Member Author

what will happen if I have multiple EEPs target to a same HTTPRoute? Can them be merged?

currently, we don't support merging same resource level in all policies.
so, now in this PR, we can't merge them.

@kkk777-7 kkk777-7 marked this pull request as draft May 24, 2026 09:28
@kkk777-7
Copy link
Copy Markdown
Member Author

zirain and I are discussing about future merge logic in slack.
so revert to draft.

@kkk777-7 kkk777-7 removed this from the v1.9.0-rc.1 Release milestone May 27, 2026
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.

Support MergeType in EnvoyExtensionPolicy

2 participants