rlptools

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	WASMFilterImageURL = common.FetchEnv("WASM_FILTER_IMAGE", "oci://quay.io/kuadrant/wasm-shim:latest")
)

Functions

func HTTPRouteRulesToRLPRules

func HTTPRouteRulesToRLPRules(httpRouteRules []common.HTTPRouteRule) []kuadrantv1beta1.Rule

func SameLimitList

func SameLimitList(a, b []kuadrantv1beta1.Limit) bool

func WASMPluginMutator

func WASMPluginMutator(existingObj, desiredObj client.Object) (bool, error)

Types

type GatewayAction

type GatewayAction struct {
	Configurations []kuadrantv1beta1.Configuration `json:"configurations"`

	// +optional
	Rules []kuadrantv1beta1.Rule `json:"rules,omitempty"`
}

func GatewayActionsFromRateLimitPolicy

func GatewayActionsFromRateLimitPolicy(rlp *kuadrantv1beta1.RateLimitPolicy, route *gatewayapiv1alpha2.HTTPRoute) []GatewayAction

GatewayActionsFromRateLimitPolicy return flatten list from GatewayAction from the RLP

type GatewayActionsByDomain

type GatewayActionsByDomain map[string][]GatewayAction

func (GatewayActionsByDomain) String

func (g GatewayActionsByDomain) String() string

type GatewayWrapper

type GatewayWrapper struct {
	*gatewayapiv1alpha2.Gateway
}

GatewayWrapper add methods to manage RLP references in annotations

func LeftGateways

func LeftGateways(gwList *gatewayapiv1alpha2.GatewayList,
	rlpKey client.ObjectKey,
	rlpGwKeys []client.ObjectKey) []GatewayWrapper

func NewGateways

func NewGateways(gwList *gatewayapiv1alpha2.GatewayList,
	rlpKey client.ObjectKey,
	rlpGwKeys []client.ObjectKey) []GatewayWrapper

func SameGateways

func SameGateways(gwList *gatewayapiv1alpha2.GatewayList,
	rlpKey client.ObjectKey,
	rlpGwKeys []client.ObjectKey) []GatewayWrapper

func (GatewayWrapper) AddRLP

func (g GatewayWrapper) AddRLP(rlpKey client.ObjectKey) bool

AddRLP tries to add RLP to the existing ref list. Returns true if RLP was added, false otherwise

func (GatewayWrapper) ContainsRLP

func (g GatewayWrapper) ContainsRLP(rlpKey client.ObjectKey) bool

func (GatewayWrapper) DeleteRLP

func (g GatewayWrapper) DeleteRLP(rlpKey client.ObjectKey) bool

DeleteRLP tries to delete RLP from the existing ref list. Returns true if RLP was deleted, false otherwise

func (GatewayWrapper) Hostnames

func (g GatewayWrapper) Hostnames() []string

Hostnames builds a list of hostnames from the listeners.

func (GatewayWrapper) Key

func (GatewayWrapper) RLPRefs

func (g GatewayWrapper) RLPRefs() []client.ObjectKey

type LimitIndex

type LimitIndex struct {
	// contains filtered or unexported fields
}

LimitIndex allows manage Limitador CR limits based on gateways and domains gateways and domains are encoded in the namespace field of the limit limit namespace format: "{gateway}#{domain}"

func NewLimitadorIndex

func NewLimitadorIndex(limitador *limitadorv1alpha1.Limitador, logger logr.Logger) *LimitIndex

NewLimitadorIndex builds index to manage limits indexed by domain indexed by gateways yaml representation would be:

 ---
 gateway_key1:
   domain_1:
	 - maxValue: X
	   seconds: Y
	   conditions: [ ... ]
	   variables: [ ... ]
   domain_2:
	 - maxValue: X
	   seconds: Y
	   conditions: [ ... ]
	   variables: [ ... ]
 gateway_key2:
   domain_1:
	 - maxValue: X
	   seconds: Y
	   conditions: [ ... ]
	   variables: [ ... ]
   domain_2:
	 - maxValue: X
	   seconds: Y
	   conditions: [ ... ]
	   variables: [ ... ]

func (*LimitIndex) AddGatewayLimits

func (l *LimitIndex) AddGatewayLimits(gwKey client.ObjectKey, gwLimits LimitsByDomain)

func (*LimitIndex) AddLimit

func (l *LimitIndex) AddLimit(gwKey client.ObjectKey, domain string, limit *kuadrantv1beta1.Limit)

AddLimit adds one new limit to the index structure

func (*LimitIndex) AddLimitFromRateLimit

func (l *LimitIndex) AddLimitFromRateLimit(limit *limitadorv1alpha1.RateLimit)

AddLimitFromRateLimit adds one new limit to the index structure

func (*LimitIndex) DeleteGateway

func (l *LimitIndex) DeleteGateway(gwKey client.ObjectKey)

func (*LimitIndex) Equals

func (l *LimitIndex) Equals(other *LimitIndex) bool

func (*LimitIndex) ToLimits

func (l *LimitIndex) ToLimits() []limitadorv1alpha1.RateLimit

type LimitList

type LimitList []kuadrantv1beta1.Limit

func (LimitList) Len

func (l LimitList) Len() int

func (LimitList) Less

func (l LimitList) Less(i, j int) bool

func (LimitList) Swap

func (l LimitList) Swap(i, j int)

type LimitsByDomain

type LimitsByDomain map[string][]kuadrantv1beta1.Limit

func (LimitsByDomain) Equals

func (l LimitsByDomain) Equals(other LimitsByDomain) bool

func (LimitsByDomain) String

func (l LimitsByDomain) String() string

type RateLimitPolicy

type RateLimitPolicy struct {
	Name            string   `json:"name"`
	RateLimitDomain string   `json:"rate_limit_domain"`
	UpstreamCluster string   `json:"upstream_cluster"`
	Hostnames       []string `json:"hostnames"`
	// +optional
	GatewayActions []GatewayAction `json:"gateway_actions,omitempty"`
}

type WASMPlugin

type WASMPlugin struct {
	FailureModeDeny   bool              `json:"failure_mode_deny"`
	RateLimitPolicies []RateLimitPolicy `json:"rate_limit_policies"`
}

func WASMPluginFromStruct

func WASMPluginFromStruct(structure *_struct.Struct) (*WASMPlugin, error)

func (*WASMPlugin) ToStruct

func (w *WASMPlugin) ToStruct() (*_struct.Struct, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL