ingress

package
v1.0.38 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package ingress derives a host's ingress routes from the store and pushes them to an operator-managed Caddy instance via the admin API. Nothing in this package talks to podman directly.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateDomains

func ValidateDomains(domains []string) error

ValidateDomains checks that each domain is a syntactically valid lowercase FQDN and that the slice has no intra-slice duplicates. A nil/empty slice is valid (a non-web instance). Host-wide uniqueness across instances is enforced later, at route derivation.

Types

type CaddyController

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

CaddyController is the production Controller. It drives routes on an operator-managed Caddy instance via the admin API.

func NewCaddyController

func NewCaddyController(st Store, cfg Config) *CaddyController

NewCaddyController builds a controller. st serves both spec storage and template lookups, so ingress declarations are always read fresh from the store (no stale boot-time template snapshot). Caddy itself is managed by the operator; podman-api only manages its own route namespace via the admin API.

func (*CaddyController) Reconcile

func (c *CaddyController) Reconcile(ctx context.Context, host string) error

Reconcile makes host's Caddy proxy match the store-derived routes. It is serialized per host and safe to call repeatedly.

type Config

type Config struct {
	// AdminAddr is the Caddy admin API address (host:port) used when no
	// per-host override is set. Default "localhost:2019".
	AdminAddr string
	// HostAdmins maps hostID to a per-host Caddy admin API address. Takes
	// precedence over AdminAddr when set for the host being reconciled.
	HostAdmins map[string]string
}

Config holds the operator-set knobs for the Caddy controller.

type Controller

type Controller interface {
	// Reconcile makes the host's Caddy proxy match the routes derived from the
	// store: derives routes and pushes JSON routes via the Caddy admin API.
	// Safe to call repeatedly; serialized per host.
	Reconcile(ctx context.Context, host string) error
}

Controller reconciles a host's ingress (Caddy) state with the store.

type Disabled

type Disabled struct{}

Disabled is the no-op Controller used when ingress is turned off. Reconcile does nothing so the rest of the system can call it unconditionally.

func (Disabled) Reconcile

func (Disabled) Reconcile(context.Context, string) error

type Route

type Route struct {
	Domain  string
	Backend string
}

Route maps a public domain to the backend address the host's Caddy reverse-proxies to. Backend is resolved on the shared ingress network (e.g. "web-app1:8080").

type Store

type Store interface {
	store.Store
	GetTemplate(ctx context.Context, id string) (store.Template, error)
}

Store is the controller's view of the durable state.

Jump to

Keyboard shortcuts

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