catalog

package
v0.7.3 Latest Latest
Warning

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

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

Documentation

Overview

Package catalog is the CatalogService reconciler (ADR-0086 as reworked by ADR-0087, F48/F57): the ADR-0019 controller half of the DuckLake/DuckDB/Quack add-on provider. Its engine is NO longer a backing Function — it is deployed by the add-on-provider runtime (internal/provider, ADR-0087): the reconciler resolves the service's bindings (spec.blob → the ADR-0085 per-fn S3 keypair derived over the provider identity; spec.catalog → FUNCD_DUCKLAKE_CATALOG; spec.secrets/spec.config → the Quack token + engine config) into a provider.ProviderSpec and calls provider.Runtime.Converge. It reflects the provider's readiness/address into status and tears the engine down on delete. cgo never touches the daemon — DuckDB runs out-of-process in the curated image.

Index

Constants

View Source
const DuckDBRuntime = "duckdb"

DuckDBRuntime is the curated runtime name whose image the reconciler deploys the engine from (ADR-0086/0087 / ADR-0054 embedded-image set). ImageFor(DuckDBRuntime) → the real DuckDB 1.5.4 + ducklake/httpfs/quack image ref (node-built out-of-band; in-process the engine never reaches Ready, which is expected — the live engine comes up only on the node-gated lane).

Variables

This section is empty.

Functions

This section is empty.

Types

type Reconciler

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

Reconciler is the controller.Reconciler for KindCatalogService (ADR-0086/0087): present ⇒ assemble a provider.ProviderSpec + Converge the engine via the provider-runtime + reflect status; absent (deleted) ⇒ Teardown the engine.

func NewReconciler

func NewReconciler(d ReconcilerDeps) (*Reconciler, error)

NewReconciler builds the CatalogService reconciler. Store + Provider are required.

func (*Reconciler) MapFunction added in v0.6.0

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

MapFunction re-runs the reconcile of every released catalog listener in a changed Function's namespace, so the delete path closes it once the last Function that binds it goes (ADR-0162). It reads only the Manager; with no proxy wired it maps nothing.

func (*Reconciler) Reconcile

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

Reconcile converges one CatalogService (ADR-0086 as reworked by ADR-0087). A present CatalogService is deployed as an add-on provider: the reconciler assembles a provider.ProviderSpec from its bindings (spec.blob → the ADR-0085 per-fn S3 keypair derived over the provider identity; spec.catalog → FUNCD_DUCKLAKE_CATALOG; spec.secrets/spec.config → the Quack token + engine config) and calls the provider-runtime's Converge — NO backing Function is materialized. It reflects the provider's readiness/address into status. A deleted CatalogService (NotFound) tears the engine down via provider.Teardown.

The reconciler writes NO data — DuckDB does, out-of-process, through the F47 S3 surface. In-process the engine never reaches Ready (no real image / no probe answerer), which is expected: the live DuckDB scenarios run on the deferred node-gated lane.

type ReconcilerDeps

type ReconcilerDeps struct {
	Store    store.Store
	Provider provider.Runtime
	Logger   *slog.Logger
	// Derive returns the deterministic per-(kind, ns, name) SigV4 keypair (ADR-0085, ADR-0175), derived
	// over the CatalogService identity (KindCatalogService, ns, cs.Name). nil ⇒ no S3 keypair injected.
	// Same shape the Function reconciler's S3GatewayInjection.Derive carries.
	Derive func(kind v1.Kind, ns, name string) (access, secret string)
	// Secrets resolves spec.secrets → env (the Quack token, ADR-0057). nil ⇒ a service declaring
	// spec.secrets fails closed.
	Secrets SecretResolver
	// DeveloperFor returns the PDP identity the secret reads are authorized as (ADR-0057). Defaulted
	// to the namespace-scoped developer identity when Secrets is set and this is nil.
	DeveloperFor func(ns v1.NamespaceName) auth.Identity
	// S3Endpoint is the sandbox-facing S3 URL injected as AWS_ENDPOINT_URL_S3 (ADR-0085). Empty ⇒
	// the var is unset.
	S3Endpoint string
	// ImageFor maps a curated runtime name → the engine image ref (ADR-0054). nil ⇒ a deterministic
	// fallback "funcd/runtime-<runtime>" is used.
	ImageFor func(runtime string) string
	// Proxy runs the per-CatalogService node-private catalog PEP proxy (ADR-0137, ADR-0162): every pass Listens on
	// the recorded status.proxyPort, the Ready branch Ensures the proxy fronts the engine and publishes ITS url as
	// Status.Endpoint (internal functions inject the proxy, not the engine), a not-Ready pass Suspends it, and a
	// delete Releases it, closing it only once no Function binds the catalog. nil ⇒ no internal PEP proxy (the
	// engine address is published directly, the pre-ADR-0137 posture) — kept nil-safe for the in-memory/unit path.
	Proxy *cataloggw.Manager
	// Routes contributes this catalog's OPT-IN external ingress entry (source "catalog/<ns>/<name>")
	// to the shared edge-router aggregator (ADR-0138). When spec.ingress is set and the catalog is
	// Ready, the reconciler programs an edge entry whose Upstream is the PEP PROXY (never the engine);
	// cleared on not-Ready / delete. nil ⇒ no external exposure (the in-memory/dev path).
	Routes router.EntrySetter

	// SupervisionPeriod is the requeue of a Ready CatalogService (ADR-0142); 0 ⇒ controller.SupervisionPeriod.
	SupervisionPeriod time.Duration
	// ReferentPollInterval re-checks a service waiting for a Bucket or a binding (controller.referentPollInterval,
	// ADR-0163); EnginePollInterval re-checks an engine not answering its probe yet (catalog.enginePollInterval),
	// bounded by SupervisionPeriod. 0 ⇒ 2s.
	ReferentPollInterval time.Duration
	EnginePollInterval   time.Duration
}

ReconcilerDeps configures the KindCatalogService reconciler (ADR-0086/0087). Store + Provider are required; the rest tune the engine env (the bindings the ADR injects). When Derive/Secrets are nil the corresponding env is simply absent (in-memory/dev) — the engine still deploys but can't reach S3 / authenticate (it never reaches Ready in-process anyway).

type SecretResolver

type SecretResolver interface {
	ResolveEnv(ctx context.Context, id auth.Identity, ns v1.NamespaceName, names []string) (map[string]string, error)
}

SecretResolver resolves a service's bound Secret names → an env-var map for engine injection, PDP-authorized for id (ADR-0022/0057). The reconciler depends on this local seam (ADR-0002 import discipline) — satisfied by *secrets.Resolver, wired in pkg/funcd. A nil resolver disables secret injection: a CatalogService that declares spec.secrets then fails closed (not Ready).

Jump to

Keyboard shortcuts

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