model

package
v5.1.11-release+incomp... Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2020 License: LGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessLog

type AccessLog struct {
	Name string
	Path string
}

AccessLog -

type Backend

type Backend struct {
	// Name represents an unique apiv1.Service name formatted as <namespace>-<name>-<port>
	Name string `json:"name"`

	Endpoints []Endpoint `json:"endpoints,omitempty"`
	// StickySessionAffinitySession contains the StickyConfig object with stickyness configuration
	SessionAffinity SessionAffinityConfig `json:"sessionAffinityConfig"`
	// Consistent hashing by NGINX variable
	UpstreamHashBy string `json:"upstream-hash-by,omitempty"`
	// LB algorithm configuration per ingress
	LoadBalancing string `json:"load-balance,omitempty"`
}

Backend describes one or more remote server/s (endpoints) associated with a service

func CreateBackendByPool

func CreateBackendByPool(pool *v1.Pool) *Backend

CreateBackendByPool create backend by pool

type Config

type Config struct {
	Backends []*Backend `json:"backends"`
}

Config update config

type CookieSessionAffinity

type CookieSessionAffinity struct {
	Name      string              `json:"name"`
	Hash      string              `json:"hash"`
	Expires   string              `json:"expires,omitempty"`
	MaxAge    string              `json:"maxage,omitempty"`
	Locations map[string][]string `json:"locations,omitempty"`
	Path      string              `json:"path,omitempty"`
}

CookieSessionAffinity defines the structure used in Affinity configured by Cookies. +k8s:deepcopy-gen=true

type Endpoint

type Endpoint struct {
	// Address IP address of the endpoint
	Address string `json:"address"`
	// Port number of the TCP port
	Port string `json:"port"`
	// Weight weight of the endpoint
	Weight int `json:"weight"`
	// Target returns a reference to the object providing the endpoint
	Target *apiv1.ObjectReference `json:"target,omitempty"`
}

Endpoint describes a kubernetes endpoint in a backend +k8s:deepcopy-gen=true

type EventLog

type EventLog struct {
	Path  string
	Level string
}

EventLog -

type Events

type Events struct {
	WorkerConnections int
	EnableEpoll       bool
	EnableMultiAccept bool
}

Events nginx events config model

type FastCGIParam

type FastCGIParam struct {
	Param string
	Value string
}

FastCGIParam sets a parameter that should be passed to the FastCGI server.

type HTTP

type HTTP struct {
	DefaultType      string
	SendFile         bool
	KeepaliveTimeout Time

	ClientMaxBodySize    Size
	ClientBodyBufferSize Size
	ProxyConnectTimeout  Time
	ProxySendTimeout     Time
	ProxyReadTimeout     Time
	ProxyBufferSize      Size
	ProxyBuffers         Size
	ProxyBusyBuffersSize Size
	StatusPort           int
	UpstreamsDict        Size
	HTTPListen           int
	HTTPSListen          int
	// contains filtered or unexported fields
}

HTTP contains data for nginx http configuration

func NewHTTP

func NewHTTP(conf *option.Config) *HTTP

NewHTTP creates a new model.HTTP

type Hash

type Hash struct {
	Key           bool // The key can contain text, variables, and their combinations.
	UseConsistent bool // If the consistent parameter is specified the ketama consistent hashing method will be used instead.
}

Specifies a load balancing method for a server group where the client-server mapping is based on the hashed key value

type Location

type Location struct {
	Path    string
	Rewrite rewrite.Config
	Return  Return
	// Sets the protocol and address of a proxied server and an optional URI to which a location should be mapped
	ProxyPass string
	// Sets the text that should be changed in the “Location” and “Refresh” header fields of a proxied server response
	// TODO: mv ProxyRedirect to Proxy
	ProxyRedirect string

	EnableMetrics    bool //Enables or disables monitor
	DisableAccessLog bool //disable or enables access log
	AccessLogPath    string
	ErrorLogPath     string
	DisableProxyPass bool
	//PathRewrite if true, path will not passed to the upstream
	PathRewrite   bool
	NameCondition map[string]*v1.Condition

	// Proxy contains information about timeouts and buffer sizes
	// to be used in connections against endpoints
	// +optional
	Proxy proxy.Config `json:"proxy,omitempty"`
}

Location sets configuration depending on a request URI.

func (*Location) Validation

func (s *Location) Validation() error

Validation validation nginx parameters

type LogFormat

type LogFormat struct {
	Name   string
	Format string
}

LogFormat -

type Nginx

type Nginx struct {
	WorkerProcesses    int
	WorkerRlimitNofile int
	ErrorLog           string
	User               string
	EventLog           EventLog
	Events             Events
	HTTP               *HTTP
}

Nginx nginx config model

func NewNginx

func NewNginx(conf option.Config) *Nginx

NewNginx new nginx config

type Params

type Params struct {
	Weight      int    // Default 1. Sets the weight of the server.
	MaxConns    int    // Default value is zero, meaning there is no limit. Limits the maximum number of simultaneous active connections to the proxied server.
	MaxFails    int    // Sets the number of unsuccessful attempts to communicate with the server.
	FailTimeout string // default 10s. The period of time the server will be considered unavailable.
	UseBackup   bool   // Marks the server as a backup server.
	UseDown     bool   // Marks the server as permanently unavailable.
	UseResolve  bool   // Monitors changes of the IP addresses that correspond to a domain name of the server, and automatically modifies the upstream configuration without the need of restarting nginx.
	Route       string // Sets the server route name.
	Service     string // Enables resolving of DNS SRV records and sets the service name
	SlowStart   Time   // Sets the time during which the server will recover its weight from zero to a nominal value, when unhealthy server becomes healthy, or when the server becomes available after a period of time it was considered unavailable.
	UseDrain    bool   // Puts the server into the “draining” mode
}

parameters of a server in upstream

type ProxySetHeader

type ProxySetHeader struct {
	Field string
	Value string
}

ProxySetHeader allows redefining or appending fields to the request header passed to the proxied server.

type Queue

type Queue struct {
	Num     int  // The maximum number of requests
	Timeout Time // Default 60s. The time a request can be kept in the queue.
}

If an upstream server cannot be selected immediately while processing a request, the request will be placed into the queue

type Random

type Random struct {
	UseRandom bool
	UseTwo    bool   // The optional two parameter instructs nginx to randomly select two servers and then choose a server using the specified method.
	Method    string // The default method is least_conn.
}

type Return

type Return struct {
	Code int
	Text string
	URL  string
}

Return stops processing and returns the specified code to a client.

type Rewrite

type Rewrite struct {
	Regex       string
	Replacement string
	Flag        string
}

Rewrite matching request URI to replacement.

type Server

type Server struct {
	Listen                  string // DefaultType: listen *:80 | *:8000; Sets the address and port for IP, or the path for a UNIX-domain socket on which the server will accept requests
	Root                    string // Sets the root directory for requests.
	ServerName              string // Sets names of a virtual server
	KeepaliveTimeout        Time   // DefaultType 60s. Sets a timeout during which an idle keepalive connection to an upstream server will stay open.
	DefaultType             string // Defines the default MIME type of a response.
	Charset                 string // Adds the specified charset to the “Content-Type” response header field.
	ServerTokens            bool   // Enables or disables emitting nginx version on error pages and in the “Server” response header field.
	ClientMaxBodySize       Size   // Sets the maximum allowed size of the client request body
	ChunkedTransferEncoding bool   // Allows disabling chunked transfer encoding in HTTP/1.1
	ProxyConnectTimeout     Time
	ProxyTimeout            Time
	ProxyPass               string
	SSLCertificate          string // Specifies a file with the certificate in the PEM format.
	SSLCertificateKey       string // Specifies a file with the secret key in the PEM format.
	ForceSSLRedirect        bool
	Return                  Return
	Rewrites                []Rewrite
	Locations               []*Location
	OptionValue             map[string]string
}

Server sets configuration for a virtual server...

func (*Server) Validation

func (s *Server) Validation() error

Validation validation nginx parameters

type SessionAffinityConfig

type SessionAffinityConfig struct {
	AffinityType          string                `json:"name"`
	CookieSessionAffinity CookieSessionAffinity `json:"cookieSessionAffinity"`
}

SessionAffinityConfig describes different affinity configurations for new sessions. Once a session is mapped to a backend based on some affinity setting, it retains that mapping till the backend goes down, or the ingress controller restarts. Exactly one of these values will be set on the upstream, since multiple affinity values are incompatible. Once set, the backend makes no guarantees about honoring updates.

type Size

type Size struct {
	Num  int
	Unit string
}

Size -

type Stream

type Stream struct {
	Includes []string
}

Stream -

func NewStream

func NewStream() *Stream

NewStream creates a new stream.

type Time

type Time struct {
	Num  int
	Unit string
}

Time -

type UServer

type UServer struct {
	Address string
	Params  Params
}

Defines the address and other parameters of a server in upstream

type Upstream

type Upstream struct {
	Name              string
	UseIpHash         bool // The method ensures that requests from the same client will always be passed to the same server except when this server is unavailable.
	Zone              Zone
	State             string // Specifies a file that keeps the state of the dynamically configurable group.
	Hash              Hash
	Keepalive         int   // Sets the maximum number of idle keepalive connections to upstream servers that are preserved in the cache of each worker process
	KeepaliveRequests int   // Default 100. Sets the maximum number of requests that can be served through one keepalive connection.
	KeepaliveTimeout  Time  // Default 60s. Sets a timeout during which an idle keepalive connection to an upstream server will stay open.
	UseNtlm           bool  // Allows proxying requests with NTLM Authentication.
	UseLeastConn      bool  // Pass the request to the sever with the least numbers of connections.
	Queue             Queue // TODO [emerg] unknown directive "queue"
	Random            Random
	Servers           []UServer
}

Defines a group of servers

func (Upstream) Validation

func (u Upstream) Validation() error

Validation validation nginx parameters

type Zone

type Zone struct {
	Name string
	Size Size
}

Defines the name and size of the shared memory zone that keeps the group’s configuration and run-time state that are shared between worker processes

Jump to

Keyboard shortcuts

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