Documentation
¶
Overview ¶
Package ingress decides which Traefik replicas serve each project's public traffic (D22, Phase 23): by default the controller and edge pools, or the nodes a project chose as its load balancers. When a project's ingress changes, the previous one keeps serving each custom domain until that domain's DNS points at the new one.
Index ¶
- Constants
- Variables
- func SwapBase(host, from, to string) string
- type Manager
- func (m *Manager) Addr(node string) string
- func (m *Manager) Assigned() map[string][]string
- func (m *Manager) Base(project, base string) string
- func (m *Manager) Check(ctx context.Context) bool
- func (m *Manager) Current(project string) Target
- func (m *Manager) CutOver(ctx context.Context, projectID string) (store.Project, error)
- func (m *Manager) Domain(project, host string) Target
- func (m *Manager) Expected(ctx context.Context, project string) []string
- func (m *Manager) Load(ctx context.Context) error
- func (m *Manager) Move(project string) *store.IngressMove
- func (m *Manager) Nodes(project string) []string
- func (m *Manager) Pending(ctx context.Context, project string) []string
- func (m *Manager) Ports(project string) Target
- func (m *Manager) Previous(project string) (Target, bool)
- func (m *Manager) PreviousBase(project, base string) (string, bool)
- func (m *Manager) RemoveNode(ctx context.Context, node string) error
- func (m *Manager) RenameNode(ctx context.Context, from, to string) error
- func (m *Manager) Run(ctx context.Context)
- func (m *Manager) Set(ctx context.Context, projectID string, nodes []string) (store.Project, error)
- func (m *Manager) Using(node string) (all, last []string)
- type Target
Constants ¶
const MaxNodes = 16
MaxNodes is the most ingress nodes a project may have.
Variables ¶
var DefaultTarget = Target{Default: true}
DefaultTarget is the controller and edge pools.
var ErrNoChange = errors.New("no change")
ErrNoChange means the project already has this ingress.
Functions ¶
Types ¶
type Manager ¶
type Manager struct {
// ControllerAddr is the controller's public IP (the default ingress).
ControllerAddr func(ctx context.Context) string
// Resolve looks a host up (nil: the system resolver).
Resolve func(ctx context.Context, host string) ([]string, error)
// OnChange runs after any project's ingress changed (routes, replicas
// and firewalls follow).
OnChange func()
// NodeAddrs returns each node's public address by name (nil: their
// WireGuard endpoints).
NodeAddrs func(ctx context.Context) (map[string]string, error)
// CheckPorts refuses a change that would put one of the project's
// public ports on a node where another owner holds the same port
// (Phase 26); ports is who would open them. Nil allows everything.
CheckPorts func(ctx context.Context, project string, ports Target) error
// contains filtered or unexported fields
}
Manager keeps the projects' ingress settings in memory: routes ask for them every time Traefik polls.
func (*Manager) Assigned ¶
Assigned maps each ingress node to the projects it serves (currently, or as the previous ingress of a move).
func (*Manager) Base ¶
Base is the base domain of a project's generated addresses: the cluster's, or the first ingress node's sslip.io name.
func (*Manager) Check ¶
Check moves the custom domains whose DNS has moved, and settles projects with none left. It reports whether anything changed.
func (*Manager) Domain ¶
Domain is who serves one of a project's custom domains: the current ingress, plus the previous one until the domain's DNS has moved.
func (*Manager) Expected ¶
Expected are the addresses a project's custom domains must resolve to: every ingress node's, or the controller's.
func (*Manager) Move ¶
func (m *Manager) Move(project string) *store.IngressMove
Move is a project's ingress change in progress (nil when settled).
func (*Manager) Ports ¶
Ports is who opens a project's public ports: the current ingress, plus the previous one while it moves.
func (*Manager) PreviousBase ¶
PreviousBase is the base the project's generated addresses had before its move (ok = moving).
func (*Manager) RemoveNode ¶
RemoveNode takes a node out of every project's ingress, at once (it is leaving the cluster). A project left with none goes back to the default.
func (*Manager) RenameNode ¶
RenameNode follows a node's new name.
func (*Manager) Run ¶
Run reloads the settings and moves every custom domain whose DNS points at its project's new ingress, every minute.