config

package
v0.0.0-...-d2d5cb9 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const EmptyHost = ""

EmptyHost is used when no host is set

Variables

KeyFunc is used to get the k8s object key, which identifies an object

Functions

This section is empty.

Types

type BasicAuthUserSecretParser

type BasicAuthUserSecretParser interface {
	Parse(secret *api_v1.Secret) (*pb.File, error)
}

BasicAuthUserSecretParser parses secrets that contain basic auth user-password data

func NewBasicAuthUserSecretParser

func NewBasicAuthUserSecretParser() BasicAuthUserSecretParser

type ConfigMapKeyError

type ConfigMapKeyError struct {
	Key             string
	ValidationError error
}

ConfigMapKeyError is a config error for a specific key of the ConfigMap

func (*ConfigMapKeyError) Error

func (e *ConfigMapKeyError) Error() string

type ConfigMapParser

type ConfigMapParser interface {
	Parse(cfgm *api_v1.ConfigMap) (*GlobalConfig, error)
}

ConfigMapParser parses the server config from a ConfigMap

func NewConfigMapParser

func NewConfigMapParser() ConfigMapParser

NewConfigMapParser returns a new ConfigMapParser

type GlobalConfig

type GlobalConfig struct {
	LocationSnippets              []string
	ServerSnippets                []string
	ServerTokens                  bool
	ProxyConnectTimeout           string
	ProxyReadTimeout              string
	ClientMaxBodySize             string
	HTTP2                         bool
	RedirectToHTTPS               bool
	MainHTTPSnippets              []string
	MainServerNamesHashBucketSize string
	MainServerNamesHashMaxSize    string
	MainLogFormat                 string
	MainWorkerShutdownTimeout     string
	ProxyBuffering                bool
	ProxyBuffers                  string
	ProxyBufferSize               string
	ProxyMaxTempFileSize          string
	ProxyProtocol                 bool
	ProxyHideHeaders              []string
	ProxyPassHeaders              []string
	HSTS                          bool
	HSTSMaxAge                    int64
	HSTSIncludeSubdomains         bool

	// http://nginx.org/en/docs/http/ngx_http_realip_module.html
	RealIPHeader    string
	SetRealIPFrom   []string
	RealIPRecursive bool

	// http://nginx.org/en/docs/http/ngx_http_ssl_module.html
	MainServerSSLProtocols           string
	MainServerSSLPreferServerCiphers bool
	MainServerSSLCiphers             string
	MainServerSSLDHParamFile         string
}

GlobalConfig holds global NGINX configuration parameters that may be overriden by ingress annotations

func NewDefaultConfig

func NewDefaultConfig() *GlobalConfig

NewDefaultConfig creates a Config with default values

type IngressAnnotationError

type IngressAnnotationError struct {
	Annotation      string
	ValidationError error
}

IngressAnnotationError is a config error for annotation of the Ingress object

func (*IngressAnnotationError) Error

func (e *IngressAnnotationError) Error() string

type IngressConfig

type IngressConfig struct {
	Ingress *extensions.Ingress

	//
	// Annotations
	//
	LocationSnippets  []string
	ServerSnippets    []string
	ServerTokens      *bool
	ClientMaxBodySize *string
	HTTP2             *bool
	RedirectToHTTPS   *bool
	LocationModifier  *string

	ProxyBuffering *bool
	ProxyConnectTimeout,
	ProxyReadTimeout,
	ProxyBuffers,
	ProxyBufferSize,
	ProxyMaxTempFileSize *string
	ProxyProtocol    *bool
	ProxyHideHeaders []string
	ProxyPassHeaders []string

	HSTS                  *bool
	HSTSMaxAge            *int64
	HSTSIncludeSubdomains *bool

	// http://nginx.org/en/docs/http/ngx_http_realip_module.html
	RealIPHeader    *string
	SetRealIPFrom   []string
	RealIPRecursive *bool

	BasicAuth, BasicAuthUserSecret string

	WebsocketServices map[string]bool
	Rewrites          map[string]string
	SSLServices       map[string]bool
}

IngressConfig contains all configuration options from the ingress resource

type IngressConfigParser

type IngressConfigParser interface {
	Parse(ingress *extensions.Ingress) (ingCfg *IngressConfig, warning error, err error)
}

func NewIngressConfigParser

func NewIngressConfigParser() IngressConfigParser

type IngressEx

type IngressEx struct {
	Ingress   *extensions.Ingress
	Endpoints map[string][]string       // indexed by service Name + port
	Secrets   map[string]*api_v1.Secret // indexed by secret name
}

IngressEx holds an Ingress along with Endpoints of the services that are referenced in this Ingress

type Location

type Location struct {
	Path     string
	Upstream Upstream

	// Annotations/Config
	LocationSnippets     []string
	ProxyConnectTimeout  string
	ProxyReadTimeout     string
	ClientMaxBodySize    string
	Websocket            bool
	Rewrite              string
	SSL                  bool
	ProxyBuffering       bool
	ProxyBuffers         string
	ProxyBufferSize      string
	ProxyMaxTempFileSize string

	// http://nginx.org/en/docs/http/ngx_http_auth_basic_module.html
	BasicAuth, BasicAuthUserFile string
}

Location describes an NGINX location

func CreateLocation

func CreateLocation(
	path string,
	upstream Upstream,
	gCfg *GlobalConfig,
	ingCfg *IngressConfig,
	websocket bool,
	rewrite string,
	ssl bool,
) Location

CreateLocation creates a new location from the given params

type Server

type Server struct {
	Name              string
	Locations         []Location
	Upstreams         []Upstream
	SSL               bool
	SSLCertificate    string
	SSLCertificateKey string
	Files             []*pb.File

	// settings/annotations
	ServerSnippets        []string
	ServerTokens          bool
	HTTP2                 bool
	RedirectToHTTPS       bool
	ProxyProtocol         bool
	HSTS                  bool
	HSTSMaxAge            int64
	HSTSIncludeSubdomains bool
	ProxyHideHeaders      []string
	ProxyPassHeaders      []string

	// http://nginx.org/en/docs/http/ngx_http_realip_module.html
	RealIPHeader    string
	SetRealIPFrom   []string
	RealIPRecursive bool
}

Server describes an NGINX server

func CreateServerConfig

func CreateServerConfig(gCfg *GlobalConfig, ingCfg *IngressConfig) *Server

CreateServerConfig creates a new server config from the given params

type ServerConfigParser

type ServerConfigParser interface {
	Parse(
		gCfg GlobalConfig,
		ingCfg IngressConfig,
		tlsCerts map[string]*pb.File,
		endpoints map[string][]string,
	) (servers []*Server, warning, err error)
}

ServerConfigParser creates new ServerConfigs

func NewServerConfigParser

func NewServerConfigParser() ServerConfigParser

NewServerConfigParser returns a new serverConfigParser

type TLSSecretParser

type TLSSecretParser interface {
	Parse(secret *api_v1.Secret) ([]byte, error)
}

TLSSecretParser parses TLS secrets and validates them

func NewTLSSecretParser

func NewTLSSecretParser() TLSSecretParser

NewTLSSecretParser returns a new SecretParser

type Upstream

type Upstream struct {
	Name            string
	UpstreamServers []UpstreamServer
}

Upstream describes an NGINX upstream

func NewUpstreamWithDefaultServer

func NewUpstreamWithDefaultServer(name string) Upstream

NewUpstreamWithDefaultServer creates an upstream with the default server. proxy_pass to an upstream with the default server returns 502. We use it for services that have no endpoints

type UpstreamServer

type UpstreamServer struct {
	Address string
	Port    string
}

UpstreamServer describes a server in an NGINX upstream

type ValidationError

type ValidationError []error

ValidationError packs multiple validation errors into a single error

func (ValidationError) Error

func (e ValidationError) Error() string

Jump to

Keyboard shortcuts

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