plan

package
v0.9.0 Latest Latest
Warning

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

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

Documentation

Overview

Package plan builds a read-only deployment plan from a rendered release and, on upgrade, from live cluster objects.

BuildSemanticPlan returns a deployah.dev/deployah/internal/plan/semantic.Plan. Task assembly records what changed. deployah.dev/deployah/internal/plan/semantic.New decides whether each task will run. Human text and JSON live in plan/view.

LastSuccessfulRelease remains for deploy hostname and workload guards. BuildSemanticPlan does not use it.

Chart rendering is on deployah.dev/deployah/internal/helm.Client. `deployah plan` and `deployah deploy` share it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildSemanticPlan added in v0.9.0

func BuildSemanticPlan(
	ctx context.Context,
	client SemanticBuildClient,
	mapper RESTMapper,
	live LiveReader,
	input SemanticBuildInput,
) (semantic.Plan, *render.RenderResult, func(), error)

BuildSemanticPlan builds a read-only semantic deployment plan from the rendered release and, on upgrade, from live cluster state. An upgrade requires live. A fresh install may pass a nil reader.

Call the returned cleanup once. It is never nil. On error the plan is empty and the render result is nil.

func LastSuccessfulRelease

func LastSuccessfulRelease(ctx context.Context, client historyClient, project, environment string) (release *v1.Release, warning string, err error)

LastSuccessfulRelease walks a release's history, newest revision first, and returns the newest revision whose status is "deployed" or "superseded". Deploy hostname and workload guards use it. BuildSemanticPlan does not. Warning is set when the newest revision itself is not successful, so the caller can surface that alongside the older successful revision.

Types

type DynamicLiveReader added in v0.9.0

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

DynamicLiveReader is a LiveReader backed by a dynamic client. It sends only get and list requests.

func NewDynamicLiveReader added in v0.9.0

func NewDynamicLiveReader(client dynamic.Interface) *DynamicLiveReader

NewDynamicLiveReader returns a reader for client. client must be non-nil before Get or List is called.

func (*DynamicLiveReader) Get added in v0.9.0

func (r *DynamicLiveReader) Get(ctx context.Context, mapping *meta.RESTMapping, namespace, name string) (*unstructured.Unstructured, error)

Get implements LiveReader.

func (*DynamicLiveReader) List added in v0.9.0

func (r *DynamicLiveReader) List(ctx context.Context, mapping *meta.RESTMapping, namespace string, selector labels.Selector) ([]unstructured.Unstructured, error)

List implements LiveReader.

type LiveReader added in v0.9.0

type LiveReader interface {
	// Get returns the named object. A missing object is a NotFound
	// error. namespace applies only when mapping is namespaced.
	Get(ctx context.Context, mapping *meta.RESTMapping, namespace, name string) (*unstructured.Unstructured, error)
	// List returns objects that match selector. namespace applies only
	// when mapping is namespaced. selector must be non-nil.
	List(ctx context.Context, mapping *meta.RESTMapping, namespace string, selector labels.Selector) ([]unstructured.Unstructured, error)
}

LiveReader reads Live objects for Drift. It only gets and lists. It does not write or run a server-side dry-run. Helm still renders Desired with its own client-side dry-run on SemanticBuildClient.

type RESTMapper added in v0.9.0

type RESTMapper interface {
	RESTMapping(gk schema.GroupKind, versions ...string) (*meta.RESTMapping, error)
}

RESTMapper maps a GroupKind and version to a REST mapping. BuildSemanticPlan uses it only to learn scope and whether a resource can be built. It does not read live objects or send writes. Live reads for Drift go through LiveReader. meta.RESTMapper satisfies it.

type SemanticBuildClient added in v0.9.0

type SemanticBuildClient interface {
	RenderManifestsWithPrep(
		ctx context.Context,
		resolved *spec.ResolvedSpec,
		postRenderer postrenderer.PostRenderer,
		crds []extras.RawFile,
	) (*render.RenderResult, helm.ReleasePrep, func(), error)
}

SemanticBuildClient is the render BuildSemanticPlan calls. It returns the render and its prep. A Helm client reads release history there and returns Previous on the prep.

type SemanticBuildInput added in v0.9.0

type SemanticBuildInput struct {
	// ClusterContext is the kubeconfig context name stored on the plan header.
	ClusterContext string
	// Resolved is the environment-resolved spec. It must be non-nil with a spec.
	Resolved *spec.ResolvedSpec
	// PostRenderer, when non-nil, is forwarded once to the render client.
	PostRenderer postrenderer.PostRenderer
	// CRDs are already-loaded source files from .deployah/crds/.
	// They are forwarded to Helm chart materialization only.
	CRDs []extras.RawFile
	// CRDDocs are presentation identity for those files. They are not
	// Helm transport and are not parsed here.
	CRDDocs []extras.CRDDoc
	// SkipCRDs stamps ChartCRD lifecycle as skip on a fresh install. It is
	// ignored on upgrade. It does not set Helm Install.SkipCRDs.
	SkipCRDs bool
}

SemanticBuildInput is the caller-supplied input to BuildSemanticPlan. CRDs must already be loaded; this struct does not read files.

Directories

Path Synopsis
Package semantic is the unredacted model of one deployment plan.
Package semantic is the unredacted model of one deployment plan.
Package view is the serialization and redaction boundary for the semantic Plan domain model.
Package view is the serialization and redaction boundary for the semantic Plan domain model.

Jump to

Keyboard shortcuts

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