Documentation ¶
Index ¶
- Constants
- func GetMapKeyAsBool(m map[string]string, key string, context apiObject) (bool, bool, error)
- func GetMapKeyAsInt(m map[string]string, key string, context apiObject) (int64, bool, error)
- func GetMapKeyAsStringSlice(m map[string]string, key string, context apiObject, delimiter string) ([]string, bool, error)
- func IsStreamUpstreamDefault(su StreamUpstream) bool
- type Configuration
- type Configurator
- func (cfgtor *Configurator) AddOrUpdateDHParam(content string) (string, error)
- func (cfgtor *Configurator) AddOrUpdateIngress(name string, ingEx *IngressEx) error
- func (cfgtor *Configurator) AddOrUpdateNode(key string, ip string, active bool) error
- func (cfgtor *Configurator) AddOrUpdateService(name string, svc *ServiceSpec) error
- func (cfgtor *Configurator) DeleteConfiguration(name string, cfgType Configuration)
- func (cfgtor *Configurator) DeleteNode(key string) error
- func (cfgtor *Configurator) UpdateIngressEndpoints(name string, ingEx *IngressEx) error
- func (cfgtor *Configurator) UpdateMainConfigHTTPContext(config *HTTPContext) error
- func (cfgtor *Configurator) UpdateServiceEndpoints(name string, svc *ServiceSpec) error
- type HTTPContext
- type HTTPNginxConfig
- type IngressEx
- type Location
- type NginxController
- func (ngxc *NginxController) AddOrUpdateCertAndKey(name string, cert string, key string) string
- func (ngxc *NginxController) AddOrUpdateDHParam(dhparam string) (string, error)
- func (ngxc *NginxController) AddOrUpdateHTTPConfiguration(name string, config HTTPNginxConfig)
- func (ngxc *NginxController) AddOrUpdateStream(name string, config StreamNginxConfig)
- func (ngxc *NginxController) DeleteHTTPConfiguration(name string)
- func (ngxc *NginxController) DeleteStreamConfiguration(name string)
- func (ngxc *NginxController) Reload() error
- func (ngxc *NginxController) Start()
- func (ngxc *NginxController) UpdateMainConfigFile()
- type NginxMainConfig
- type NginxMainEventConfig
- type NginxMainHTTPConfig
- type Server
- type ServiceSpec
- type StreamListen
- type StreamNginxConfig
- type StreamServer
- type StreamUpstream
- type StreamUpstreamServer
- type Upstream
- type UpstreamServer
Constants ¶
const ( LocalCfg = Configuration(iota) StreamCfg HTTPCfg StreamHTTPCfg )
Variables ¶
This section is empty.
Functions ¶
func GetMapKeyAsBool ¶
GetMapKeyAsBool searches the map for the given key and parses the key as bool
func GetMapKeyAsInt ¶
GetMapKeyAsInt tries to find and parse a key in a map as int64
func GetMapKeyAsStringSlice ¶
func GetMapKeyAsStringSlice(m map[string]string, key string, context apiObject, delimiter string) ([]string, bool, error)
GetMapKeyAsStringSlice tries to find and parse a key in the map as string slice splitting it on delimiter
func IsStreamUpstreamDefault ¶
func IsStreamUpstreamDefault(su StreamUpstream) bool
IsStreamUpstreamDefault - true if still default value, false otherwise.
Types ¶
type Configurator ¶
type Configurator struct {
// contains filtered or unexported fields
}
Configurator transforms an Ingress or Service resource into NGINX Configuration
func NewConfigurator ¶
func NewConfigurator(ngxc *NginxController) *Configurator
NewConfigurator creates a new Configurator
func (*Configurator) AddOrUpdateDHParam ¶
func (cfgtor *Configurator) AddOrUpdateDHParam(content string) (string, error)
AddOrUpdateDHParam adds the content string to parameters
func (*Configurator) AddOrUpdateIngress ¶
func (cfgtor *Configurator) AddOrUpdateIngress(name string, ingEx *IngressEx) error
AddOrUpdateIngress adds or updates NGINX configuration for an Ingress resource
func (*Configurator) AddOrUpdateNode ¶
func (cfgtor *Configurator) AddOrUpdateNode(key string, ip string, active bool) error
AddOrUpdateNode - adds the node address to the nodeIPAddresses slice
func (*Configurator) AddOrUpdateService ¶
func (cfgtor *Configurator) AddOrUpdateService(name string, svc *ServiceSpec) error
AddOrUpdateService adds or updates NGINX configuration for an Service object
func (*Configurator) DeleteConfiguration ¶
func (cfgtor *Configurator) DeleteConfiguration(name string, cfgType Configuration)
DeleteConfiguration deletes NGINX configuration for an Ingress Resource or Service LoadBalancer
func (*Configurator) DeleteNode ¶
func (cfgtor *Configurator) DeleteNode(key string) error
DeleteNode - removes the node (if it exists) from the nodeIPAddresses slice
func (*Configurator) UpdateIngressEndpoints ¶
func (cfgtor *Configurator) UpdateIngressEndpoints(name string, ingEx *IngressEx) error
UpdateIngressEndpoints updates endpoints in NGINX configuration for an Ingress resource
func (*Configurator) UpdateMainConfigHTTPContext ¶
func (cfgtor *Configurator) UpdateMainConfigHTTPContext(config *HTTPContext) error
UpdateMainConfigHTTPContext updates NGINX Configuration parameters
func (*Configurator) UpdateServiceEndpoints ¶
func (cfgtor *Configurator) UpdateServiceEndpoints(name string, svc *ServiceSpec) error
UpdateServiceEndpoints updates endpoints in NGINX configuration for a Service
type HTTPContext ¶
type HTTPContext struct { // Context: http directives LocationSnippets []string ServerSnippets []string ServerTokens bool ProxyConnectTimeout string ProxyReadTimeout string ClientMaxBodySize string HTTP2 bool RedirectToHTTPS bool MainHTTPSnippets []string MainServerNamesHashBucketSize string MainServerNamesHashMaxSize string MainLogFormat 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 MainServerSSLDHParam string }
HTTPContext holds NGINX configuration parameters for an 'http' context
func NewDefaultHTTPContext ¶
func NewDefaultHTTPContext() *HTTPContext
NewDefaultHTTPContext creates a Config with default values
type HTTPNginxConfig ¶
HTTPNginxConfig describes an NGINX configuration primarily for Ingress Resource handling
type IngressEx ¶
type IngressEx struct { Ingress *extensions.Ingress Secrets map[string]*api.Secret Endpoints map[string][]string }
IngressEx holds an Ingress along with Secrets and Endpoints of the services that are referenced in this Ingress
type Location ¶
type Location struct { LocationSnippets []string Path string Upstream Upstream ProxyConnectTimeout string ProxyReadTimeout string ClientMaxBodySize string Websocket bool Rewrite string SSL bool ProxyBuffering bool ProxyBuffers string ProxyBufferSize string ProxyMaxTempFileSize string }
Location describes an NGINX location
type NginxController ¶
type NginxController struct {
// contains filtered or unexported fields
}
NginxController Updates NGINX configuration, starts and reloads NGINX
func NewNginxController ¶
func NewNginxController(cfgType Configuration, nginxConfPath string, healthStatus bool) (*NginxController, error)
NewNginxController creates a NGINX controller
func (*NginxController) AddOrUpdateCertAndKey ¶
func (ngxc *NginxController) AddOrUpdateCertAndKey(name string, cert string, key string) string
AddOrUpdateCertAndKey creates a .pem file wth the cert and the key with the specified name
func (*NginxController) AddOrUpdateDHParam ¶
func (ngxc *NginxController) AddOrUpdateDHParam(dhparam string) (string, error)
AddOrUpdateDHParam creates the servers dhparam.pem file
func (*NginxController) AddOrUpdateHTTPConfiguration ¶
func (ngxc *NginxController) AddOrUpdateHTTPConfiguration(name string, config HTTPNginxConfig)
AddOrUpdateHTTPConfiguration creates or updates a configuration file with the specified configuration for the specified HTTP Configuration
func (*NginxController) AddOrUpdateStream ¶
func (ngxc *NginxController) AddOrUpdateStream(name string, config StreamNginxConfig)
AddOrUpdateStream creates or updates a file with the specified stream config
func (*NginxController) DeleteHTTPConfiguration ¶
func (ngxc *NginxController) DeleteHTTPConfiguration(name string)
DeleteHTTPConfiguration deletes the configuration file, which corresponds for the specified HTTP resource / service load balancer from NGINX conf directory
func (*NginxController) DeleteStreamConfiguration ¶
func (ngxc *NginxController) DeleteStreamConfiguration(name string)
DeleteStreamConfiguration deletes the configuration file, which corresponds to the specified stream load balancer from NGINX conf directory
func (*NginxController) UpdateMainConfigFile ¶
func (ngxc *NginxController) UpdateMainConfigFile()
UpdateMainConfigFile update the main NGINX configuration file
type NginxMainConfig ¶
type NginxMainConfig struct { // Context: main directives Daemon bool ErrorLogFile string ErrorLogLevel string Environment map[string]string LockFile string PidFile string User string Group string WorkerPriority string // TODO: This needs to be a ConfigMap entry or CLI flag so that we can make // it a function of the number of CPUs/vCPUs, and configure the POD // resource limits propotionally for the scheduler. For now this // *should probably not* be set to 'auto' WorkerProcesses string WorkingDirectory string EventContext NginxMainEventConfig DefaultStreamContext bool DefaultHTTPContext bool HTTPContext NginxMainHTTPConfig }
NginxMainConfig describe the main NGINX configuration file
type NginxMainEventConfig ¶
type NginxMainEventConfig struct { // Context: events directives AcceptMutex bool AcceptMutexDelay string MultiAccept bool WorkerConnections string }
NginxMainEventConfig describe the main NGINX configuration file's 'events' context
type NginxMainHTTPConfig ¶
type NginxMainHTTPConfig struct { ServerNamesHashBucketSize string ServerNamesHashMaxSize string LogFormat string HealthStatus bool HTTPSnippets []string // http://nginx.org/en/docs/http/ngx_http_ssl_module.html SSLProtocols string SSLPreferServerCiphers bool SSLCiphers string SSLDHParam string }
NginxMainHTTPConfig describe the main NGINX configuration file's 'http' context
type Server ¶
type Server struct { ServerSnippets []string Name string ServerTokens bool Locations []Location SSL bool SSLCertificate string SSLCertificateKey string 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 http://nginx.org/en/docs/http/ngx_http_core_module.html
type ServiceSpec ¶
ServiceSpec holds an Service and the Endpoints of the services
type StreamListen ¶
StreamListen describes an NGINX server listener (context stream::server) http://nginx.org/en/docs/stream/ngx_stream_core_module.html#listen
type StreamNginxConfig ¶
type StreamNginxConfig struct { Resolver string Upstreams []StreamUpstream Servers []StreamServer }
StreamNginxConfig describes an NGINX Stream configuration primarly for Service LoadBalancing
type StreamServer ¶
type StreamServer struct { Listen StreamListen ProxyProtocol bool ProxyProtocolTimeout string ProxyPassAddress string }
StreamServer describes an NGINX Server (context stream) http://nginx.org/en/docs/stream/ngx_stream_core_module.html#server
type StreamUpstream ¶
type StreamUpstream struct { Name string Algorithm string LeastTimeMethod string UpstreamServers []StreamUpstreamServer }
StreamUpstream describes an NGINX upstream (context stream) http://nginx.org/en/docs/stream/ngx_stream_upstream_module.html#upstream The 'hash' directive is not supported in the 'upstream' context currently.
func NewStreamUpstreamWithDefaultServer ¶
func NewStreamUpstreamWithDefaultServer(name string) StreamUpstream
NewStreamUpstreamWithDefaultServer creates an upstream with the default server. Do not initialize Algorithm or LeastTimeMethod!
type StreamUpstreamServer ¶
type StreamUpstreamServer struct { Address string // "The address can be specified as a domain name or IP address with an obligatory port" Weight string MaxConns string MaxFails string FailTimeout string Backup bool Down bool }
StreamUpstreamServer describes a server in an NGINX upstream (context stream::upstream) http://nginx.org/en/docs/stream/ngx_stream_upstream_module.html#server The following 'server' directive parameters are ommitted, as they are only available in NGINX Plus - Resolve bool - Service string - SlowStart string
type Upstream ¶
type Upstream struct { Name string UpstreamServers []UpstreamServer }
Upstream describes an NGINX upstream (context http) http://nginx.org/en/docs/http/ngx_http_upstream_module.html#upstream
func NewUpstreamWithDefaultServer ¶
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 ¶
UpstreamServer describes a server in an NGINX upstream (context http::upstream) http://nginx.org/en/docs/http/ngx_http_upstream_module.html#server