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 ¶
func (s *DeploymentService) Reconcile( ctx context.Context, resolved *deploymentResolution.ResolvedDeployment, serviceUnits []serviceunitResolution.ResolvedServiceUnit, log logr.Logger, ) error
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 ¶
func (s *DeploymentService) Teardown( ctx context.Context, resolved *deploymentResolution.ResolvedDeployment, _ []serviceunitResolution.ResolvedServiceUnit, log logr.Logger, ) error
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 (Mapper) MapResolvedToDomain ¶
func (Mapper) MapResolvedToDomain( rd *deploymentResolution.ResolvedDeployment, ) domain.DeploymentSpec
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 ¶
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.