Skip to content

Commit

Permalink
Merge branch 'main' into xds-btp-group
Browse files Browse the repository at this point in the history
  • Loading branch information
shawnh2 authored Apr 17, 2024
2 parents 331b62e + e8b8074 commit ef38970
Show file tree
Hide file tree
Showing 277 changed files with 1,633 additions and 553 deletions.
84 changes: 84 additions & 0 deletions api/v1alpha1/envoyproxy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,92 @@ type EnvoyProxySpec struct {
//
// +optional
Shutdown *ShutdownConfig `json:"shutdown,omitempty"`

// FilterOrder defines the order of filters in the Envoy proxy's HTTP filter chain.
// If unspecified, the default filter order is applied.
// Default filter order is:
//
// - envoy.filters.http.fault
//
// - envoy.filters.http.cors
//
// - envoy.filters.http.ext_authz
//
// - envoy.filters.http.basic_authn
//
// - envoy.filters.http.oauth2
//
// - envoy.filters.http.jwt_authn
//
// - envoy.filters.http.ext_proc
//
// - envoy.filters.http.wasm
//
// - envoy.filters.http.local_ratelimit
//
// - envoy.filters.http.ratelimit
//
// - envoy.filters.http.router
//
// +optional
// +notImplementedHide
FilterOrder []FilterPosition `json:"filterOrder,omitempty"`
}

// FilterPosition defines the position of an Envoy HTTP filter in the filter chain.
// +kubebuilder:validation:XValidation:rule="(has(self.before) || has(self.after))",message="one of before or after must be specified"
// +kubebuilder:validation:XValidation:rule="(has(self.before) && !has(self.after)) || (!has(self.before) && has(self.after))",message="only one of before or after can be specified"
type FilterPosition struct {
// Name of the filter.
Name EnvoyFilter `json:"filter"`

// Before defines the filter that should come before the filter.
// Only one of Before or After must be set.
Before *EnvoyFilter `json:"before,omitempty"`

// After defines the filter that should come after the filter.
// Only one of Before or After must be set.
After *EnvoyFilter `json:"after,omitempty"`
}

// EnvoyFilter defines the type of Envoy HTTP filter.
// +kubebuilder:validation:Enum=envoy.filters.http.cors;envoy.filters.http.ext_authz;envoy.filters.http.basic_authn;envoy.filters.http.oauth2;envoy.filters.http.jwt_authn;envoy.filters.http.fault;envoy.filters.http.local_ratelimit;envoy.filters.http.ratelimit;envoy.filters.http.wasm;envoy.filters.http.ext_proc
type EnvoyFilter string

const (
// EnvoyFilterFault defines the Envoy HTTP fault filter.
EnvoyFilterFault EnvoyFilter = "envoy.filters.http.fault"
// EnvoyFilterCORS defines the Envoy HTTP CORS filter.
EnvoyFilterCORS EnvoyFilter = "envoy.filters.http.cors"

// EnvoyFilterExtAuthz defines the Envoy HTTP external authorization filter.
EnvoyFilterExtAuthz EnvoyFilter = "envoy.filters.http.ext_authz"

// EnvoyFilterBasicAuthn defines the Envoy HTTP basic authentication filter.
EnvoyFilterBasicAuthn EnvoyFilter = "envoy.filters.http.basic_authn"

// EnvoyFilterOAuth2 defines the Envoy HTTP OAuth2 filter.
EnvoyFilterOAuth2 EnvoyFilter = "envoy.filters.http.oauth2"

// EnvoyFilterJWTAuthn defines the Envoy HTTP JWT authentication filter.
EnvoyFilterJWTAuthn EnvoyFilter = "envoy.filters.http.jwt_authn"

// EnvoyFilterExtProc defines the Envoy HTTP external process filter.
EnvoyFilterExtProc EnvoyFilter = "envoy.filters.http.ext_proc"

// EnvoyFilterWasm defines the Envoy HTTP WebAssembly filter.
EnvoyFilterWasm EnvoyFilter = "envoy.filters.http.wasm"

// EnvoyFilterLocalRateLimit defines the Envoy HTTP local rate limit filter.
EnvoyFilterLocalRateLimit EnvoyFilter = "envoy.filters.http.local_ratelimit"

// EnvoyFilterRateLimit defines the Envoy HTTP rate limit filter.
EnvoyFilterRateLimit EnvoyFilter = "envoy.filters.http.ratelimit"

// EnvoyFilterRouter defines the Envoy HTTP router filter.
EnvoyFilterRouter EnvoyFilter = "envoy.filters.http.router"
)

type ProxyTelemetry struct {
// AccessLogs defines accesslog parameters for managed proxies.
// If unspecified, will send default format to stdout.
Expand Down
20 changes: 19 additions & 1 deletion api/v1alpha1/ext_proc_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,26 @@ import (
//
// ExtProc defines the configuration for External Processing filter.
type ExtProc struct {
// Service defines the configuration of the external processing service
// BackendRef defines the configuration of the external processing service
BackendRef ExtProcBackendRef `json:"backendRef"`

// BackendRefs defines the configuration of the external processing service
//
// +optional
BackendRefs []BackendRef `json:"backendRefs,omitempty"`

// MessageTimeout is the timeout for a response to be returned from the external processor
// Default: 200ms
//
// +optional
MessageTimeout *gwapiv1.Duration `json:"messageTimeout,omitempty"`

// FailOpen defines if requests or responses that cannot be processed due to connectivity to the
// external processor are terminated or passed-through.
// Default: false
//
// +optional
FailOpen *bool `json:"failOpen,omitempty"`
}

// ExtProcService defines the gRPC External Processing service using the envoy grpc client
Expand Down
2 changes: 1 addition & 1 deletion api/v1alpha1/wasm_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ type WasmCodeSource struct {
}

// WasmCodeSourceType specifies the types of sources for the wasm code.
// +kubebuilder:validation:Enum=Global;Local
// +kubebuilder:validation:Enum=HTTP;Image
type WasmCodeSourceType string

const (
Expand Down
49 changes: 49 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ spec:
filter.
properties:
backendRef:
description: Service defines the configuration of the external
description: BackendRef defines the configuration of the external
processing service
properties:
group:
Expand Down Expand Up @@ -134,6 +134,99 @@ spec:
- message: Must have port for Service reference
rule: '(size(self.group) == 0 && self.kind == ''Service'')
? has(self.port) : true'
backendRefs:
description: BackendRefs defines the configuration of the external
processing service
items:
description: BackendRef defines how an ObjectReference that
is specific to BackendRef.
properties:
group:
default: ""
description: |-
Group is the group of the referent. For example, "gateway.networking.k8s.io".
When unspecified or empty string, core API group is inferred.
maxLength: 253
pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
type: string
kind:
default: Service
description: |-
Kind is the Kubernetes resource kind of the referent. For example
"Service".
Defaults to "Service" when not specified.
ExternalName services can refer to CNAME DNS records that may live
outside of the cluster and as such are difficult to reason about in
terms of conformance. They also may not be safe to forward to (see
CVE-2021-25740 for more information). Implementations SHOULD NOT
support ExternalName Services.
Support: Core (Services with a type other than ExternalName)
Support: Implementation-specific (Services with type ExternalName)
maxLength: 63
minLength: 1
pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$
type: string
name:
description: Name is the name of the referent.
maxLength: 253
minLength: 1
type: string
namespace:
description: |-
Namespace is the namespace of the backend. When unspecified, the local
namespace is inferred.
Note that when a namespace different than the local namespace is specified,
a ReferenceGrant object is required in the referent namespace to allow that
namespace's owner to accept the reference. See the ReferenceGrant
documentation for details.
Support: Core
maxLength: 63
minLength: 1
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
type: string
port:
description: |-
Port specifies the destination port number to use for this resource.
Port is required when the referent is a Kubernetes Service. In this
case, the port number is the service port number, not the target port.
For other resources, destination port might be derived from the referent
resource or this field.
format: int32
maximum: 65535
minimum: 1
type: integer
required:
- name
type: object
x-kubernetes-validations:
- message: Must have port for Service reference
rule: '(size(self.group) == 0 && self.kind == ''Service'')
? has(self.port) : true'
type: array
failOpen:
description: |-
FailOpen defines if requests or responses that cannot be processed due to connectivity to the
external processor are terminated or passed-through.
Default: false
type: boolean
messageTimeout:
description: |-
MessageTimeout is the timeout for a response to be returned from the external processor
Default: 200ms
pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$
type: string
required:
- backendRef
type: object
Expand Down Expand Up @@ -304,8 +397,8 @@ spec:
type:
allOf:
- enum:
- Global
- Local
- HTTP
- Image
- enum:
- HTTP
- Image
Expand Down
Loading

0 comments on commit ef38970

Please sign in to comment.