nginx

package
v0.0.0-...-e7db92f Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: MPL-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const KEYSIZE int = 2048

KEYSIZE : Sets the keysize of the RSA algorithm

Variables

This section is empty.

Functions

func CreateNginxConfig

func CreateNginxConfig(config *config.Config, name string, rules []networkv1.IngressRule, upstream *[]ServicePort)

CreateNginxConfig : Create an NGINX configuration file

This method takes a list of Kubernetes ingress rules and associated service ports then attempts to build an nginx configuration file for your service.

func CreateSSLCertificates

func CreateSSLCertificates(hostname string) error

CreateSSLCertificates : Create self signed certificates for the NGINX server

If real certificates are required, you can safely replace the self signed ones with real certificates sharing the same name.

It is unwise to change the configuration file directly as tiyo will have no knowledge of your changes and will replace the configuration if the pipeline is rebuilt for any reason.

func DeleteNginxConfig

func DeleteNginxConfig(name string)

DeleteNginxConfig : Deletes a file from nginx config directory

Types

type Listener

type Listener struct {

	// The NGINX server port to listen on (Usually 80 or 443)
	Listen int

	// The hostname the server is listening on
	Hostname string

	// The top level domain
	Domain string

	// The Protocol to use (http|https)
	Protocol string

	// A list of location items and relevant upstream endpoints
	Locations []*Location

	// Any return value specified for this listener
	Return *NginxReturn
}

Listener : An Nginx server endpoint to listen for requests on

type Location

type Location struct {

	// The Location path starting from /
	Path string

	// The name of an upstream to proxy against
	Upstream string

	UpstreamSecure string

	// Skip verification check on the backend
	SkipVerify bool

	// Use HTTPS for upstream connection
	SecureUpstream bool
}

Location : An NGINX Location to point at an upstream

type Nginx

type Nginx struct {

	// The Plain HTTP upstream to build
	UpstreamPlain *Upstream

	// The secure HTTPS upstream to build
	UpstreamSecure *Upstream

	// A slice of listener objects to listen against - usually one describing 80 and one for 443
	Listeners []*Listener

	// Flow configuration for tuning
	Config *config.Config
}

Nginx : The structure of an NGINX server endpoint configuration

type NginxReturn

type NginxReturn struct {

	// The code to return to the client (Normally 301/302)
	Code int

	// The address to redirect against
	Address string
}

NginxReturn : Handle an NGINX return statement

type NginxServer

type NginxServer struct {

	// We lock the service to prevent actions interfering with one another
	// only one action at a time
	sync.Mutex

	// A DBUS connection to SystemD - requires root privileges
	Systemd *dbus.Conn
}

NginxServer : This structure is for handling restarts of the nginx systemd service

type ServicePort

type ServicePort struct {

	// The node IP address
	Address string

	// The service node port
	Port int32

	// IsHttp port
	HttpPort bool

	Protocol corev1.Protocol
}

type Upstream

type Upstream struct {

	// The name to assign to the upstream - should be a valid dns identifier
	Name string

	// A list of options to assign to the nginx upstream
	Options []string

	// A list of addresses the upstream will resolve against
	Addresses []string
}

Upstream : structure of an Nginx Upstream server

Jump to

Keyboard shortcuts

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