site

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package site reconciles the Site resource (ADR-0139, F103): it resolves the site bundle's digest once per spec generation, materializes the bundle under a digest-scoped Bucket prefix (index written last, so its presence means complete), materializes the owned Bucket + Route, and publishes a status DERIVED from the owned Route — the durable record of what is served. A failed deploy leaves the previous digest serving.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MapRoute added in v0.2.2

func MapRoute(_ context.Context, obj v1.Object) []controller.Request

MapRoute is the controller.MapFunc that re-runs the reconcile of the Site named after a changed Route: the Site's status is derived from that Route (routeOf), and no Site event follows a Route write.

Types

type BucketResolver

type BucketResolver func(ns v1.NamespaceName, bucket string) (blob.Bucket, bool)

BucketResolver resolves a (namespace, bucket) to its per-namespace blob view — the SAME s3BucketFor the S3 frontend and the ADR-0120 static handler use, so one substrate serves all three.

type Deps

type Deps struct {
	Store   store.Store
	Buckets BucketResolver
	// DefaultIndex is the platform config's site.defaultIndex: the document served for "/" (and asserted
	// present) when a Site's spec.index is empty. "" ⇒ "index.html".
	DefaultIndex string
	Logger       *slog.Logger
	// ReferentPollInterval is controller.referentPollInterval (ADR-0163); 0 ⇒ routeRequeue.
	ReferentPollInterval time.Duration
}

Deps are the reconciler's dependencies; Store and Buckets are required.

type Reconciler

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

Reconciler drives a Site to its desired state (controller.Reconciler).

func New

func New(d Deps) *Reconciler

New builds the Site reconciler.

func (*Reconciler) MapBucket added in v0.3.0

func (r *Reconciler) MapBucket(ctx context.Context, obj v1.Object) []controller.Request

MapBucket is the controller.MapFunc that re-runs the reconcile of every Site declaring a changed Bucket: a bundle its maxObjectBytes refused can deploy once the cap is raised, and no Site event follows a Bucket write.

func (*Reconciler) Reconcile

func (r *Reconciler) Reconcile(ctx context.Context, req controller.Request) (controller.Result, error)

Reconcile, in order: (1) reads the owned Route (if present and owned) and takes its bundle rule's prefix as the CURRENT serving digest — the durable record; (2) resolves spec.image → a digest only when status.observedGeneration != metadata.generation, else keeps the serving digest; (3) adopts or creates the Bucket (PrefixOwned if the site prefix is already declared with an owner); (4) if the target digest's index object is absent, unpacks the bundle under <prefix>/<digest-slug>/ over blob.Bucket — every non-index entry first, the index object LAST; an index already present means complete, nothing is re-uploaded; (5) asserts the index, then materializes/updates the owned Route (RouteNotOwned if foreign) with the bundle rule at the target digest; (6) reads the Route's Ready condition — pending (absent or stale ObservedGeneration) ⇒ NotReady RouteNotReady + RequeueAfter 2s; (7) publishes a status DERIVED from the Route, advancing status.observedGeneration only once this generation's digest is the one programmed on the Route. A failure before (5) leaves the Route — hence the PREVIOUS digest — serving, and the generation unobserved so the next reconcile retries.

Jump to

Keyboard shortcuts

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