-
Notifications
You must be signed in to change notification settings - Fork 360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API: EnvoyExtensionPolicy #2570
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2570 +/- ##
=======================================
Coverage 64.57% 64.57%
=======================================
Files 122 122
Lines 21115 21115
=======================================
Hits 13636 13636
Misses 6632 6632
Partials 847 847 ☔ View full report in Codecov by Sentry. |
43f07ce
to
1389569
Compare
// +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.conditions[?(@.type=="Accepted")].reason` | ||
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` | ||
|
||
// TrafficExtensionPolicy allows the user to configure various traffic extensibility options for the Gateway. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prefer EnvoyExtensionPolicy
since these extensions are specific to envoy or ExtensionPolicy
if these extensions are common across proxy implementations
In yesterday's community meeting, @arkodg raised the following requirements:
Istio's implementation for WASM plugins uses @envoyproxy/gateway-maintainers - WDYT? Should we follow the istio pattern and implement phases and priorities for user-defined extensions? |
type EnvoyExtensionPhase string | ||
|
||
const ( | ||
AuthzEnvoyExtensionPhase EnvoyExtensionPhase = "AUTHZ" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to be consistent with other enums defined in the various EnvoyGateway CRDs, the enum values should not be all-caps.
AuthzEnvoyExtensionPhase EnvoyExtensionPhase = "AuthZ"
AuthnEnvoyExtensionPhase EnvoyExtensionPhase = "AuthN"
RateLimitEnvoyExtensionPhase EnvoyExtensionPhase = "RateLimit"
type NetworkEnvoyExtension struct { | ||
} | ||
|
||
type ExtensionMetadata map[string]string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this really need to be an aliased type?
Similar definitions in the APIs don't define an aliased type for map[string]string
. See KubernetesPodSpec for example.
api/v1alpha1/ext_proc_types.go
Outdated
// Default: no metadata context is sent or received | ||
MetadataOptions *ExtProcMetadataOptions `json:"metadataOptions,omitempty"` | ||
// The timeout for a response to be returned from the external processor | ||
// Default: 200ms |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a +kubebuilder:default
comment for MessageTimeout
.
) | ||
|
||
// +kubebuilder:object:root=true | ||
// +kubebuilder:resource:shortName=sp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shortName
is the same as the shortName
defined for the SecurityPolicy
resource.
Consider removing the short name, or changing it to ep
.
ac5628c
to
f34cfbe
Compare
Incorporated points from the discussion in today's community meeting:
|
f34cfbe
to
b657fc8
Compare
@zhaohuabing lets pause on #2877 until this API is done, and the WASM API can be incorporated as a field within this API |
Spec EnvoyExtensionPolicySpec `json:"spec"` | ||
|
||
// Status defines the current status of EnvoyExtensionPolicy. | ||
Status EnvoyExtensionPolicyStatus `json:"status,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably PolicyStatus here
Signed-off-by: Guy Daich <guy.daich@sap.com>
b657fc8
to
04b7280
Compare
api/v1alpha1/envoyproxy_types.go
Outdated
// Fault-Injection, Local-Rate-Limit, Global-Rate-Limit | ||
// | ||
// +optional | ||
FilterOrdering []EnvoyFilterName `json:"filterOrdering,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggest keep filter ordering out of scope of this API, and solving it separately in #2571
Signed-off-by: Guy Daich <guy.daich@sap.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the spec support defining extensions as a list?
Unlike "normal" filters(Rate Limit, CORS, Basic Auth, OAuth2, JWT, etc), where typically only one filter per HTTPRoute is needed, users often require multiple custom Envoy extensions(wasm, lua, golang, ext auth?, etc.) of the same type for different purposes. For example, they might use a wasm filter for WAF and another for auth on the same HTTPRoute.
The current spec only supports defining a single extension per HTTPRoute, and it would block those use cases.
We may need to make it a list, like the below yaml snippet shows:
apiVersion: gateway.networking.k8s.io/v1alpha2
kind: EnvoyExtensionPolicy
metadata:
name: my-extensions
spec:
targetRef:
kind: HTTPRoute
name: backend
wasm:
- name: wasm_plugin_waf
...
- name: my_plugin_auth
...
ExtProc:
- name: exproc_plugin_1
....
- name: exproc_plugin_2
Lua:
- name: lua_plugin_1
....
- name: lua_plugin_2
.....
+1 I think that's a reasonable ask, when considering that we allow something similar with envoy patches and it is indeed a very common use case. Maybe we can even avoid dealing with priority and multi-attachment in the first phases for this policy, if we support this + route attachment in the initial iteration. |
// ExtProc defines the configuration for the external processor extension. | ||
// | ||
// +optional | ||
ExtProc *ExtProc `json:"extProc,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as per huabing's point, should we make this a list ?
Signed-off-by: Guy Daich <guy.daich@sap.com>
To make things a bit simpler, I removed ext-proc from this PR. After the top-level resource is added, @zhaohuabing and I can work on ext-proc/wasm in parallel. |
// EnvoyExtensionPolicySpec defines the desired state of EnvoyExtensionPolicy. | ||
type EnvoyExtensionPolicySpec struct { | ||
// +kubebuilder:validation:XValidation:rule="self.group == 'gateway.networking.k8s.io'", message="this policy can only have a targetRef.group of gateway.networking.k8s.io" | ||
// +kubebuilder:validation:XValidation:rule="self.kind in ['Gateway']", message="this policy can only have a targetRef.kind of Gateway" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should target Gateway
and Route
@@ -151,6 +151,10 @@ type ExtensionAPISettings struct { | |||
// EnableEnvoyPatchPolicy enables Envoy Gateway to | |||
// reconcile and implement the EnvoyPatchPolicy resources. | |||
EnableEnvoyPatchPolicy bool `json:"enableEnvoyPatchPolicy"` | |||
|
|||
// EnableEnvoyExtensionPolicy enables Envoy Gateway to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@envoyproxy/gateway-maintainers @envoyproxy/gateway-reviewers thoughts on this ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine to remove all these, it will not happen unless you create a CR.
site/content/en/latest/contributions/design/envoy-extension-policy.md
Outdated
Show resolved
Hide resolved
|
||
## Overview | ||
|
||
This design document introduces the `EnvoyExtensionPolicy` API allowing system administrators to configure traffic |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we incorporate some of these below points in this doc
- there are now 2 kinds of extensibility today
- extending EG API by configuring xDS directly using EnvoyPatchPolicy & ExtensionManager
- the other kind, highlighted in this doc that extends and adds newer functionality on top of what Envoy offers
Also a note around how users have been using EnvoyPatchPolicy & ExtensionManager to directly configure this extensions, but this API provides a safer and more scoped API
Signed-off-by: Guy Daich <guy.daich@sap.com>
Signed-off-by: Guy Daich <guy.daich@sap.com>
/retest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks !
What this PR does / why we need it:
This PR introduces a new policy type,
EnvoyExtensionPolicy
, that can be used to add multiple HTTP and Network extension filters (such as lua, wasm, golang, ext-proc), and define their order of execution.Relates to #2546, #2025, #2877