application

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackendSelector

type BackendSelector struct {
	Kapp packageapi.Provider
}

BackendSelector is intentionally boring. Packages are ALWAYS executed via kapp. No strategy selection is allowed.

func NewBackendSelector

func NewBackendSelector(
	kapp packageapi.Provider,
) *BackendSelector

NewBackendSelector constructs a fixed kapp executor.

func (*BackendSelector) ForIntent

func (b *BackendSelector) ForIntent(
	_ *intent.PackageIntent,
) (packageapi.Provider, error)

ForIntent always returns kapp. Intent does NOT influence execution backend. It returns an error when no kapp provider was configured.

type Mapper

type Mapper struct{}

Mapper converts a fully resolved Package into a pure domain PackageSpec.

func NewMapper

func NewMapper() *Mapper

NewMapper constructs a Mapper.

func (Mapper) MapResolvedToDomain

func (Mapper) MapResolvedToDomain(rp *pkgResolution.ResolvedPackage) (*domain.PackageSpec, error)

MapResolvedToDomain converts a fully resolved Package into a pure domain Package.

CONTRACT:

  • Resolver guarantees presence of mandatory fields
  • A missing one indicates a resolver bug and is returned as a domain.InvalidSpecError — never a panic, which would crash the controller
  • Optional fields must be preserved verbatim
  • Mapper must not invent defaults or hide intent

type PackageService

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

PackageService orchestrates a Package's reconciliation: select a backend, execute the intent, and write the resulting status.

func NewPackageService

func NewPackageService(
	mapper *Mapper,
	backend *BackendSelector,
	status *StatusWriter,
) *PackageService

NewPackageService constructs a PackageService from its collaborators.

func (*PackageService) Reconcile

func (s *PackageService) Reconcile(
	ctx context.Context,
	resolved *pkgResolution.ResolvedPackage,
	intent *pkgintent.PackageIntent,
) error

Reconcile executes a PackageIntent and writes authoritative status.

func (*PackageService) Teardown

func (s *PackageService) Teardown(ctx context.Context, id domain.PackageID) error

Teardown reverses Reconcile: it removes what the provider created for the Package. It needs only the Package's identity, so a Package whose contract does not resolve can still be deleted. It returns domain.ErrTeardownInProgress until what was created is gone; the caller keeps the Package's prerequisites until it returns nil.

type StatusWriter

type StatusWriter struct {
	Client client.Client
	Log    logr.Logger
}

StatusWriter writes a PackageResult back onto a Package CR's status as the authoritative, user-facing PackageStatus.

func NewStatusWriter

func NewStatusWriter(
	c client.Client,
	log logr.Logger,
) *StatusWriter

NewStatusWriter constructs a StatusWriter.

func (*StatusWriter) Write

func (w *StatusWriter) Write(
	ctx context.Context,
	pkg *env1alpha1.Package,
	result *domain.PackageResult,
	runErr error,
) error

Write derives PackageStatus from result/runErr and persists it on the Package's status subresource.

The Package is re-fetched and the write retried on conflict, so status written by another reconciler since pkg was read is not overwritten.

Jump to

Keyboard shortcuts

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