Documentation
¶
Overview ¶
Package ingress renders ingress configuration and validates domains. The per-host Caddy controller (added later) consumes this package; nothing here talks to podman or the network, so it is pure and unit-testable.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RenderCaddyfile ¶
RenderCaddyfile produces a deterministic Caddyfile for routes. A non-empty acmeEmail sets the global ACME contact. Routes are emitted sorted by domain so identical inputs yield byte-identical output — a stable file means a `caddy reload` is a no-op when nothing actually changed.
func ValidateDomains ¶
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 a per-host Caddy pod over the existing podman socket.
func NewCaddyController ¶
func NewCaddyController(client podman.Client, 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).
type Config ¶
type Config struct {
Network string // shared ingress network name (e.g. "podman-api-ingress")
CaddyImage string // e.g. "docker.io/library/caddy:2"
ACMEEmail string // ACME account email for the global Caddyfile block
}
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: ensures the network + Caddy pod exist, renders the Caddyfile, and
// applies it (zero-downtime reload). 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.
type Route ¶
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. It is the spec store plus template lookups: templates are mutable (created/edited at runtime), so the controller resolves each instance's ingress declaration from the store at reconcile time rather than caching a boot-time snapshot. *store.DB satisfies this; so does *store.Memory.