Documentation ¶
Overview ¶
Package config contains the configuration sent to the agent for nginx.
Index ¶
- Constants
- func TrafficSplitBackendExists(backend split.TrafficSplitBackend, backends []split.TrafficSplitBackend) bool
- type AgentBreaker
- type AgentKeyval
- type AgentLimit
- type AgentRateLimit
- type AgentTrafficSplit
- type Block
- type CombinedConfig
- type EgressEndpoint
- type LBMethod
- type NginxDynSplitBackend
- type Pod
- type Upstream
- type UpstreamServer
Constants ¶
const ( EgressSSLPort = 443 EgressPort = 80 )
Egress ports.
Variables ¶
This section is empty.
Functions ¶
func TrafficSplitBackendExists ¶
func TrafficSplitBackendExists(backend split.TrafficSplitBackend, backends []split.TrafficSplitBackend) bool
TrafficSplitBackendExists returns whether or not a TrafficSplitBackend exists in the list.
Types ¶
type AgentBreaker ¶
type AgentBreaker map[string]specs.CircuitBreakerSpec
AgentBreaker is a map of destination names to their associated circuit breaker specs.
type AgentKeyval ¶
AgentKeyval holds the data for configuring a single keyval in the agent.
type AgentLimit ¶
type AgentLimit map[string][]AgentRateLimit
AgentLimit holds a one-to-one mapping of how the agent will configure rate limiting.
func NewAgentLimit ¶
func NewAgentLimit() AgentLimit
NewAgentLimit returns an initialized map from dest string to array of sources.
type AgentRateLimit ¶
type AgentRateLimit struct { // Delay sets the amount a request will be delayed (in seconds) when the rate // limit is hit. Set to "nodelay" to send back an 503 status immediately // see: https://www.nginx.com/blog/rate-limiting-nginx/#bursts // +optional Delay *intstr.IntOrString `json:"delay,omitempty"` // Name of Rate Limit, i.e. 10rs Name string `json:"name"` // Maximum allowed rate of traffic Rate string `json:"rate"` // Matches is a string representation of a list of specs.HTTPMatch that should be applied to the rate limit. Matches string `json:"matches,omitempty"` // Sources defines from where traffic should be limited // +optional Sources []v1.ObjectReference `json:"sources,omitempty"` // Burst sets the maximum number of requests a client can make in excess of rate // see: https://www.nginx.com/blog/rate-limiting-nginx/#bursts // +optional Burst int `json:"burst,omitempty"` }
AgentRateLimit is a wrapper around the RateLimitSpec that contains a string of specs.HTTPMatch instead of the rules field.
type AgentTrafficSplit ¶
type AgentTrafficSplit struct { // Service represents the apex service. Service string `json:"service"` // Matches is a string representation of a list of specs.HTTPMatch that should be applied to the traffic split. Matches string `json:"matches,omitempty"` // Backends defines a list of Kubernetes services // used as the traffic split destination. Backends []split.TrafficSplitBackend `json:"backends"` }
AgentTrafficSplit mirrors a split.TrafficSplitSpec, but uses a map of specs.HTTPMatch json strings instead of v1.TypedLocalObjectReference, for easier handling by the agent.
func (*AgentTrafficSplit) Equals ¶
func (a *AgentTrafficSplit) Equals(tsplit AgentTrafficSplit) bool
Equals returns whether or not two AgentTrafficSplits are equal.
type Block ¶
type Block int
Block defines model for Block.
HTTP and Stream are the two major Blocks in the NGINX config. It's very important to keep track of which Block a Port belongs in.
func (Block) MarshalJSON ¶
MarshalJSON marshals a Block enum into JSON.
func (*Block) UnmarshalJSON ¶
UnmarshalJSON unmarshals a Block, to a Block enum.
type CombinedConfig ¶
type CombinedConfig struct { Pods map[string]Pod ServiceAddresses AgentKeyval HTTPPlaceholders AgentKeyval StreamPlaceholders AgentKeyval HTTPSvcNames AgentKeyval StreamSvcNames AgentKeyval Redirects AgentKeyval HTTPLBMethods map[string]string StreamLBMethods map[string]string HTTPUpstreams map[string][]UpstreamServer StreamUpstreams map[string][]UpstreamServer HTTPEgressUpstream *EgressEndpoint TrafficSplits map[string]AgentTrafficSplit RateLimits AgentLimit CircuitBreakers AgentBreaker HTTPAccessControl map[string]AgentKeyval StreamAccessControl map[string]AgentKeyval MeshConfig mesh.MeshConfig }
CombinedConfig contains all the configs consumed by the sidecar agent. For use by agent when unmarshaling config.
type EgressEndpoint ¶
type EgressEndpoint struct { DNSName string Upstreams []UpstreamServer }
EgressEndpoint contains the DNS name and the upstream servers for egress.
type LBMethod ¶
type LBMethod struct { Method mesh.MeshConfigLoadBalancingMethod Block Block }
LBMethod represents a load balancing method for an nginx block.
type NginxDynSplitBackend ¶
NginxDynSplitBackend is the expected backend struct of ngx_http_dyn_split_module.
type Pod ¶
type Pod struct { ContainerPorts map[string]string ParentName string ParentType string Name string Namespace string ServiceAccountName string PodIP string IsIngressController bool IsEgressController bool Injected bool DefaultEgressAllowed bool }
Pod defines the configuration of a single pod.
type Upstream ¶
type Upstream struct { Name string UpstreamServers []UpstreamServer Block Block }
Upstream should correspond to a service DNS name.
type UpstreamServer ¶
UpstreamServer defines an upstream address and port.