Documentation
¶
Index ¶
- 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)
- type Config
- type Configurator
- func (cnf *Configurator) AddOrUpdateDHParam(content string) (string, error)
- func (cnf *Configurator) AddOrUpdateIngress(name string, ingEx *IngressEx)
- func (cnf *Configurator) DeleteIngress(name string)
- func (cnf *Configurator) UpdateConfig(config *Config)
- func (cnf *Configurator) UpdateEndpoints(name string, ingEx *IngressEx)
- type IngressEx
- type IngressNginxConfig
- type Location
- type NginxController
- func (nginx *NginxController) AddOrUpdateCertAndKey(name string, cert string, key string) string
- func (nginx *NginxController) AddOrUpdateDHParam(dhparam string) (string, error)
- func (nginx *NginxController) AddOrUpdateIngress(name string, config IngressNginxConfig)
- func (nginx *NginxController) DeleteIngress(name string)
- func (nginx *NginxController) Reload() error
- func (nginx *NginxController) Start()
- func (nginx *NginxController) UpdateMainConfigFile(cfg *NginxMainConfig)
- type NginxMainConfig
- type Server
- type Upstream
- type UpstreamServer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetMapKeyAsBool ¶ added in v0.6.0
GetMapKeyAsBool searches the map for the given key and parses the key as bool
func GetMapKeyAsInt ¶ added in v0.6.0
GetMapKeyAsInt tries to find and parse a key in a map as int64
Types ¶
type Config ¶
type Config struct {
LocationSnippets []string
ServerSnippets []string
ServerTokens string
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
}
Config holds NGINX configuration parameters
func NewDefaultConfig ¶
func NewDefaultConfig() *Config
NewDefaultConfig creates a Config with default values
type Configurator ¶
type Configurator struct {
// contains filtered or unexported fields
}
Configurator transforms an Ingress resource into NGINX Configuration
func NewConfigurator ¶
func NewConfigurator(nginx *NginxController, config *Config, nginxAPI *plus.NginxAPIController) *Configurator
NewConfigurator creates a new Configurator
func (*Configurator) AddOrUpdateDHParam ¶ added in v0.7.0
func (cnf *Configurator) AddOrUpdateDHParam(content string) (string, error)
func (*Configurator) AddOrUpdateIngress ¶
func (cnf *Configurator) AddOrUpdateIngress(name string, ingEx *IngressEx)
AddOrUpdateIngress adds or updates NGINX configuration for an Ingress resource
func (*Configurator) DeleteIngress ¶
func (cnf *Configurator) DeleteIngress(name string)
DeleteIngress deletes NGINX configuration for an Ingress resource
func (*Configurator) UpdateConfig ¶
func (cnf *Configurator) UpdateConfig(config *Config)
UpdateConfig updates NGINX Configuration parameters
func (*Configurator) UpdateEndpoints ¶
func (cnf *Configurator) UpdateEndpoints(name string, ingEx *IngressEx)
UpdateEndpoints updates endpoints in NGINX configuration for an Ingress resource
type IngressEx ¶
type IngressEx struct {
Ingress *extensions.Ingress
Secrets map[string]*api_v1.Secret
Endpoints map[string][]string
}
IngressEx holds an Ingress along with Secrets and Endpoints of the services that are referenced in this Ingress
type IngressNginxConfig ¶
IngressNginxConfig describes an NGINX configuration
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(nginxConfPath string, local bool, healthStatus bool, nginxConfTemplatePath string, nginxIngressTemplatePath string) (*NginxController, error)
NewNginxController creates a NGINX controller
func (*NginxController) AddOrUpdateCertAndKey ¶
func (nginx *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 ¶ added in v0.7.0
func (nginx *NginxController) AddOrUpdateDHParam(dhparam string) (string, error)
AddOrUpdateDHParam creates the servers dhparam.pem file
func (*NginxController) AddOrUpdateIngress ¶
func (nginx *NginxController) AddOrUpdateIngress(name string, config IngressNginxConfig)
AddOrUpdateIngress creates or updates a file with the specified configuration for the specified ingress
func (*NginxController) DeleteIngress ¶
func (nginx *NginxController) DeleteIngress(name string)
DeleteIngress deletes the configuration file, which corresponds for the specified ingress from NGINX conf directory
func (*NginxController) UpdateMainConfigFile ¶
func (nginx *NginxController) UpdateMainConfigFile(cfg *NginxMainConfig)
UpdateMainConfigFile update the main NGINX configuration file
type NginxMainConfig ¶
type NginxMainConfig 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
}
NginxMainConfig describe the main NGINX configuration file
type Server ¶
type Server struct {
ServerSnippets []string
Name string
ServerTokens string
Locations []Location
SSL bool
SSLCertificate string
SSLCertificateKey string
StatusZone 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
type Upstream ¶
type Upstream struct {
Name string
UpstreamServers []UpstreamServer
StickyCookie string
}
Upstream describes an NGINX 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