plan

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package plan builds, writes and reads the self-contained build artifact under .nelmwave/. Runtime commands (up/down/diff) read only the plan and never re-render templates, keeping CI deterministic.

Index

Constants

View Source
const (
	// DefaultDir is the build output directory.
	DefaultDir = ".nelmwave"
	// PlanfileName is the plan file inside the build directory.
	PlanfileName = "planfile.yml"
	// ValuesDir holds merged per-release values (populated in a later milestone).
	ValuesDir = "values"
	// StoreDir holds resolved store files. It matches the "stores" datasource
	// namespace, so a path under .nelmwave/ and a `ds "stores/x"` reference read
	// the same way.
	StoreDir = "stores"
	// ChartsDir holds chart archives downloaded by `build --download-charts`.
	// Unlike values and stores it is keyed by chart, not by release: two
	// releases of the same chart share one archive.
	ChartsDir = "charts"
)

Default locations of the build output.

Variables

This section is empty.

Functions

This section is empty.

Types

type Need

type Need struct {
	Uniqname string `yaml:"uniqname"`
	Optional bool   `yaml:"optional,omitempty"`
}

Need is one resolved dependency edge of a plan release: the target uniqname and whether the dependency is optional (droppable when filtered out).

type Plan

type Plan struct {
	Project      string                       `yaml:"project"`
	Repositories map[string]config.Repository `yaml:"repositories,omitempty"`
	Releases     map[string]Release           `yaml:"releases"`
}

Plan is the flat, fully-resolved deployment plan persisted to disk. Repositories and Releases are keyed by identity, mirroring the manifest. yaml.v3 marshals map keys in sorted order, so output is deterministic.

func FromConfig

func FromConfig(cfg *config.Config) *Plan

FromConfig projects a validated Config into a Plan.

func Read

func Read(dir string) (*Plan, error)

Read loads a plan from dir/planfile.yml.

func (*Plan) ReleaseNames

func (p *Plan) ReleaseNames() []string

ReleaseNames returns the release names in deterministic (sorted) order.

func (*Plan) Write

func (p *Plan) Write(dir string) error

Write serializes the plan to dir/planfile.yml, creating dir if needed.

type Release

type Release struct {
	Labels      map[string]string `yaml:"labels,omitempty"`
	Annotations map[string]string `yaml:"annotations,omitempty"`
	Needs       []Need            `yaml:"needs,omitempty"`
	Chart       config.Chart      `yaml:"chart,omitempty"`
	Values      []config.FileRef  `yaml:"values,omitempty"`
	Sets        map[string]any    `yaml:"sets,omitempty"`
	Stores      []config.FileRef  `yaml:"stores,omitempty"`

	// Namespace creation policy and metadata for this release.
	Namespace config.Namespace `yaml:"namespace"`
	// Timeout bounds the operation ("5m"); empty means nelm's default.
	Timeout string `yaml:"timeout,omitempty"`
	// AutoRollback rolls back to the last deployed revision on failure.
	AutoRollback bool `yaml:"autoRollback,omitempty"`

	// Resource-handling policies, mirroring config.Release.
	ForceAdoption       bool   `yaml:"forceAdoption,omitempty"`
	RemoveManualChanges bool   `yaml:"removeManualChanges"`
	InstallCRDs         bool   `yaml:"installCRDs"`
	DeletePropagation   string `yaml:"deletePropagation,omitempty"`
	HistoryLimit        int    `yaml:"historyLimit,omitempty"`
	DriverURL           string `yaml:"driverURL,omitempty"`

	// ValuesFiles are the plan-relative paths to the resolved values files, in
	// precedence order (lowest first: global values, then per-release). They are
	// passed to nelm as-is; nelm performs the ordered Helm-style merge.
	ValuesFiles []string `yaml:"valuesFiles,omitempty"`

	// ChartFile is the plan-relative path to the chart archive `build
	// --download-charts` fetched for this release. When set it replaces
	// Chart.Name at apply time, so up/down/diff need no registry at all. Empty
	// means the chart is still resolved against Repositories, as before.
	ChartFile string `yaml:"chartFile,omitempty"`
}

Release is a plan entry for a single release, keyed by its uniqname ("name[@namespace[@kubecontext]]") in Plan.Releases. It mirrors config.Release but stores resolved dependency edges and artifact paths.

Jump to

Keyboard shortcuts

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