Skip to content

Commit 5ef28e1

Browse files
committed
update api
Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
1 parent 5996876 commit 5ef28e1

File tree

10 files changed

+107
-100
lines changed

10 files changed

+107
-100
lines changed

api/v1alpha1/envoygateway_helpers.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,27 +109,27 @@ func (e *EnvoyGateway) GatewayNamespaceMode() bool {
109109
*e.Provider.Kubernetes.Deploy.Type == KubernetesDeployModeTypeGatewayNamespace
110110
}
111111

112-
// featureFlags are the default feature flags for Envoy Gateway.
113-
var featureFlags = map[FeatureFlag]bool{
114-
FeatureUseAddressAsListenerName: false,
112+
// runtimeFlags are the default runtime flags for Envoy Gateway.
113+
var runtimeFlags = map[RuntimeFlag]bool{
114+
UseAddressAsListenerName: false,
115115
}
116116

117-
// IsFeatureEnabled checks if a feature is enabled in the EnvoyGateway configuration.
118-
func (f *FeatureFlags) IsFeatureEnabled(feature FeatureFlag) bool {
117+
// IsEnabled checks if a runtime flag is enabled in the EnvoyGateway configuration.
118+
func (f *RuntimeFlags) IsEnabled(flag RuntimeFlag) bool {
119119
if f != nil {
120120
for _, disable := range f.Disabled {
121-
if disable == feature {
121+
if disable == flag {
122122
return false
123123
}
124124
}
125125
for _, enable := range f.Enabled {
126-
if enable == feature {
126+
if enable == flag {
127127
return true
128128
}
129129
}
130130
}
131131

132-
if enabled, found := featureFlags[feature]; found {
132+
if enabled, found := runtimeFlags[flag]; found {
133133
return enabled
134134
}
135135
return false

api/v1alpha1/envoygateway_types.go

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -94,26 +94,27 @@ type EnvoyGatewaySpec struct {
9494
// +optional
9595
ExtensionAPIs *ExtensionAPISettings `json:"extensionApis,omitempty"`
9696

97-
// FeatureFlags defines the feature flags for Envoy Gateway.
98-
// Unlike ExtensionAPIs, these flags are temporary and will be removed in future releases once the features are stable.
99-
FeatureFlags *FeatureFlags `json:"featureFlags,omitempty"`
97+
// RuntimeFlags defines the runtime flags for Envoy Gateway.
98+
// Unlike ExtensionAPIs, these flags are temporary and will be removed in future releases once the related features are stable.
99+
RuntimeFlags *RuntimeFlags `json:"runtimeFlags,omitempty"`
100100
}
101101

102-
// FeatureFlag defines a feature flag for Envoy Gateway.
103-
type FeatureFlag string
102+
// RuntimeFlag defines a runtime flag used to guard breaking changes or risky experimental features in new Envoy Gateway releases.
103+
// A runtime flag may be enabled or disabled by default and can be toggled through the EnvoyGateway resource.
104+
type RuntimeFlag string
104105

105106
const (
106-
// FeatureUseAddressAsListenerName indicates that the listener name should be derived from the address and port.
107-
FeatureUseAddressAsListenerName FeatureFlag = "UseAddressAsListenerName"
107+
// UseAddressAsListenerName indicates that the listener name should be derived from the address and port.
108+
UseAddressAsListenerName RuntimeFlag = "UseAddressAsListenerName"
108109
)
109110

110-
// FeatureFlags provide a mechanism to gate breaking changes or experimental features in new Envoy Gateway releases.
111+
// RuntimeFlags provide a mechanism to guard breaking changes or risky experimental features in new Envoy Gateway releases.
111112
// Each flag may be enabled or disabled by default and can be toggled through the EnvoyGateway resource.
112113
// The names of these flags will be included in the release notes alongside an explanation of the change.
113-
// Please note that these flags are temporary and will be removed in future releases once the features are stable.
114-
type FeatureFlags struct {
115-
Enabled []FeatureFlag `json:"enabled,omitempty"`
116-
Disabled []FeatureFlag `json:"disabled,omitempty"`
114+
// Please note that these flags are temporary and will be removed in future releases once the related features are stable.
115+
type RuntimeFlags struct {
116+
Enabled []RuntimeFlag `json:"enabled,omitempty"`
117+
Disabled []RuntimeFlag `json:"disabled,omitempty"`
117118
}
118119

119120
type KubernetesClient struct {

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 28 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/xds/translator/listener.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ func buildXdsTCPListener(
193193
keepalive *ir.TCPKeepalive,
194194
connection *ir.ClientConnection,
195195
accesslog *ir.AccessLog,
196-
featureFlags *egv1a1.FeatureFlags,
196+
useAddressAsListenerName bool,
197197
) (*listenerv3.Listener, error) {
198198
socketOptions := buildTCPSocketOptions(keepalive)
199199
al, err := buildXdsAccessLog(accesslog, ir.ProxyAccessLogTypeListener)
@@ -203,7 +203,7 @@ func buildXdsTCPListener(
203203
bufferLimitBytes := buildPerConnectionBufferLimitBytes(connection)
204204
maxAcceptPerSocketEvent := buildMaxAcceptPerSocketEvent(connection)
205205
listener := &listenerv3.Listener{
206-
Name: xdsListenerName(name, address, port, featureFlags),
206+
Name: xdsListenerName(name, address, port, useAddressAsListenerName),
207207
AccessLog: al,
208208
SocketOptions: socketOptions,
209209
PerConnectionBufferLimitBytes: bufferLimitBytes,
@@ -229,8 +229,8 @@ func buildXdsTCPListener(
229229
return listener, nil
230230
}
231231

232-
func xdsListenerName(name, address string, port uint32, featureFlags *egv1a1.FeatureFlags) string {
233-
if featureFlags.IsFeatureEnabled(egv1a1.FeatureUseAddressAsListenerName) {
232+
func xdsListenerName(name, address string, port uint32, useAddressAsListenerName bool) string {
233+
if useAddressAsListenerName {
234234
return fmt.Sprintf("%s-%d", address, port)
235235
}
236236

@@ -265,14 +265,14 @@ func buildXdsQuicListener(
265265
port uint32,
266266
ipFamily *egv1a1.IPFamily,
267267
accesslog *ir.AccessLog,
268-
featureFlags *egv1a1.FeatureFlags,
268+
useAddressAsListenerName bool,
269269
) (*listenerv3.Listener, error) {
270270
log, err := buildXdsAccessLog(accesslog, ir.ProxyAccessLogTypeListener)
271271
if err != nil {
272272
return nil, err
273273
}
274274
xdsListener := &listenerv3.Listener{
275-
Name: quicXDSListenerName(xdsListenerName(name, address, port, featureFlags)),
275+
Name: quicXDSListenerName(xdsListenerName(name, address, port, useAddressAsListenerName)),
276276
AccessLog: log,
277277
Address: &corev3.Address{
278278
Address: &corev3.Address_SocketAddress{
@@ -949,7 +949,7 @@ func buildXdsUDPListener(
949949
clusterName string,
950950
udpListener *ir.UDPListener,
951951
accesslog *ir.AccessLog,
952-
featureFlags *egv1a1.FeatureFlags,
952+
useAddressAsListenerName bool,
953953
) (*listenerv3.Listener, error) {
954954
if udpListener == nil {
955955
return nil, errors.New("udp listener is nil")
@@ -994,7 +994,7 @@ func buildXdsUDPListener(
994994
return nil, err
995995
}
996996
xdsListener := &listenerv3.Listener{
997-
Name: xdsListenerName(udpListener.Name, udpListener.Address, udpListener.Port, featureFlags),
997+
Name: xdsListenerName(udpListener.Name, udpListener.Address, udpListener.Port, useAddressAsListenerName),
998998
AccessLog: al,
999999
Address: &corev3.Address{
10001000
Address: &corev3.Address_SocketAddress{

internal/xds/translator/runner/runner.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func (r *Runner) subscribeAndTranslate(sub <-chan watchable.Snapshot[string, *ir
6969
t := &translator.Translator{
7070
ControllerNamespace: r.ControllerNamespace,
7171
FilterOrder: val.FilterOrder,
72-
FeatureFlag: r.EnvoyGateway.FeatureFlags,
72+
FeatureFlag: r.EnvoyGateway.RuntimeFlags,
7373
Logger: r.Logger,
7474
}
7575

internal/xds/translator/translator.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ type Translator struct {
6666
FilterOrder []egv1a1.FilterPosition
6767

6868
// FeatureFlag holds the feature flags for the translator.
69-
FeatureFlag *egv1a1.FeatureFlags
69+
FeatureFlag *egv1a1.RuntimeFlags
7070

7171
Logger logging.Logger
7272
}
@@ -285,7 +285,8 @@ func (t *Translator) processHTTPListenerXdsTranslation(
285285
// Create a new UDP(QUIC) listener for HTTP3 traffic if HTTP3 is enabled
286286
if http3Enabled {
287287
if quicXDSListener, err = buildXdsQuicListener(httpListener.Name, httpListener.Address,
288-
httpListener.Port, httpListener.IPFamily, accessLog, t.FeatureFlag); err != nil {
288+
httpListener.Port, httpListener.IPFamily, accessLog,
289+
t.FeatureFlag.IsEnabled(egv1a1.UseAddressAsListenerName)); err != nil {
289290
errs = errors.Join(errs, err)
290291
continue
291292
}
@@ -300,7 +301,8 @@ func (t *Translator) processHTTPListenerXdsTranslation(
300301
// Create a new TCP listener for HTTP1/HTTP2 traffic.
301302
if tcpXDSListener, err = buildXdsTCPListener(
302303
httpListener.Name, httpListener.Address, httpListener.Port, httpListener.IPFamily,
303-
httpListener.TCPKeepalive, httpListener.Connection, accessLog, t.FeatureFlag); err != nil {
304+
httpListener.TCPKeepalive, httpListener.Connection, accessLog,
305+
t.FeatureFlag.IsEnabled(egv1a1.UseAddressAsListenerName)); err != nil {
304306
errs = errors.Join(errs, err)
305307
continue
306308
}
@@ -721,7 +723,8 @@ func (t *Translator) processTCPListenerXdsTranslation(
721723
if xdsListener == nil {
722724
if xdsListener, err = buildXdsTCPListener(
723725
tcpListener.Name, tcpListener.Address, tcpListener.Port, tcpListener.IPFamily,
724-
tcpListener.TCPKeepalive, tcpListener.Connection, accesslog, t.FeatureFlag); err != nil {
726+
tcpListener.TCPKeepalive, tcpListener.Connection, accesslog,
727+
t.FeatureFlag.IsEnabled(egv1a1.UseAddressAsListenerName)); err != nil {
725728
// skip this listener if failed to build xds listener
726729
errs = errors.Join(errs, err)
727730
continue
@@ -840,7 +843,9 @@ func (t *Translator) processUDPListenerXdsTranslation(
840843
}
841844
}
842845

843-
xdsListener, err := buildXdsUDPListener(udpListener.Route.Destination.Name, udpListener, accesslog, t.FeatureFlag)
846+
xdsListener, err := buildXdsUDPListener(
847+
udpListener.Route.Destination.Name, udpListener, accesslog,
848+
t.FeatureFlag.IsEnabled(egv1a1.UseAddressAsListenerName))
844849
if err != nil {
845850
// skip this listener if failed to build xds listener
846851
errs = errors.Join(errs, err)

release-notes/current.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ date: Pending
44
breaking changes: |
55
Use gateway name as proxy fleet name for gateway namespace mode.
66
Endpoints that are absent from service discovery are removed even if their active health checks succeed.
7-
The xDS listener name are now renamed based on its listening address and port, instead of the Gateway name and section name. This change is gated by the `UseAddressAsListenerName` feature flag. This flag is disabled by default in v1.5, and it will be enabled in v1.6.
7+
The xDS listener name are now renamed based on its listening address and port, instead of the Gateway name and section name. This breaks existing EnvoyPatchPolicies and ExtensionManagers as they depend on the old naming scheme. This change is guarded by the `UseAddressAsListenerName` runtime flag. This flag is disabled by default in v1.5, and it will be enabled in v1.6. We recommend users to migrate their EnvoyPatchPolicies and ExtensionManagers to use the new listener names before v1.6.
88
99
# Updates addressing vulnerabilities, security flaws, or compliance requirements.
1010
security updates: |

site/content/en/latest/api/extension_types.md

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,7 +1219,7 @@ EnvoyGateway is the schema for the envoygateways API.
12191219
| `rateLimit` | _[RateLimit](#ratelimit)_ | false | | RateLimit defines the configuration associated with the Rate Limit service<br />deployed by Envoy Gateway required to implement the Global Rate limiting<br />functionality. The specific rate limit service used here is the reference<br />implementation in Envoy. For more details visit https://github.com/envoyproxy/ratelimit.<br />This configuration is unneeded for "Local" rate limiting. |
12201220
| `extensionManager` | _[ExtensionManager](#extensionmanager)_ | false | | ExtensionManager defines an extension manager to register for the Envoy Gateway Control Plane. |
12211221
| `extensionApis` | _[ExtensionAPISettings](#extensionapisettings)_ | false | | ExtensionAPIs defines the settings related to specific Gateway API Extensions<br />implemented by Envoy Gateway |
1222-
| `featureFlags` | _[FeatureFlags](#featureflags)_ | true | | FeatureFlags defines the feature flags for Envoy Gateway.<br />Unlike ExtensionAPIs, these flags are temporary and will be removed in future releases once the features are stable. |
1222+
| `runtimeFlags` | _[RuntimeFlags](#runtimeflags)_ | true | | RuntimeFlags defines the runtime flags for Envoy Gateway.<br />Unlike ExtensionAPIs, these flags are temporary and will be removed in future releases once the related features are stable. |
12231223

12241224

12251225
#### EnvoyGatewayAdmin
@@ -1479,7 +1479,7 @@ _Appears in:_
14791479
| `rateLimit` | _[RateLimit](#ratelimit)_ | false | | RateLimit defines the configuration associated with the Rate Limit service<br />deployed by Envoy Gateway required to implement the Global Rate limiting<br />functionality. The specific rate limit service used here is the reference<br />implementation in Envoy. For more details visit https://github.com/envoyproxy/ratelimit.<br />This configuration is unneeded for "Local" rate limiting. |
14801480
| `extensionManager` | _[ExtensionManager](#extensionmanager)_ | false | | ExtensionManager defines an extension manager to register for the Envoy Gateway Control Plane. |
14811481
| `extensionApis` | _[ExtensionAPISettings](#extensionapisettings)_ | false | | ExtensionAPIs defines the settings related to specific Gateway API Extensions<br />implemented by Envoy Gateway |
1482-
| `featureFlags` | _[FeatureFlags](#featureflags)_ | true | | FeatureFlags defines the feature flags for Envoy Gateway.<br />Unlike ExtensionAPIs, these flags are temporary and will be removed in future releases once the features are stable. |
1482+
| `runtimeFlags` | _[RuntimeFlags](#runtimeflags)_ | true | | RuntimeFlags defines the runtime flags for Envoy Gateway.<br />Unlike ExtensionAPIs, these flags are temporary and will be removed in future releases once the related features are stable. |
14831483

14841484

14851485
#### EnvoyGatewayTelemetry
@@ -1964,39 +1964,6 @@ _Appears in:_
19641964
| `percentage` | _float_ | false | 100 | Percentage specifies the percentage of requests to be delayed. Default 100%, if set 0, no requests will be delayed. Accuracy to 0.0001%. |
19651965

19661966

1967-
#### FeatureFlag
1968-
1969-
_Underlying type:_ _string_
1970-
1971-
FeatureFlag defines a feature flag for Envoy Gateway.
1972-
1973-
_Appears in:_
1974-
- [FeatureFlags](#featureflags)
1975-
1976-
| Value | Description |
1977-
| ----- | ----------- |
1978-
| `UseAddressAsListenerName` | FeatureUseAddressAsListenerName indicates that the listener name should be derived from the address and port.<br /> |
1979-
1980-
1981-
#### FeatureFlags
1982-
1983-
1984-
1985-
FeatureFlags provide a mechanism to gate breaking changes or experimental features in new Envoy Gateway releases.
1986-
Each flag may be enabled or disabled by default and can be toggled through the EnvoyGateway resource.
1987-
The names of these flags will be included in the release notes alongside an explanation of the change.
1988-
Please note that these flags are temporary and will be removed in future releases once the features are stable.
1989-
1990-
_Appears in:_
1991-
- [EnvoyGateway](#envoygateway)
1992-
- [EnvoyGatewaySpec](#envoygatewayspec)
1993-
1994-
| Field | Type | Required | Default | Description |
1995-
| --- | --- | --- | --- | --- |
1996-
| `enabled` | _[FeatureFlag](#featureflag) array_ | true | | |
1997-
| `disabled` | _[FeatureFlag](#featureflag) array_ | true | | |
1998-
1999-
20001967
#### FileEnvoyProxyAccessLog
20011968

20021969

@@ -4464,6 +4431,40 @@ _Appears in:_
44644431
| `Endpoint` | EndpointRoutingType is the RoutingType for Endpoint routing.<br /> |
44654432

44664433

4434+
#### RuntimeFlag
4435+
4436+
_Underlying type:_ _string_
4437+
4438+
RuntimeFlag defines a runtime flag used to guard breaking changes or risky experimental features in new Envoy Gateway releases.
4439+
A runtime flag may be enabled or disabled by default and can be toggled through the EnvoyGateway resource.
4440+
4441+
_Appears in:_
4442+
- [RuntimeFlags](#runtimeflags)
4443+
4444+
| Value | Description |
4445+
| ----- | ----------- |
4446+
| `UseAddressAsListenerName` | UseAddressAsListenerName indicates that the listener name should be derived from the address and port.<br /> |
4447+
4448+
4449+
#### RuntimeFlags
4450+
4451+
4452+
4453+
RuntimeFlags provide a mechanism to guard breaking changes or risky experimental features in new Envoy Gateway releases.
4454+
Each flag may be enabled or disabled by default and can be toggled through the EnvoyGateway resource.
4455+
The names of these flags will be included in the release notes alongside an explanation of the change.
4456+
Please note that these flags are temporary and will be removed in future releases once the related features are stable.
4457+
4458+
_Appears in:_
4459+
- [EnvoyGateway](#envoygateway)
4460+
- [EnvoyGatewaySpec](#envoygatewayspec)
4461+
4462+
| Field | Type | Required | Default | Description |
4463+
| --- | --- | --- | --- | --- |
4464+
| `enabled` | _[RuntimeFlag](#runtimeflag) array_ | true | | |
4465+
| `disabled` | _[RuntimeFlag](#runtimeflag) array_ | true | | |
4466+
4467+
44674468

44684469

44694470
#### SecretTranslationConfig

test/config/envoy-gateaway-config/address-as-listener-name.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ data:
1919
type: Redis
2020
redis:
2121
url: redis.redis-system.svc.cluster.local:6379
22-
featureFlags:
22+
runtimeFlags:
2323
enabled:
2424
- UseAddressAsListenerName
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
config:
22
envoyGateway:
3-
featureFlags:
3+
runtimeFlags:
44
enabled:
55
- UseAddressAsListenerName

0 commit comments

Comments
 (0)