nginx

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2016 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ProxyConnectTimeout           string
	ProxyReadTimeout              string
	ClientMaxBodySize             string
	MainServerNamesHashBucketSize string
	MainServerNamesHashMaxSize    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 *NginxAPIController) *Configurator

NewConfigurator creates a new Configurator

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.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

type IngressNginxConfig struct {
	Upstreams []Upstream
	Servers   []Server
}

IngressNginxConfig describes an NGINX configuration

type Location

type Location struct {
	Path                string
	Upstream            Upstream
	ProxyConnectTimeout string
	ProxyReadTimeout    string
	ClientMaxBodySize   string
	Websocket           bool
	Rewrite             string
	SSL                 bool
}

Location describes an NGINX location

type NginxAPIController

type NginxAPIController struct {
	// contains filtered or unexported fields
}

func NewNginxAPIController

func NewNginxAPIController(upstreamConfEndpoint string, statusEndpoint string, local bool) (*NginxAPIController, error)

func (*NginxAPIController) UpdateServers

func (nginx *NginxAPIController) UpdateServers(upstream string, servers []string) error

type NginxClient

type NginxClient struct {
	// contains filtered or unexported fields
}

NginxClient lets you add/remove servers to/from NGINX Plus via its upstream_conf API

func NewNginxClient

func NewNginxClient(upstreamConfEndpoint string, statusEndpoint string) (*NginxClient, error)

NewNginxClient creates an NginxClient.

func (*NginxClient) AddHTTPServer

func (client *NginxClient) AddHTTPServer(upstream string, server string) error

AddHTTPServer adds the server to the upstream.

func (*NginxClient) CheckIfUpstreamExists

func (client *NginxClient) CheckIfUpstreamExists(upstream string) error

CheckIfUpstreamExists checks if the upstream exists in NGINX. If the upstream doesn't exist, it returns an error.

func (*NginxClient) DeleteHTTPServer

func (client *NginxClient) DeleteHTTPServer(upstream string, server string) error

DeleteHTTPServer the server from the upstream.

func (*NginxClient) GetHTTPServers

func (client *NginxClient) GetHTTPServers(upstream string) ([]string, error)

GetHTTPServers returns the servers of the upsteam from NGINX.

func (*NginxClient) UpdateHTTPServers

func (client *NginxClient) UpdateHTTPServers(upstream string, servers []string) ([]string, []string, error)

UpdateHTTPServers updates the servers of the upstream. Servers that are in the slice, but don't exist in NGINX will be added to NGINX. Servers that aren't in the slice, but exist in NGINX, will be removed from NGINX.

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) (*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) 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) Reload

func (nginx *NginxController) Reload() error

Reload reloads NGINX

func (*NginxController) Start

func (nginx *NginxController) Start()

Start starts NGINX

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
}

NginxMainConfig describe the main NGINX configuration file

type Server

type Server struct {
	Name              string
	StatusZone        string
	Locations         []Location
	SSL               bool
	SSLCertificate    string
	SSLCertificateKey string
}

Server describes an NGINX server

type Upstream

type Upstream struct {
	Name            string
	UpstreamServers []UpstreamServer
	StickyCookie    string
}

Upstream describes an NGINX upstream

type UpstreamServer

type UpstreamServer struct {
	Address string
	Port    string
}

UpstreamServer describes a server in an NGINX upstream

Jump to

Keyboard shortcuts

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