nginxcontroller

package
v0.0.0-...-8a215a2 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2025 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CADirURL = lego.LEDirectoryStaging
	// Time until the ingress-daemon will consider the tls certificate to renew.
	// Aka if the time left until the certificate expires is less than this threshold
	TlsRenewThreshold = time.Hour * 24
)
View Source
const (
	NginxConfigPath  = "/etc/nginx/nginx.conf"
	SocketPath       = "/run/zeus/nginx.sock"
	SocketMountPath  = "/run/zeus"
	NginxPidFilePath = "/run/nginx.pid"
)
View Source
const ApplyAPIPath = "/apply"
View Source
const (
	DefaultClientTimeout = 5 * time.Second
)

Variables

This section is empty.

Functions

func CreateContainer

func CreateContainer(state *record.ApplicationRecord) (container *runtime.Container, ok bool)

Creates an Ingress container which will be conntected to the network.

If an error happends the error is written into the state and it returns nil, false. If the container creation succeeds a it returns a container, true.

func HostSocketDirectory

func HostSocketDirectory() string

Returns the directory which is be used to store the socket for IPC between the container and the application.

func ValidateContainer

func ValidateContainer(c *runtime.Container, state *record.ApplicationRecord) bool

Types

type ApplyRequest

type ApplyRequest struct {
	Servers []ServerRequest `json:"servers"`
}

func NewApplyRequest

func NewApplyRequest() *ApplyRequest

func (*ApplyRequest) AddServer

func (self *ApplyRequest) AddServer(opts ...ServerRequestOption)

type CertificateRequest

type CertificateRequest struct {
	PrivkeyPem   string `json:"privkeyPem"`
	FullchainPem string `json:"fullchainPem"`
}

type Client

type Client struct {
	NginxControllerClient
	// contains filtered or unexported fields
}

func NewClient

func NewClient(
	application string,
) *Client

func (*Client) Close

func (self *Client) Close() error

type ConfigBuilder

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

func NewConfigBuilder

func NewConfigBuilder() *ConfigBuilder

type Controller

type Controller struct {
	UnimplementedNginxControllerServer
	// contains filtered or unexported fields
}

func New

func New() (*Controller, error)

func (*Controller) CleanUp

func (self *Controller) CleanUp(
	domain string,
	token string,
	keyAuth string,
) error

func (*Controller) GenerateCertificates

func (self *Controller) GenerateCertificates(
	ctx context.Context,
	req *GenerateCertificateRequest,
) (*GenerateCertificateResponse, error)

func (*Controller) Present

func (self *Controller) Present(
	domain string,
	token string,
	keyAuth string,
) error

func (*Controller) Run

func (self *Controller) Run() error

func (*Controller) SetIngressConfig

func (self *Controller) SetIngressConfig(
	ctx context.Context,
	req *IngressRequest,
) (*IngressResponse, error)

type IngressRequestBuilder

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

func NewIngressRequestBuilder

func NewIngressRequestBuilder() *IngressRequestBuilder

func (*IngressRequestBuilder) AddEventEntries

func (i *IngressRequestBuilder) AddEventEntries(entries ...string)

func (*IngressRequestBuilder) AddGeneralEntries

func (i *IngressRequestBuilder) AddGeneralEntries(entries ...string)

func (*IngressRequestBuilder) AddHttpEntries

func (i *IngressRequestBuilder) AddHttpEntries(entries ...string)

func (*IngressRequestBuilder) AddServer

func (i *IngressRequestBuilder) AddServer(
	domain string,
	ipv6 bool,
	entries ...string,
) *ServerRequestBuilder

func (*IngressRequestBuilder) Build

func (i *IngressRequestBuilder) Build() *IngressRequest

type LocationRequest

type LocationRequest struct {
	Path            string `json:"path"`
	Matching        string `json:"matching"`
	ServiceEndpoint string `json:"serviceEndpoint"`
}

type ServerRequest

type ServerRequest struct {
	Domain      string              `json:"domain"`
	Certificate *CertificateRequest `json:"certificate"`
	Locations   []LocationRequest   `json:"locations"`
	IPv6Enabled bool                `json:"ipv6Enabled"`
}

type ServerRequestBuilder

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

func (*ServerRequestBuilder) AddLocation

func (s *ServerRequestBuilder) AddLocation(
	path string,
	matching Matching,
	entries ...string,
)

func (*ServerRequestBuilder) AddTLS

func (s *ServerRequestBuilder) AddTLS(
	fullchain string,
	privkey string,
)

type ServerRequestOption

type ServerRequestOption func(cfg *ServerRequest)

func WithCertificate

func WithCertificate(
	privkeyPem string,
	fullchainPem string,
) ServerRequestOption

func WithDomain

func WithDomain(domain string) ServerRequestOption

func WithIPv6Enabled

func WithIPv6Enabled(ipv6Enabled bool) ServerRequestOption

func WithLocation

func WithLocation(
	path string,
	matching string,
	serviceEndpoint string,
) ServerRequestOption

type ServerRequestOptions

type ServerRequestOptions struct {
	Options []ServerRequestOption
}

func NewServerRequestOptions

func NewServerRequestOptions() *ServerRequestOptions

func (*ServerRequestOptions) Add

func (self *ServerRequestOptions) Add(opt ...ServerRequestOption)

Jump to

Keyboard shortcuts

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