application

package
v0.8.7 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 application owns DeploymentService, the single entry point that orchestrates a Deployment's reconciliation: build a DeploymentIntent from resolved inputs (pkg/intent/deployment.IntentBuilder), execute it across the Imperative/GitOps axis (pkg/apis/deployment/reconcile.ReconciliationExecutor), then persist the outcome as CR status and conditions (StatusWriter). Teardown mirrors the same Build-then-dispatch shape for deletion, minus the status write.

This mirrors every other CR's application layer. mapper.go's Mapper / MapResolvedToDomain is not part of that flow — DeploymentService goes straight from ResolvedDeployment through IntentBuilder, never through this Mapper's domain.DeploymentSpec — it predates the Intent layer and has no callers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeploymentService

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

DeploymentService is the single entry point that orchestrates a Deployment's reconciliation: build a DeploymentIntent, execute it, then persist the outcome as CR status and conditions.

func NewDeploymentService

func NewDeploymentService(
	intentBuilder *intent.IntentBuilder,
	status *StatusWriter,
	reconciliationExecutor *reconcile.ReconciliationExecutor,
	log logr.Logger) *DeploymentService

NewDeploymentService constructs a DeploymentService from its collaborators.

func (*DeploymentService) Reconcile

Reconcile builds a DeploymentIntent from resolved, executes it via the reconciliation executor, and writes the resulting status onto the CR.

A failed execution is both recorded on the CR and returned. Returning only the result of the status write would tell the caller a deployment that could not be applied had succeeded.

func (*DeploymentService) Teardown

Teardown removes what Reconcile applied for the Deployment.

It needs the resolved Deployment only. What was applied for each ServiceUnit is named after it, and the names are in the Deployment's contract, so teardown does not depend on the ServiceUnits still existing or resolving. The serviceUnits argument is kept for callers written against the earlier signature and is not used.

type Mapper

type Mapper struct{}

Mapper converts a fully resolved Deployment into a pure domain DeploymentSpec. Predates the Intent layer and has no callers — DeploymentService goes straight from ResolvedDeployment through IntentBuilder instead.

func NewMapper

func NewMapper() *Mapper

NewMapper constructs a Mapper.

func (Mapper) MapResolvedToDomain

MapResolvedToDomain converts a fully resolved deployment into a pure domain DeploymentSpec.

CONTRACT: - Resolver guarantees presence of mandatory fields - Nil values indicate a resolver bug and MUST crash loudly - Optional fields must be preserved verbatim - Mapper must not invent defaults or hide intent

type StatusWriter

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

StatusWriter merges a Deployment's reconciliation outcome onto the CR's status subresource as contract status and conditions.

func NewStatusWriter

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

NewStatusWriter constructs a StatusWriter.

func (*StatusWriter) WriteDeploymentResult

func (w *StatusWriter) WriteDeploymentResult(
	ctx context.Context,
	depl *env1alpha1.Deployment,
	result *domain.DeploymentResult,
	runErr error,
) error

WriteDeploymentResult merges contract status and conditions onto the Deployment CR and persists. Uses RetryOnConflict + re-fetch on each attempt — concurrent writers may bump resourceVersion between the reconciler's initial fetch and this write. Re-fetching guarantees we always write to the latest version. Contract and conditions are re-applied on every retry.

Jump to

Keyboard shortcuts

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