Skip to content

API: add runtime guards for risky behavior changes to EnvoyGateway#6556

Merged
zhaohuabing merged 4 commits intoenvoyproxy:mainfrom
zhaohuabing:feature-gate
Jul 23, 2025
Merged

API: add runtime guards for risky behavior changes to EnvoyGateway#6556
zhaohuabing merged 4 commits intoenvoyproxy:mainfrom
zhaohuabing:feature-gate

Conversation

@zhaohuabing
Copy link
Copy Markdown
Member

@zhaohuabing zhaohuabing commented Jul 18, 2025

This PR introduces a mechanism to gate breaking changes or experimental features in new Envoy Gateway releases. e.g. changing the naming of the xDS listener, which can cause incompatible changes to existing EnvoyPatchPolicies and ExtensionManager implementations.

Each flag may be enabled or disabled by default and can be toggled through the EnvoyGateway resource.
The names of these flags will be included in the release notes alongside an explanation of the change.
These flags are temporary and will be removed in future releases once the features are stable.

Release Notes: No. The release note for the first runtime flag will be included in #6544.

Inspired by Envoy runtime flag: https://github.com/envoyproxy/envoy/blob/main/CONTRIBUTING.md#runtime-guarding

The implementation will be included in #6544.

@zhaohuabing zhaohuabing requested a review from a team as a code owner July 18, 2025 04:34
@codecov
Copy link
Copy Markdown

codecov bot commented Jul 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 71.17%. Comparing base (e85bfc3) to head (19eb4b1).
Report is 21 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6556      +/-   ##
==========================================
+ Coverage   71.11%   71.17%   +0.05%     
==========================================
  Files         220      220              
  Lines       37970    37985      +15     
==========================================
+ Hits        27003    27036      +33     
+ Misses       9393     9378      -15     
+ Partials     1574     1571       -3     

☔ 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: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
@zhaohuabing zhaohuabing marked this pull request as draft July 18, 2025 05:19
// The names of these flags will be included in the release notes alongside an explanation of the change.
// Please note that these flags are temporary and will be removed in future releases once the features are stable.
type FeatureFlags struct {
Enabled []string `json:"enabled,omitempty"`
Copy link
Copy Markdown
Contributor

@arkodg arkodg Jul 19, 2025

Choose a reason for hiding this comment

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

  featureFlags:
  - name: UseAddrPortAsListenerName
    enabled: true

or

  featureFlags:
    enabled: 
    - UseAddrPortAsListenerName

cc @envoyproxy/gateway-maintainers @envoyproxy/gateway-reviewers

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.

Tough choice: option 2 is a bit easier to understand at first glance, and option 1 is more future-proof.

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.

options 2 is a clear approach, featureGates is about disable/enable.

Option1 is to make each feature is a struct, but I don't think we need to expand more fields besides enable/disable.

So I am +1 for option2

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.

option 1 feels more natural to me, prefer to have opt-in feature flags
we might do it similarly to the standard k8s feature flags, but we might not have so many feature gates in the end 👀
https://github.com/kubernetes/component-base/blob/master/featuregate/feature_gate.go

Copy link
Copy Markdown
Member Author

@zhaohuabing zhaohuabing Jul 21, 2025

Choose a reason for hiding this comment

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

In Kubernetes, most new or experimental features are introduced behind feature gates—which makes a lot of sense. Kubernetes has been around for over 10 years and has a massive user base, so they need to be extremely careful with any changes that could impact stability or compatibility.

EG is still evolving rapidly. For us, a “feature gate” is less about enabling experimental APIs and more about introducing runtime guards to control risky or breaking behavior changes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should we then rename it to runtime flags or guard to highlight this is not around feature enablement but around modifying runtime behavior thats not exposed via an API

Copy link
Copy Markdown
Member

@rudrakhp rudrakhp Jul 22, 2025

Choose a reason for hiding this comment

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

+1 to option 2, even better if we can just have the flags directly as everything is supposed to be a boolean gate if named and used correctly, example:

runtimeFlags:
- enableUseAddrPortAsListenerName

Anything else that takes in a dynamic value as input should ideally be part of API.

Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
@zhaohuabing zhaohuabing marked this pull request as ready for review July 21, 2025 09:59
@zhaohuabing zhaohuabing changed the title API: add feature gate to EnvoyGateway API: add runtime guards for risky behavior changes to EnvoyGateway Jul 21, 2025
Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>

// RuntimeFlags defines the runtime flags for Envoy Gateway.
// Unlike ExtensionAPIs, these flags are temporary and will be removed in future releases once the related features are stable.
RuntimeFlags *RuntimeFlags `json:"runtimeFlags,omitempty"`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

+1

RuntimeFlags *RuntimeFlags `json:"runtimeFlags,omitempty"`
}

// RuntimeFlag defines a runtime flag for Envoy Gateway.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

validation tag

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.

Repharse:

// RuntimeFlag defines a runtime flag used to guard breaking changes or risky experimental features in new Envoy Gateway releases.
// A runtime flag may be enabled or disabled by default and can be toggled through the EnvoyGateway resource.

@arkodg arkodg requested review from a team July 22, 2025 00:18
Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
@zhaohuabing zhaohuabing requested a review from arkodg July 22, 2025 00:43
Copy link
Copy Markdown
Member

@Xunzhuo Xunzhuo left a comment

Choose a reason for hiding this comment

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

/lgtm


// RuntimeFlag defines a runtime flag used to guard breaking changes or risky experimental features in new Envoy Gateway releases.
// A runtime flag may be enabled or disabled by default and can be toggled through the EnvoyGateway resource.
type RuntimeFlag string
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we add a validation tag here

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.

Oh sorry I misunderstood your comment - will add it in the implementation PR.

@zhaohuabing zhaohuabing merged commit 0caad43 into envoyproxy:main Jul 23, 2025
31 checks passed
@zhaohuabing zhaohuabing deleted the feature-gate branch July 23, 2025 00:56
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.

5 participants