build

package
v0.6.4 Latest Latest
Warning

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

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

Documentation

Overview

Package build implements the Build prerequisite mediator.

The mediator owns the cross-cutting prerequisites a Build requires before the application layer may act: the git SSH secret, the registry secret, and the service account. It is invoked by the Build domain during command handling — after resolution, before execution — and again during teardown.

Prerequisite provisioning is gated on the Environment: the Environment CR must pre-exist as the root of the delivery chain, and it is the sole authority for the ClusterSecretStore binding used by every store-dependent secret this mediator reconciles.

Index

Constants

This section is empty.

Variables

View Source
var ErrPrerequisitesPending = errors.New("build prerequisites pending")

ErrPrerequisitesPending reports that a Build's prerequisites have been requested but are not all in place yet. It is not a failure: the Build is looked at again and dispatched once they are.

Functions

This section is empty.

Types

type Mediator

type Mediator struct {
	// Client is the Kubernetes client used for all prerequisite operations.
	Client client.Client
	// Scheme is the runtime scheme used for owner reference wiring.
	Scheme *runtime.Scheme
	// Log is the logger instance for this mediator.
	Log logr.Logger
	// Recorder handles logging of Kubernetes events.
	Recorder events.EventRecorder
	// ServiceAccountReconciler manages the build service account and its
	// secret bindings as a cross-cutting prerequisite.
	ServiceAccountReconciler *serviceaccounts.ServiceAccountReconciler
}

Mediator manages the prerequisite resources a Build depends on.

func New

func New(c client.Client, scheme *runtime.Scheme, log logr.Logger, recorder events.EventRecorder) *Mediator

New returns a new Mediator instance configured with the necessary dependencies.

func (*Mediator) CleanupPrerequisites

func (m *Mediator) CleanupPrerequisites(ctx context.Context, resolved *buildResolution.ResolvedBuild) error

CleanupPrerequisites reverses EnsurePrerequisites — deletes the git SSH secret, registry secret, and service account this mediator provisioned. Called from the domain's CmdDelete branch, gated by the finalizer at the controller level. Teardown runs in reverse provisioning order. All three teardown steps are attempted regardless of individual failures, and errors are aggregated — a stuck registry secret shouldn't block cleanup of the SA or git secret. Any returned error keeps the finalizer in place for retry on next reconcile.

func (*Mediator) EnsurePrerequisites

func (m *Mediator) EnsurePrerequisites(ctx context.Context, resolved *buildResolution.ResolvedBuild) error

EnsurePrerequisites provisions the prerequisites a Build requires before execution: the git SSH secret, the registry secret, and the service account. Called from the domain's CmdCreate/CmdUpdate branch after resolution succeeds. Provisioning is fail-fast — the first failing step returns its error and the domain records BuildPrerequisitesCreateFailed.

Jump to

Keyboard shortcuts

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