site

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 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

This section is empty.

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
}

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) 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