nginx

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReloadForEndpointsUpdate = true  // ReloadForEndpointsUpdate means that is caused by an endpoints update.
	ReloadForOtherUpdate     = false // ReloadForOtherUpdate means that a reload is caused by an update for a resource(s) other than endpoints.
	TLSSecretFileMode        = 0600  // TLSSecretFileMode defines the default filemode for files with TLS Secrets.
	JWKSecretFileMode        = 0644  // JWKSecretFileMode defines the default filemode for files with JWK Secrets.

)

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeManager added in v1.5.0

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

FakeManager provides a fake implementation of the Manager interface.

func NewFakeManager added in v1.5.0

func NewFakeManager(confPath string) *FakeManager

NewFakeManager creates a FakeMananger.

func (*FakeManager) AppProtectAgentQuit added in v1.8.0

func (*FakeManager) AppProtectAgentQuit()

AppProtectAgentQuit is a fake implementtion AppProtectAgentQuit

func (*FakeManager) AppProtectAgentStart added in v1.8.0

func (*FakeManager) AppProtectAgentStart(apaDone chan error, debug bool)

AppProtectAgentStart is a fake implementation of AppProtectAgentStart

func (*FakeManager) AppProtectPluginQuit added in v1.8.0

func (*FakeManager) AppProtectPluginQuit()

AppProtectPluginQuit is a fake implementtion AppProtectPluginQuit

func (*FakeManager) AppProtectPluginStart added in v1.8.0

func (*FakeManager) AppProtectPluginStart(appDone chan error)

AppProtectPluginStart is a fake implementtion AppProtectPluginStart

func (*FakeManager) ClearAppProtectFolder added in v1.10.0

func (*FakeManager) ClearAppProtectFolder(name string)

ClearAppProtectFolder provides a fake implementation of ClearAppProtectFolder

func (*FakeManager) CreateAppProtectResourceFile added in v1.8.0

func (*FakeManager) CreateAppProtectResourceFile(name string, content []byte)

CreateAppProtectResourceFile provides a fake implementation of CreateAppProtectResourceFile

func (*FakeManager) CreateConfig added in v1.5.0

func (*FakeManager) CreateConfig(name string, content []byte)

CreateConfig provides a fake implementation of CreateConfig.

func (*FakeManager) CreateDHParam added in v1.5.0

func (fm *FakeManager) CreateDHParam(content string) (string, error)

CreateDHParam provides a fake implementation of CreateDHParam.

func (*FakeManager) CreateMainConfig added in v1.5.0

func (*FakeManager) CreateMainConfig(content []byte)

CreateMainConfig provides a fake implementation of CreateMainConfig.

func (*FakeManager) CreateOpenTracingTracerConfig added in v1.6.0

func (*FakeManager) CreateOpenTracingTracerConfig(content string) error

CreateOpenTracingTracerConfig creates a fake implementation of CreateOpenTracingTracerConfig.

func (*FakeManager) CreateSecret added in v1.5.0

func (fm *FakeManager) CreateSecret(name string, content []byte, mode os.FileMode) string

CreateSecret provides a fake implementation of CreateSecret.

func (*FakeManager) CreateStreamConfig added in v1.7.0

func (*FakeManager) CreateStreamConfig(name string, content []byte)

CreateStreamConfig provides a fake implementation of CreateStreamConfig.

func (*FakeManager) CreateTLSPassthroughHostsConfig added in v1.7.0

func (*FakeManager) CreateTLSPassthroughHostsConfig(content []byte)

CreateTLSPassthroughHostsConfig provides a fake implementation of CreateTLSPassthroughHostsConfig.

func (*FakeManager) DeleteAppProtectResourceFile added in v1.8.0

func (*FakeManager) DeleteAppProtectResourceFile(name string)

DeleteAppProtectResourceFile provides a fake implementation of DeleteAppProtectResourceFile

func (*FakeManager) DeleteConfig added in v1.5.0

func (*FakeManager) DeleteConfig(name string)

DeleteConfig provides a fake implementation of DeleteConfig.

func (*FakeManager) DeleteSecret added in v1.5.0

func (*FakeManager) DeleteSecret(name string)

DeleteSecret provides a fake implementation of DeleteSecret.

func (*FakeManager) DeleteStreamConfig added in v1.7.0

func (*FakeManager) DeleteStreamConfig(name string)

DeleteStreamConfig provides a fake implementation of DeleteStreamConfig.

func (*FakeManager) GetFilenameForSecret added in v1.5.0

func (fm *FakeManager) GetFilenameForSecret(name string) string

GetFilenameForSecret provides a fake implementation of GetFilenameForSecret.

func (*FakeManager) Quit added in v1.5.0

func (*FakeManager) Quit()

Quit provides a fake implementation of Quit.

func (*FakeManager) Reload added in v1.5.0

func (*FakeManager) Reload(isEndpointsUpdate bool) error

Reload provides a fake implementation of Reload.

func (*FakeManager) SetOpenTracing added in v1.6.0

func (*FakeManager) SetOpenTracing(openTracing bool)

SetOpenTracing creates a fake implementation of SetOpenTracing.

func (*FakeManager) SetPlusClients added in v1.5.0

func (*FakeManager) SetPlusClients(plusClient *client.NginxClient, plusConfigVersionCheckClient *http.Client)

SetPlusClients provides a fake implementation of SetPlusClients.

func (*FakeManager) Start added in v1.5.0

func (*FakeManager) Start(done chan error)

Start provides a fake implementation of Start.

func (*FakeManager) UpdateConfigVersionFile added in v1.5.0

func (*FakeManager) UpdateConfigVersionFile(openTracing bool)

UpdateConfigVersionFile provides a fake implementation of UpdateConfigVersionFile.

func (*FakeManager) UpdateServersInPlus added in v1.5.0

func (*FakeManager) UpdateServersInPlus(upstream string, servers []string, config ServerConfig) error

UpdateServersInPlus provides a fake implementation of UpdateServersInPlus.

func (*FakeManager) UpdateStreamServersInPlus added in v1.7.0

func (*FakeManager) UpdateStreamServersInPlus(upstream string, servers []string) error

UpdateStreamServersInPlus provides a fake implementation of UpdateStreamServersInPlus.

type LocalManager added in v1.5.0

type LocalManager struct {
	OpenTracing bool
	// contains filtered or unexported fields
}

LocalManager updates NGINX configuration, starts, reloads and quits NGINX, updates NGINX Plus upstream servers. It assumes that NGINX is running in the same container.

func NewLocalManager added in v1.5.0

func NewLocalManager(confPath string, binaryFilename string, mc collectors.ManagerCollector, timeout time.Duration) *LocalManager

NewLocalManager creates a LocalManager.

func (*LocalManager) AppProtectAgentQuit added in v1.8.0

func (lm *LocalManager) AppProtectAgentQuit()

AppProtectAgentQuit gracefully ends AppProtect Agent.

func (*LocalManager) AppProtectAgentStart added in v1.8.0

func (lm *LocalManager) AppProtectAgentStart(apaDone chan error, debug bool)

AppProtectAgentStart starts the AppProtect agent

func (*LocalManager) AppProtectPluginQuit added in v1.8.0

func (lm *LocalManager) AppProtectPluginQuit()

AppProtectPluginQuit gracefully ends AppProtect Agent.

func (*LocalManager) AppProtectPluginStart added in v1.8.0

func (lm *LocalManager) AppProtectPluginStart(appDone chan error)

AppProtectPluginStart starts the AppProtect plugin.

func (*LocalManager) ClearAppProtectFolder added in v1.10.0

func (lm *LocalManager) ClearAppProtectFolder(name string)

ClearAppProtectFolder clears contents of a config folder

func (*LocalManager) CreateAppProtectResourceFile added in v1.8.0

func (lm *LocalManager) CreateAppProtectResourceFile(name string, content []byte)

CreateAppProtectResourceFile writes contents of An App Protect resource to a file

func (*LocalManager) CreateConfig added in v1.5.0

func (lm *LocalManager) CreateConfig(name string, content []byte)

CreateConfig creates a configuration file. If the file already exists, it will be overridden.

func (*LocalManager) CreateDHParam added in v1.5.0

func (lm *LocalManager) CreateDHParam(content string) (string, error)

CreateDHParam creates the servers dhparam.pem file. If the file already exists, it will be overridden.

func (*LocalManager) CreateMainConfig added in v1.5.0

func (lm *LocalManager) CreateMainConfig(content []byte)

CreateMainConfig creates the main NGINX configuration file. If the file already exists, it will be overridden.

func (*LocalManager) CreateOpenTracingTracerConfig added in v1.6.0

func (lm *LocalManager) CreateOpenTracingTracerConfig(content string) error

CreateOpenTracingTracerConfig creates a json configuration file for the OpenTracing tracer with the content of the string.

func (*LocalManager) CreateSecret added in v1.5.0

func (lm *LocalManager) CreateSecret(name string, content []byte, mode os.FileMode) string

CreateSecret creates a secret file with the specified name, content and mode. If the file already exists, it will be overridden.

func (*LocalManager) CreateStreamConfig added in v1.7.0

func (lm *LocalManager) CreateStreamConfig(name string, content []byte)

CreateStreamConfig creates a configuration file for stream module. If the file already exists, it will be overridden.

func (*LocalManager) CreateTLSPassthroughHostsConfig added in v1.7.0

func (lm *LocalManager) CreateTLSPassthroughHostsConfig(content []byte)

CreateTLSPassthroughHostsConfig creates a configuration file with mapping between TLS Passthrough hosts and the corresponding unix sockets. If the file already exists, it will be overridden.

func (*LocalManager) DeleteAppProtectResourceFile added in v1.8.0

func (lm *LocalManager) DeleteAppProtectResourceFile(name string)

DeleteAppProtectResourceFile removes an App Protect resource file from storage

func (*LocalManager) DeleteConfig added in v1.5.0

func (lm *LocalManager) DeleteConfig(name string)

DeleteConfig deletes the configuration file from the conf.d folder.

func (*LocalManager) DeleteSecret added in v1.5.0

func (lm *LocalManager) DeleteSecret(name string)

DeleteSecret the file with the secret.

func (*LocalManager) DeleteStreamConfig added in v1.7.0

func (lm *LocalManager) DeleteStreamConfig(name string)

DeleteStreamConfig deletes the configuration file from the stream-conf.d folder.

func (*LocalManager) GetFilenameForSecret added in v1.5.0

func (lm *LocalManager) GetFilenameForSecret(name string) string

GetFilenameForSecret constructs the filename for the secret.

func (*LocalManager) Quit added in v1.5.0

func (lm *LocalManager) Quit()

Quit shutdowns NGINX gracefully.

func (*LocalManager) Reload added in v1.5.0

func (lm *LocalManager) Reload(isEndpointsUpdate bool) error

Reload reloads NGINX.

func (*LocalManager) SetOpenTracing added in v1.6.0

func (lm *LocalManager) SetOpenTracing(openTracing bool)

SetOpenTracing sets the value of OpenTracing for the Manager

func (*LocalManager) SetPlusClients added in v1.5.0

func (lm *LocalManager) SetPlusClients(plusClient *client.NginxClient, plusConfigVersionCheckClient *http.Client)

SetPlusClients sets the necessary clients to work with NGINX Plus API. If not set, invoking the UpdateServersInPlus will fail.

func (*LocalManager) Start added in v1.5.0

func (lm *LocalManager) Start(done chan error)

Start starts NGINX.

func (*LocalManager) UpdateConfigVersionFile added in v1.5.0

func (lm *LocalManager) UpdateConfigVersionFile(openTracing bool)

UpdateConfigVersionFile writes the config version file.

func (*LocalManager) UpdateServersInPlus added in v1.5.0

func (lm *LocalManager) UpdateServersInPlus(upstream string, servers []string, config ServerConfig) error

UpdateServersInPlus updates NGINX Plus servers of the given upstream.

func (*LocalManager) UpdateStreamServersInPlus added in v1.7.0

func (lm *LocalManager) UpdateStreamServersInPlus(upstream string, servers []string) error

UpdateStreamServersInPlus updates NGINX Plus stream servers of the given upstream.

type Manager added in v1.5.0

type Manager interface {
	CreateMainConfig(content []byte)
	CreateConfig(name string, content []byte)
	DeleteConfig(name string)
	CreateStreamConfig(name string, content []byte)
	DeleteStreamConfig(name string)
	CreateTLSPassthroughHostsConfig(content []byte)
	CreateSecret(name string, content []byte, mode os.FileMode) string
	DeleteSecret(name string)
	CreateAppProtectResourceFile(name string, content []byte)
	DeleteAppProtectResourceFile(name string)
	ClearAppProtectFolder(name string)
	GetFilenameForSecret(name string) string
	CreateDHParam(content string) (string, error)
	CreateOpenTracingTracerConfig(content string) error
	Start(done chan error)
	Reload(isEndpointsUpdate bool) error
	Quit()
	UpdateConfigVersionFile(openTracing bool)
	SetPlusClients(plusClient *client.NginxClient, plusConfigVersionCheckClient *http.Client)
	UpdateServersInPlus(upstream string, servers []string, config ServerConfig) error
	UpdateStreamServersInPlus(upstream string, servers []string) error
	SetOpenTracing(openTracing bool)
	AppProtectAgentStart(apaDone chan error, debug bool)
	AppProtectAgentQuit()
	AppProtectPluginStart(appDone chan error)
	AppProtectPluginQuit()
}

The Manager interface updates NGINX configuration, starts, reloads and quits NGINX, updates NGINX Plus upstream servers.

type ServerConfig added in v1.5.0

type ServerConfig struct {
	MaxFails    int
	MaxConns    int
	FailTimeout string
	SlowStart   string
}

ServerConfig holds the config data for an upstream server in NGINX Plus.

Jump to

Keyboard shortcuts

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