fgw

package
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: May 19, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package routecfg contains types for the gateway route

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessControlLists

type AccessControlLists struct {
	Blacklist  []string `json:"Blacklist,omitempty" hash:"set"`
	Whitelist  []string `json:"Whitelist,omitempty" hash:"set"`
	EnableXFF  *bool    `json:"EnableXFF,omitempty"`
	StatusCode *int32   `json:"Status,omitempty"`
	Message    *string  `json:"Message,omitempty"`
}

AccessControlLists is the access control lists configuration

type BackendServiceConfig

type BackendServiceConfig struct {
	Weight  int32    `json:"Weight"`
	Filters []Filter `json:"Filters,omitempty" hash:"set"`
}

type ByGRPCTrafficMatch

type ByGRPCTrafficMatch []GRPCTrafficMatch

func (ByGRPCTrafficMatch) Len

func (by ByGRPCTrafficMatch) Len() int

func (ByGRPCTrafficMatch) Less

func (by ByGRPCTrafficMatch) Less(i, j int) bool

func (ByGRPCTrafficMatch) Swap

func (by ByGRPCTrafficMatch) Swap(i, j int)

type ByHTTPTrafficMatch

type ByHTTPTrafficMatch []HTTPTrafficMatch

func (ByHTTPTrafficMatch) Len

func (by ByHTTPTrafficMatch) Len() int

func (ByHTTPTrafficMatch) Less

func (by ByHTTPTrafficMatch) Less(i, j int) bool

func (ByHTTPTrafficMatch) Swap

func (by ByHTTPTrafficMatch) Swap(i, j int)

type Certificate

type Certificate struct {
	CertChain  string `json:"CertChain,omitempty"`
	PrivateKey string `json:"PrivateKey,omitempty"`
	IssuingCA  string `json:"IssuingCA,omitempty"`
}

Certificate is the certificate configuration

type Chains

type Chains struct {
	HTTPRoute      []string `json:"HTTPRoute" hash:"set"`
	HTTPSRoute     []string `json:"HTTPSRoute" hash:"set"`
	TLSPassthrough []string `json:"TLSPassthrough" hash:"set"`
	TLSTerminate   []string `json:"TLSTerminate" hash:"set"`
	TCPRoute       []string `json:"TCPRoute" hash:"set"`
	UDPRoute       []string `json:"UDPRoute" hash:"set"`
}

Chains is the chains configuration

type CircuitBreaking

type CircuitBreaking struct {
	MinRequestAmount        int32    `json:"MinRequestAmount"`
	StatTimeWindow          int32    `json:"StatTimeWindow"`
	SlowTimeThreshold       *float32 `json:"SlowTimeThreshold,omitempty"`
	SlowAmountThreshold     *int32   `json:"SlowAmountThreshold,omitempty"`
	SlowRatioThreshold      *float32 `json:"SlowRatioThreshold,omitempty"`
	ErrorAmountThreshold    *int32   `json:"ErrorAmountThreshold,omitempty"`
	ErrorRatioThreshold     *float32 `json:"ErrorRatioThreshold,omitempty"`
	DegradedTimeWindow      int32    `json:"DegradedTimeWindow"`
	DegradedStatusCode      int32    `json:"DegradedStatusCode"`
	DegradedResponseContent *string  `json:"DegradedResponseContent,omitempty"`
}

CircuitBreaking is the circuit breaker configuration

type ConfigSpec

type ConfigSpec struct {
	Defaults    Defaults                 `json:"Configs"`
	Listeners   []Listener               `json:"Listeners" hash:"set"`
	Certificate *Certificate             `json:"Certificate,omitempty"`
	RouteRules  map[int32]RouteRule      `json:"RouteRules"`
	Services    map[string]ServiceConfig `json:"Services"`
	Chains      Chains                   `json:"Chains"`
	Features    Features                 `json:"Features"`
	Version     string                   `json:"Version" hash:"ignore"`
}

ConfigSpec is the configuration spec for the gateway

type Defaults

type Defaults struct {
	EnableDebug                    bool            `json:"EnableDebug"`
	DefaultPassthroughUpstreamPort int32           `json:"DefaultPassthroughUpstreamPort"`
	StripAnyHostPort               bool            `json:"StripAnyHostPort"`
	ProxyPreserveHost              bool            `json:"ProxyPreserveHost"`
	HTTP1PerRequestLoadBalancing   bool            `json:"HTTP1PerRequestLoadBalancing"`
	HTTP2PerRequestLoadBalancing   bool            `json:"HTTP2PerRequestLoadBalancing"`
	SocketTimeout                  *int32          `json:"SocketTimeout,omitempty"`
	PidFile                        *string         `json:"PidFile,omitempty"`
	ResourceUsage                  *ResourceUsage  `json:"ResourceUsage,omitempty"`
	HealthCheckLog                 *HealthCheckLog `json:"HealthCheckLog,omitempty"`
	ProxyTag                       *ProxyTag       `json:"ProxyTag,omitempty"`
}

Defaults is the default configuration

type Endpoint

type Endpoint struct {
	Weight       int32             `json:"Weight"`
	Tags         map[string]string `json:"Tags,omitempty"`
	MTLS         bool              `json:"MTLS,omitempty"`
	UpstreamCert *UpstreamCert     `json:"UpstreamCert,omitempty"`
}

Endpoint is the endpoint configuration

type FaultInjection

type FaultInjection struct {
	Delay *FaultInjectionDelay `json:"Delay,omitempty"`
	Abort *FaultInjectionAbort `json:"Abort,omitempty"`
}

FaultInjection is the fault injection configuration

type FaultInjectionAbort

type FaultInjectionAbort struct {
	Percent int32   `json:"Percent"`
	Status  *int32  `json:"Status,omitempty"`
	Message *string `json:"Message,omitempty"`
}

FaultInjectionAbort is the abort configuration for fault injection

type FaultInjectionDelay

type FaultInjectionDelay struct {
	Percent int32   `json:"Percent"`
	Fixed   *int64  `json:"Fixed,omitempty"`
	Range   *string `json:"Range,omitempty"`
	Unit    *string `json:"Unit,omitempty"`
}

FaultInjectionDelay is the delay configuration for fault injection

type Features

type Features struct {
	Logging struct{} `json:"Logging"`
	Tracing struct{} `json:"Tracing"`
	Metrics struct{} `json:"Metrics"`
}

Features is the features configuration

type Filter

type Filter interface{}

Filter is the filter configuration

type GRPCMethod

type GRPCMethod struct {
	MatchType MatchType `json:"Type"`
	Service   *string   `json:"Service,omitempty"`
	Method    *string   `json:"Method,omitempty"`
}

GRPCMethod is the GRPC method configuration

type GRPCRouteFilter

type GRPCRouteFilter struct {
	// Type identifies the type of filter to apply. As with other API fields,
	// types are classified into three conformance levels:
	Type gwv1alpha2.GRPCRouteFilterType `json:"Type"`

	// RequestHeaderModifier defines a schema for a filter that modifies request
	// headers.
	RequestHeaderModifier *HTTPHeaderFilter `json:"RequestHeaderModifier,omitempty"`

	// ResponseHeaderModifier defines a schema for a filter that modifies response
	// headers.
	ResponseHeaderModifier *HTTPHeaderFilter `json:"ResponseHeaderModifier,omitempty"`

	// RequestMirror defines a schema for a filter that mirrors requests.
	// Requests are sent to the specified destination, but responses from
	// that destination are ignored.
	RequestMirror *HTTPRequestMirrorFilter `json:"RequestMirror,omitempty"`

	// ExtensionRef is an optional, implementation-specific extension to the
	// "filter" behavior.  For example, resource "myroutefilter" in group
	// "networking.example.net"). ExtensionRef MUST NOT be used for core and
	// extended filters.
	ExtensionRef *gwv1alpha2.LocalObjectReference `json:"ExtensionRef,omitempty"`
}

GRPCRouteFilter defines processing steps that must be completed during the request or response lifecycle. GRPCRouteFilters are meant as an extension point to express processing that may be done in Gateway implementations. Some examples include request or response modification, implementing authentication strategies, rate-limiting, and traffic shaping. API guarantee/conformance is defined based on the type of the filter.

type GRPCRouteRuleSpec

type GRPCRouteRuleSpec struct {
	RouteType          L7RouteType         `json:"RouteType"`
	Matches            []GRPCTrafficMatch  `json:"Matches" hash:"set"`
	RateLimit          *RateLimit          `json:"RateLimit,omitempty"`
	AccessControlLists *AccessControlLists `json:"AccessControlLists,omitempty"`
	FaultInjection     *FaultInjection     `json:"Fault,omitempty"`
}

GRPCRouteRuleSpec is the GRPC route rule configuration

func (*GRPCRouteRuleSpec) GetAccessControlLists

func (r *GRPCRouteRuleSpec) GetAccessControlLists() *AccessControlLists

func (*GRPCRouteRuleSpec) GetFaultInjection

func (r *GRPCRouteRuleSpec) GetFaultInjection() *FaultInjection

func (*GRPCRouteRuleSpec) GetRateLimit

func (r *GRPCRouteRuleSpec) GetRateLimit() *RateLimit

func (*GRPCRouteRuleSpec) SetAccessControlLists

func (r *GRPCRouteRuleSpec) SetAccessControlLists(accessControlLists *AccessControlLists)

func (*GRPCRouteRuleSpec) SetFaultInjection

func (r *GRPCRouteRuleSpec) SetFaultInjection(faultInjection *FaultInjection)

func (*GRPCRouteRuleSpec) SetRateLimit

func (r *GRPCRouteRuleSpec) SetRateLimit(rateLimit *RateLimit)

func (*GRPCRouteRuleSpec) Sort

func (r *GRPCRouteRuleSpec) Sort()

type GRPCTrafficMatch

type GRPCTrafficMatch struct {
	Headers            map[MatchType]map[string]string `json:"Headers,omitempty"`
	Method             *GRPCMethod                     `json:"Method,omitempty"`
	BackendService     map[string]BackendServiceConfig `json:"BackendService"`
	RateLimit          *RateLimit                      `json:"RateLimit,omitempty"`
	AccessControlLists *AccessControlLists             `json:"AccessControlLists,omitempty"`
	FaultInjection     *FaultInjection                 `json:"Fault,omitempty"`
	Filters            []Filter                        `json:"Filters,omitempty" hash:"set"`
}

GRPCTrafficMatch is the GRPC traffic match configuration

type HTTPHeader

type HTTPHeader struct {
	Name  string `json:"Name"`
	Value string `json:"Value"`
}

type HTTPHeaderFilter

type HTTPHeaderFilter struct {
	Set    []HTTPHeader `json:"Set,omitempty" hash:"set"`
	Add    []HTTPHeader `json:"Add,omitempty" hash:"set"`
	Remove []string     `json:"Remove,omitempty" hash:"set"`
}

type HTTPPathModifier

type HTTPPathModifier struct {
	Type               gwv1beta1.HTTPPathModifierType `json:"Type"`
	ReplaceFullPath    *string                        `json:"ReplaceFullPath,omitempty"`
	ReplacePrefixMatch *string                        `json:"ReplacePrefixMatch,omitempty"`
}

HTTPPathModifier defines configuration for path modifiers.

type HTTPRequestMirrorFilter

type HTTPRequestMirrorFilter struct {
	BackendService string `json:"BackendService"`
}

type HTTPRequestRedirectFilter

type HTTPRequestRedirectFilter struct {
	Scheme     *string           `json:"Scheme,omitempty"`
	Hostname   *string           `json:"Hostname,omitempty"`
	Path       *HTTPPathModifier `json:"Path,omitempty"`
	Port       *int32            `json:"Port,omitempty"`
	StatusCode *int              `json:"StatusCode,omitempty"`
}

HTTPRequestRedirectFilter defines a filter that redirects a request. This filter MUST NOT be used on the same Route rule as a HTTPURLRewrite filter.

type HTTPRouteFilter

type HTTPRouteFilter struct {
	// Type identifies the type of filter to apply. As with other API fields,
	// types are classified into three conformance levels:
	Type gwv1beta1.HTTPRouteFilterType `json:"Type"`

	// RequestHeaderModifier defines a schema for a filter that modifies request
	RequestHeaderModifier *HTTPHeaderFilter `json:"RequestHeaderModifier,omitempty"`

	// ResponseHeaderModifier defines a schema for a filter that modifies response
	ResponseHeaderModifier *HTTPHeaderFilter `json:"ResponseHeaderModifier,omitempty"`

	// RequestMirror defines a schema for a filter that mirrors requests.
	// Requests are sent to the specified destination, but responses from
	// that destination are ignored.
	RequestMirror *HTTPRequestMirrorFilter `json:"RequestMirror,omitempty"`

	// RequestRedirect defines a schema for a filter that responds to the
	// request with an HTTP redirection.
	RequestRedirect *HTTPRequestRedirectFilter `json:"RequestRedirect,omitempty"`

	// URLRewrite defines a schema for a filter that modifies a request during forwarding.
	URLRewrite *HTTPURLRewriteFilter `json:"UrlRewrite,omitempty"`

	// ExtensionRef is an optional, implementation-specific extension to the
	// "filter" behavior.  For example, resource "myroutefilter" in group
	// "networking.example.net"). ExtensionRef MUST NOT be used for core and
	// extended filters.
	ExtensionRef *gwv1beta1.LocalObjectReference `json:"ExtensionRef,omitempty"`
}

HTTPRouteFilter defines processing steps that must be completed during the request or response lifecycle. HTTPRouteFilters are meant as an extension point to express processing that may be done in Gateway implementations. Some examples include request or response modification, implementing authentication strategies, rate-limiting, and traffic shaping. API guarantee/conformance is defined based on the type of the filter.

type HTTPRouteRuleSpec

type HTTPRouteRuleSpec struct {
	RouteType          L7RouteType         `json:"RouteType"`
	Matches            []HTTPTrafficMatch  `json:"Matches" hash:"set"`
	RateLimit          *RateLimit          `json:"RateLimit,omitempty"`
	AccessControlLists *AccessControlLists `json:"AccessControlLists,omitempty"`
	FaultInjection     *FaultInjection     `json:"Fault,omitempty"`
}

HTTPRouteRuleSpec is the HTTP route rule configuration

func (*HTTPRouteRuleSpec) GetAccessControlLists

func (r *HTTPRouteRuleSpec) GetAccessControlLists() *AccessControlLists

func (*HTTPRouteRuleSpec) GetFaultInjection

func (r *HTTPRouteRuleSpec) GetFaultInjection() *FaultInjection

func (*HTTPRouteRuleSpec) GetRateLimit

func (r *HTTPRouteRuleSpec) GetRateLimit() *RateLimit

func (*HTTPRouteRuleSpec) SetAccessControlLists

func (r *HTTPRouteRuleSpec) SetAccessControlLists(accessControlLists *AccessControlLists)

func (*HTTPRouteRuleSpec) SetFaultInjection

func (r *HTTPRouteRuleSpec) SetFaultInjection(faultInjection *FaultInjection)

func (*HTTPRouteRuleSpec) SetRateLimit

func (r *HTTPRouteRuleSpec) SetRateLimit(rateLimit *RateLimit)

func (*HTTPRouteRuleSpec) Sort

func (r *HTTPRouteRuleSpec) Sort()

type HTTPTrafficMatch

type HTTPTrafficMatch struct {
	Path               *Path                           `json:"Path,omitempty"`
	Headers            map[MatchType]map[string]string `json:"Headers,omitempty"`
	RequestParams      map[MatchType]map[string]string `json:"RequestParams,omitempty"`
	Methods            []string                        `json:"Methods,omitempty" hash:"set"`
	BackendService     map[string]BackendServiceConfig `json:"BackendService"`
	RateLimit          *RateLimit                      `json:"RateLimit,omitempty"`
	AccessControlLists *AccessControlLists             `json:"AccessControlLists,omitempty"`
	FaultInjection     *FaultInjection                 `json:"Fault,omitempty"`
	Filters            []Filter                        `json:"Filters,omitempty" hash:"set"`
}

HTTPTrafficMatch is the HTTP traffic match configuration

type HTTPURLRewriteFilter

type HTTPURLRewriteFilter struct {
	Hostname *string           `json:"Hostname,omitempty"`
	Path     *HTTPPathModifier `json:"Path,omitempty"`
}

HTTPURLRewriteFilter defines a filter that modifies a request during forwarding. At most one of these filters may be used on a Route rule.

type HealthCheck

type HealthCheck struct {
	Interval    int32              `json:"Interval"`
	MaxFails    int32              `json:"MaxFails"`
	FailTimeout *int32             `json:"FailTimeout,omitempty"`
	Path        *string            `json:"Path,omitempty"`
	Matches     []HealthCheckMatch `json:"Matches,omitempty" hash:"set"`
}

HealthCheck is the health check configuration

type HealthCheckLog

type HealthCheckLog struct {
	StorageAddress *string `json:"StorageAddress,omitempty"`
	Authorization  *string `json:"Authorization,omitempty"`
}

type HealthCheckMatch

type HealthCheckMatch struct {
	StatusCodes []int32                             `json:"StatusCodes,omitempty" hash:"set"`
	Body        *string                             `json:"Body,omitempty"`
	Headers     map[gwv1beta1.HTTPHeaderName]string `json:"Headers,omitempty"`
}

HealthCheckMatch is the health check match configuration

type L7RouteRule

type L7RouteRule map[string]L7RouteRuleSpec

L7RouteRule is the L7 route rule configuration

type L7RouteRuleSpec

type L7RouteRuleSpec interface {
	GetRateLimit() *RateLimit
	SetRateLimit(rateLimit *RateLimit)
	GetAccessControlLists() *AccessControlLists
	SetAccessControlLists(accessControlLists *AccessControlLists)
	GetFaultInjection() *FaultInjection
	SetFaultInjection(faultInjection *FaultInjection)
}

L7RouteRuleSpec is the L7 route rule configuration

type L7RouteType

type L7RouteType string

L7RouteType is the type of route

const (
	// L7RouteTypeHTTP is the HTTP route type
	L7RouteTypeHTTP L7RouteType = "HTTP"

	// L7RouteTypeGRPC is the GRPC route type
	L7RouteTypeGRPC L7RouteType = "GRPC"
)

type Listener

type Listener struct {
	Protocol           gwv1beta1.ProtocolType `json:"Protocol"`
	Port               gwv1beta1.PortNumber   `json:"Port"`
	Listen             gwv1beta1.PortNumber   `json:"Listen"`
	TLS                *TLS                   `json:"TLS,omitempty"`
	AccessControlLists *AccessControlLists    `json:"AccessControlLists,omitempty"`
	BpsLimit           *int64                 `json:"BpsLimit,omitempty"`
}

Listener is the listener configuration

type MatchType

type MatchType string

MatchType is the type of match

const (
	// MatchTypeExact is the exact match type
	MatchTypeExact MatchType = "Exact"

	// MatchTypePrefix is the prefix match type
	MatchTypePrefix MatchType = "Prefix"

	// MatchTypeRegex is the regex match type
	MatchTypeRegex MatchType = "Regex"
)

func (MatchType) Ordinal

func (m MatchType) Ordinal() int32

type PassthroughRouteMapping

type PassthroughRouteMapping map[string]string

PassthroughRouteMapping is the passthrough route mapping configuration

type Path

type Path struct {
	MatchType MatchType `json:"Type"`
	Path      string    `json:"Path"`
}

Path is the path configuration

type ProxyTag

type ProxyTag struct {
	SrcHostHeader string `json:"SrcHostHeader"`
	DstHostHeader string `json:"DstHostHeader"`
}

type RateLimit

type RateLimit struct {
	Mode                 gwpav1alpha1.RateLimitPolicyMode    `json:"Mode"`
	Backlog              int32                               `json:"Backlog"`
	Requests             int32                               `json:"Requests"`
	Burst                int32                               `json:"Burst"`
	StatTimeWindow       int32                               `json:"StatTimeWindow"`
	ResponseStatusCode   int32                               `json:"ResponseStatusCode"`
	ResponseHeadersToAdd map[gwv1beta1.HTTPHeaderName]string `json:"ResponseHeadersToAdd,omitempty" hash:"set"`
}

RateLimit is the rate limit configuration

type ResourceUsage

type ResourceUsage struct {
	ScrapeInterval int32   `json:"ScrapeInterval"`
	StorageAddress *string `json:"StorageAddress,omitempty"`
	Authorization  *string `json:"Authorization,omitempty"`
}

type Retry

type Retry struct {
	RetryOn             string   `json:"RetryOn"`
	NumRetries          *int32   `json:"NumRetries,omitempty"`
	BackoffBaseInterval *float32 `json:"BackoffBaseInterval,omitempty"`
}

Retry is the retry policy configuration

type RouteRule

type RouteRule interface{}

RouteRule is the route rule configuration

type ServiceConfig

type ServiceConfig struct {
	Endpoints           map[string]Endpoint            `json:"Endpoints"`
	Retry               *Retry                         `json:"Retry,omitempty"`
	MTLS                *bool                          `json:"MTLS,omitempty"`
	UpstreamCert        *UpstreamCert                  `json:"UpstreamCert,omitempty"`
	StickyCookieName    *string                        `json:"StickyCookieName,omitempty"`
	StickyCookieExpires *int32                         `json:"StickyCookieExpires,omitempty"`
	LoadBalancer        *gwpav1alpha1.LoadBalancerType `json:"Algorithm,omitempty"`
	CircuitBreaking     *CircuitBreaking               `json:"CircuitBreaking,omitempty"`
	HealthCheck         *HealthCheck                   `json:"HealthCheck,omitempty"`
}

ServiceConfig is the service configuration

type ServicePortName

type ServicePortName struct {
	types.NamespacedName
	Port *int32
}

ServicePortName is a combination of a service name, namespace, and port

func (*ServicePortName) String

func (spn *ServicePortName) String() string

type TCPRouteRule

type TCPRouteRule map[string]int32

TCPRouteRule is the TCP route rule configuration

type TLS

type TLS struct {
	TLSModeType  gwv1beta1.TLSModeType `json:"TLSModeType"`
	MTLS         *bool                 `json:"MTLS,omitempty"`
	Certificates []Certificate         `json:"Certificates,omitempty" hash:"set"`
}

TLS is the TLS configuration

type TLSBackendService

type TLSBackendService map[string]int32

TLSBackendService is the TLS backend service configuration

type TLSPassthroughRouteRule

type TLSPassthroughRouteRule map[string]string

TLSPassthroughRouteRule is the TLS passthrough route rule configuration

type TLSTerminateRouteRule

type TLSTerminateRouteRule map[string]TLSBackendService

TLSTerminateRouteRule is the TLS terminate route rule configuration

type UDPRouteRule

type UDPRouteRule map[string]int32

UDPRouteRule is the UDP route rule configuration

type UpstreamCert

type UpstreamCert Certificate

UpstreamCert is the upstream certificate configuration

Jump to

Keyboard shortcuts

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