-
Notifications
You must be signed in to change notification settings - Fork 360
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
api: lua support in EnvoyExtensionPolicy and HTTPRouteFilter
Signed-off-by: Rudrakh Panigrahi <rudrakh97@gmail.com>
- Loading branch information
Showing
9 changed files
with
444 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// Copyright Envoy Gateway Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// The full text of the Apache license is available in the LICENSE file at | ||
// the root of the repo. | ||
|
||
package v1alpha1 | ||
|
||
// LuaFilter defines a Lua extension that applies globally | ||
// to all requests passing through the filter chain. | ||
type LuaFilter struct { | ||
// SourceCodes is a map of named LuaSource codes that can be referenced in LuaPerRouteFilter | ||
SourceCodes map[string]*LuaSource `json:"sourceCodes"` | ||
// DefaultSourceCode is the default LuaSource that will be executed | ||
// unless overridden by LuaPerRouteFilter configured for the selected route | ||
DefaultSourceCode *LuaSource `json:"defaultSourceCode"` | ||
// StatPrefix is the additional prefix to use when emitting statistics. | ||
// By default, metrics are emitted in .lua. namespace. | ||
// If multiple lua filters are configured in a filter chain, the stats from each filter instance can be emitted | ||
// using custom stat prefix to distinguish emitted statistics. | ||
// +optional | ||
StatPrefix *string `json:"statPrefix,omitempty"` | ||
} | ||
|
||
// LuaPerRouteFilter defines a Lua extension that applies to specific routes based on route match. | ||
// Only one of Disabled, Name or OverrideSource must be set. | ||
// +kubebuilder:validation:XValidation:rule="has(self.disabled) ? (!has(self.name) && !has(self.overrideSource)) : (has(self.name) ? !has(self.overrideSource) : has(self.overrideSource))",message="Exactly one of disabled, name, or overrideSource must be set." | ||
type LuaPerRouteFilter struct { | ||
// Disabled is the status of the Lua filter for this particular vhost or route. | ||
// If disabled is specified in multiple per-filter-configs, the most specific one will be used. | ||
// | ||
// +optional | ||
Disabled *bool `json:"disabled,omitempty"` | ||
// Name of a LuaSource code stored in LuaFilter.SourceCodes | ||
// | ||
// +optional | ||
Name *string `json:"name,omitempty"` | ||
// OverrideSource is a LuaSource defined for this specific route | ||
// | ||
// +optional | ||
OverrideSource *LuaSource `json:"overrideSource,omitempty"` | ||
} | ||
|
||
// LuaSource contains source code information for a user defined Lua script | ||
// Only one of FileName, InlineBytes, InlineString or EnvironmentVariable must be set | ||
// +kubebuilder:validation:XValidation:rule="has(self.fileName) ? (!has(self.inlineBytes) && !has(self.inlineString) && !has(self.environmentVariable)) : (has(self.inlineBytes) ? (!has(self.inlineString) && !has(self.environmentVariable)) : has(self.inlineString) ? !has(self.environmentVariable) : has(self.environmentVariable))",message="Exactly one of fileName, inlineBytes, inlineString, or environmentVariable must be set." | ||
type LuaSource struct { | ||
// FileName represents a local filesystem data source. | ||
// | ||
// +optional | ||
FileName *string `json:"fileName,omitempty"` | ||
// InlineBytes represents bytes inlined in the configuration. | ||
// | ||
// +optional | ||
InlineBytes []byte `json:"inlineBytes,omitempty"` | ||
// InlineString represents a string inlined in the configuration. | ||
// | ||
// +optional | ||
InlineString *string `json:"inlineString,omitempty"` | ||
// EnvironmentVariable represents an environment variable data source. | ||
// | ||
// +optional | ||
EnvironmentVariable *string `json:"environmentVariable,omitempty"` | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.