deployment

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: 7 Imported by: 0

Documentation

Overview

Package deployment owns DeploymentIntent — the Kubernetes-free, fully resolved plan for a Deployment, built once its ResolvedDeployment and ResolvedServiceUnits are known. It carries which runtime and strategy to use, the reconciliation mode, and each ServiceUnit's own pkg/intent/serviceunit.ServiceUnitIntent.

IntentBuilder.Build (intent_builder.go) is the canonical, complete constructor and the one pkg/apis/deployment/application.DeploymentService actually calls. ResolveDeploymentIntent (resolve.go) is an older, partial constructor that never learned Runtime/Strategy/ReconciliationStrategy/ ManifestsRepo — it has no callers in DeploymentService's path and should be treated as superseded rather than a second supported entry point.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrInvalidDeployment

func ErrInvalidDeployment(reason string) error

ErrInvalidDeployment indicates a semantic error in a resolved Deployment. This means the resolver violated an invariant or the contract is invalid.

func ErrServiceUnitNotFound

func ErrServiceUnitNotFound(name string) error

ErrServiceUnitNotFound indicates a Deployment references a ServiceUnit name that has no corresponding resolved ServiceUnit.

Types

type DeploymentIntent

type DeploymentIntent struct {
	Source *environmentv1alpha1.Deployment // ← IMPORTANT

	Name      string
	Namespace string

	Runtime  Runtime
	Strategy Strategy

	ServiceUnits []serviceunitIntent.ServiceUnitIntent

	ReconciliationStrategy ReconciliationStrategy
	ImageAutomation        bool
	ManifestsRepo          *ManifestsRepo

	GitOwner    string
	GeneratedAt time.Time
}

DeploymentIntent is the Kubernetes-free, fully resolved plan for a Deployment: which runtime and strategy to use, the reconciliation mode, and each ServiceUnit's own intent. Built by IntentBuilder.Build.

func ResolveDeploymentIntent

func ResolveDeploymentIntent(
	deploy *deploymentResolution.ResolvedDeployment,
	serviceUnits map[string]*serviceunitResolution.ResolvedServiceUnit,
) (*DeploymentIntent, error)

ResolveDeploymentIntent is an older, partial DeploymentIntent constructor that never learned Runtime/Strategy/ReconciliationStrategy/ManifestsRepo. It has no callers in DeploymentService's path — superseded by IntentBuilder.Build, not a second supported entry point.

type IntentBuilder

type IntentBuilder struct{}

IntentBuilder builds a DeploymentIntent from fully resolved inputs. It is the canonical, complete constructor that DeploymentService calls.

func NewIntentBuilder

func NewIntentBuilder() *IntentBuilder

NewIntentBuilder constructs an IntentBuilder.

func (*IntentBuilder) Build

Build constructs a DeploymentIntent from fully RESOLVED inputs.

CONTRACT: - Inputs are already validated and normalized - No Kubernetes types allowed - No string-to-enum logic allowed - Any invalid state is a resolver bug

func (*IntentBuilder) BuildTeardown

BuildTeardown constructs the DeploymentIntent needed to remove what a Deployment applied. It takes the Deployment alone.

What was applied for each ServiceUnit is named after it, and the names are in the Deployment's own contract. Tearing down must not depend on the ServiceUnits themselves: they may already be gone, or no longer resolve, or name a Build that has no image, and none of that is a reason to leave the workload running and the Deployment undeletable.

type ManifestsRepo

type ManifestsRepo struct {
	// URL to the manifests repository
	URL string

	// Git reference
	Ref Ref

	// Secret used to clone the repository
	CloneSecret string

	// Application strategy (e.g. kustomization, helm, raw)
	Strategy string

	// Path within the repository
	Path string
}

ManifestsRepo is the Git repository a Deployment's manifests are rendered from or applied against.

type ReconciliationStrategy

type ReconciliationStrategy string

ReconciliationStrategy selects how a Deployment's manifests are applied (imperative apply, Kustomize, or Helm).

const (
	ReconciliationImperative ReconciliationStrategy = "Imperative"
	ReconciliationKustomize  ReconciliationStrategy = "Kustomize"
	ReconciliationHelm       ReconciliationStrategy = "Helm"
)

type Ref

type Ref struct {
	Branch string
	Tag    string
	Commit string
}

Ref pins ManifestsRepo to a specific branch, tag, or commit.

type Runtime

type Runtime string

Runtime identifies which execution platform a ServiceUnit deploys to.

const (
	RuntimeKubernetes Runtime = "kubernetes.io/container-runtime"
	RuntimeKnative    Runtime = "knative.dev/service-runtime"
	RuntimeWASM       Runtime = "blanketops.dev/wasm-runtime"
	RuntimeECS        Runtime = "blanketops.dev/aws-ecs"
	RuntimeAzure      Runtime = "blanketops.dev/azure-container"
)

type ServiceUnitPhase

type ServiceUnitPhase string

ServiceUnitPhase is the reconciliation phase of a single ServiceUnit within a Deployment.

const (
	ServiceUnitPending   ServiceUnitPhase = "Pending"
	ServiceUnitResolving ServiceUnitPhase = "Resolving"
	ServiceUnitDeploying ServiceUnitPhase = "Deploying"
	ServiceUnitReady     ServiceUnitPhase = "Ready"
	ServiceUnitFailed    ServiceUnitPhase = "Failed"
)

type ServiceUnitResult

type ServiceUnitResult struct {
	Name string

	Phase   ServiceUnitPhase
	Image   string
	Runtime Runtime

	Message string
	Error   string

	LastTransitionTime time.Time
}

ServiceUnitResult is the observed outcome of reconciling a single ServiceUnit within a Deployment.

type Strategy

type Strategy string

Strategy selects the rollout strategy used when deploying a ServiceUnit.

const (
	StrategyRolling   Strategy = "Rolling"
	StrategyBlueGreen Strategy = "BlueGreen"
	StrategyCanary    Strategy = "Canary"
)

Jump to

Keyboard shortcuts

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