ingress

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package ingress reconciles the local Caddy ingress to match desired state.

The agent is the only thing that talks to Caddy: it pushes the full runtime config (per-Egg routes and the on-demand TLS policy) through Caddy's admin API, and it serves the "ask" endpoint that Caddy calls before issuing a certificate for any hostname. The ask endpoint says yes only for hostnames currently in the desired state, so a certificate is never minted for a domain that is not ours to serve. Nothing configures Caddy by rewriting files and nothing reaches in from the control plane; this mirrors the pull-based model of the rest of the agent.

Locally Caddy uses its INTERNAL CA (its own issuer), so certificates are real TLS but need no Let's Encrypt, which cannot issue for these test hostnames.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Reconciler

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

Reconciler owns the connection to Caddy's admin API and the ask allow-list.

func New

func New(adminURL, upstreamHost, askEndpoint string, localTLS bool, log *slog.Logger) *Reconciler

New builds a Reconciler. adminURL is the Caddy admin API base; upstreamHost is how Caddy dials Egg containers; askEndpoint is the URL (reachable from Caddy) of this agent's ask handler; localTLS selects the internal CA for local dev instead of Let's Encrypt.

func (*Reconciler) Allowed

func (r *Reconciler) Allowed(host string) bool

Allowed reports whether a hostname is currently permitted a certificate.

func (*Reconciler) AskHandler

func (r *Reconciler) AskHandler() http.HandlerFunc

AskHandler answers Caddy's on-demand TLS ask: 200 for an allowed hostname, 403 otherwise. Caddy passes the hostname as ?domain=.

func (*Reconciler) Reconcile

func (r *Reconciler) Reconcile(ctx context.Context, routes []Route) error

Reconcile pushes the config for the given routes to Caddy if it has changed, and updates the ask allow-list. A no-change reconcile is a cheap hash compare.

type Route

type Route struct {
	Hostnames    []string
	UpstreamPort int
}

Route is one Egg's ingress: the hostnames it serves and the host port its container is published on. The upstream host (how Caddy reaches that port) is configured on the Reconciler.

Jump to

Keyboard shortcuts

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