controller

package
v1.0.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2021 License: Apache-2.0 Imports: 69 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	APIServerHost string
	RootCAFile    string

	KubeConfigFile string

	Client clientset.Interface

	ResyncPeriod time.Duration

	ConfigMapName  string
	DefaultService string

	Namespace string

	// +optional
	TCPConfigMapName string
	// +optional
	UDPConfigMapName string

	DefaultSSLCertificate string

	// +optional
	PublishService       string
	PublishStatusAddress string

	UpdateStatus           bool
	UseNodeInternalIP      bool
	ElectionID             string
	UpdateStatusOnShutdown bool

	ListenPorts *ngx_config.ListenPorts

	EnableSSLPassthrough bool

	EnableProfiling bool

	EnableMetrics  bool
	MetricsPerHost bool

	FakeCertificate *ingress.SSLCert

	SyncRateLimit float32

	DisableCatchAll bool

	ValidationWebhook         string
	ValidationWebhookCertPath string
	ValidationWebhookKeyPath  string

	GlobalExternalAuth  *ngx_config.GlobalExternalAuth
	MaxmindEditionFiles []string

	MonitorMaxBatchSize int

	ShutdownGracePeriod int
}

Configuration contains all the settings required by an Ingress controller

type NGINXController

type NGINXController struct {
	Proxy *TCPProxy
	// contains filtered or unexported fields
}

NGINXController describes a NGINX Ingress controller.

func NewNGINXController

func NewNGINXController(config *Configuration, mc metric.Collector) *NGINXController

NewNGINXController creates a new NGINX Ingress controller.

func (*NGINXController) Check

func (n *NGINXController) Check(_ *http.Request) error

Check returns if the nginx healthz endpoint is returning ok (status code 200)

func (*NGINXController) CheckIngress

func (n *NGINXController) CheckIngress(ing *networking.Ingress) error

CheckIngress returns an error in case the provided ingress, when added to the current configuration, generates an invalid configuration

func (NGINXController) DefaultEndpoint

func (n NGINXController) DefaultEndpoint() ingress.Endpoint

DefaultEndpoint returns the default endpoint to be use as default server that returns 404.

func (NGINXController) GetPublishService

func (n NGINXController) GetPublishService() *apiv1.Service

GetPublishService returns the Service used to set the load-balancer status of Ingresses.

func (*NGINXController) IsDynamicConfigurationEnough

func (n *NGINXController) IsDynamicConfigurationEnough(pcfg *ingress.Configuration) bool

IsDynamicConfigurationEnough returns whether a Configuration can be dynamically applied, without reloading the backend.

func (NGINXController) Name

func (n NGINXController) Name() string

Name returns the healthcheck name

func (*NGINXController) OnUpdate

func (n *NGINXController) OnUpdate(ingressCfg ingress.Configuration) error

OnUpdate is called by the synchronization loop whenever configuration changes were detected. The received backend Configuration is merged with the configuration ConfigMap before generating the final configuration file. Returns nil in case the backend was successfully reloaded.

func (*NGINXController) Start

func (n *NGINXController) Start()

Start starts a new NGINX master process running in the foreground.

func (*NGINXController) Stop

func (n *NGINXController) Stop() error

Stop gracefully stops the NGINX master process.

type NginxCommand

type NginxCommand struct {
	Binary string
}

NginxCommand stores context around a given nginx executable path

func NewNginxCommand

func NewNginxCommand() NginxCommand

NewNginxCommand returns a new NginxCommand from which path has been detected from environment variable NGINX_BINARY or default

func (NginxCommand) ExecCommand

func (nc NginxCommand) ExecCommand(args ...string) *exec.Cmd

ExecCommand instanciates an exec.Cmd object to call nginx program

func (NginxCommand) Test

func (nc NginxCommand) Test(cfg string) ([]byte, error)

Test checks if config file is a syntax valid nginx configuration

type NginxExecTester

type NginxExecTester interface {
	ExecCommand(args ...string) *exec.Cmd
	Test(cfg string) ([]byte, error)
}

NginxExecTester defines the interface to execute command like reload or test configuration

type TCPProxy

type TCPProxy struct {
	ServerList []*TCPServer
	Default    *TCPServer
}

TCPProxy describes the passthrough servers and a default as catch all.

func (*TCPProxy) Get

func (p *TCPProxy) Get(host string) *TCPServer

Get returns the TCPServer to use for a given host.

func (*TCPProxy) Handle

func (p *TCPProxy) Handle(conn net.Conn)

Handle reads enough information from the connection to extract the hostname and open a connection to the passthrough server.

type TCPServer

type TCPServer struct {
	Hostname      string
	IP            string
	Port          int
	ProxyProtocol bool
}

TCPServer describes a server that works in passthrough mode.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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