runtime

package
v1.2.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreatePlusClient added in v1.2.0

func CreatePlusClient() (*client.NginxClient, error)

CreatePlusClient returns a client for communicating with the NGINX Plus API.

func EnsureNginxRunning

func EnsureNginxRunning(ctx context.Context) error

EnsureNginxRunning ensures NGINX is running by locating the main process.

func GetSocketClient added in v1.2.0

func GetSocketClient(sockPath string) http.Client

GetSocketClient gets an http.Client with a unix socket transport.

Types

type Manager

type Manager interface {
	// Reload reloads NGINX configuration. It is a blocking operation.
	Reload(ctx context.Context, configVersion int) error
	// IsPlus returns whether or not we are running NGINX plus.
	IsPlus() bool
	// UpdateHTTPServers uses the NGINX Plus API to update HTTP servers.
	// Only usable if running NGINX Plus.
	UpdateHTTPServers(string, []ngxclient.UpstreamServer) error
	// GetUpstreams uses the NGINX Plus API to get the upstreams.
	// Only usable if running NGINX Plus.
	GetUpstreams() (ngxclient.Upstreams, error)
}

Manager manages the runtime of NGINX.

type ManagerImpl

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

ManagerImpl implements Manager.

func NewManagerImpl

func NewManagerImpl(
	ngxPlusClient *ngxclient.NginxClient,
	collector MetricsCollector,
	logger logr.Logger,
) *ManagerImpl

NewManagerImpl creates a new ManagerImpl.

func (*ManagerImpl) GetUpstreams added in v1.2.0

func (m *ManagerImpl) GetUpstreams() (ngxclient.Upstreams, error)

GetUpstreams uses the NGINX Plus API to get the upstreams. Only usable if running NGINX Plus.

func (*ManagerImpl) IsPlus added in v1.2.0

func (m *ManagerImpl) IsPlus() bool

IsPlus returns whether or not we are running NGINX plus.

func (*ManagerImpl) Reload

func (m *ManagerImpl) Reload(ctx context.Context, configVersion int) error

func (*ManagerImpl) UpdateHTTPServers added in v1.2.0

func (m *ManagerImpl) UpdateHTTPServers(upstream string, servers []ngxclient.UpstreamServer) error

UpdateHTTPServers uses the NGINX Plus API to update HTTP upstream servers. Only usable if running NGINX Plus.

type MetricsCollector

type MetricsCollector interface {
	IncReloadCount()
	IncReloadErrors()
	ObserveLastReloadTime(ms time.Duration)
}

MetricsCollector is an interface for the metrics of the NGINX runtime manager.

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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