Documentation
¶
Overview ¶
Package workspace owns the Deployah project source locations for one invocation and loads the spec and optional platform configuration from those sources.
A Workspace does not resolve Kubernetes destinations and does not construct Helm or Kubernetes clients.
Platform source precedence ¶
Source selection is snapshotted in New:
- explicit Config.PlatformPath
- DEPLOYAH_PLATFORM_FILE
- deployah.platform.yaml next to the effective spec
An explicit or environment-selected path is required. The default adjacent file is optional: Workspace.Platform returns (nil, nil) when it is missing.
Index ¶
- type Config
- type Workspace
- func (w *Workspace) LoadSpec(ctx context.Context, environment string, opts ...spec.LoadOption) (*spec.Spec, spec.SubstitutionReport, error)
- func (w *Workspace) ParseManifest() (*spec.Spec, error)
- func (w *Workspace) Platform() (*spec.PlatformConfig, error)
- func (w *Workspace) PlatformPath() string
- func (w *Workspace) SpecPath() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// SpecPath is the Deployah spec file. Empty means [spec.DefaultSpecPath].
SpecPath string
// PlatformPath is an explicit platform file. Empty means
// DEPLOYAH_PLATFORM_FILE, then the default file next to the spec.
PlatformPath string
}
Config holds source-location inputs for a Workspace.
type Workspace ¶
type Workspace struct {
// contains filtered or unexported fields
}
Workspace owns the Deployah project source locations for one invocation and loads the spec and optional platform configuration from those sources.
New snapshots the effective spec path and platform source selection, including whether the platform path is required. Later changes to DEPLOYAH_PLATFORM_FILE do not retarget an existing Workspace.
Concurrent calls to Workspace.SpecPath, Workspace.PlatformPath, Workspace.Platform, Workspace.ParseManifest, and Workspace.LoadSpec are safe.
func New ¶
New returns a Workspace that snapshots config and the current DEPLOYAH_PLATFORM_FILE value. It does not read the spec or platform files.
func (*Workspace) LoadSpec ¶
func (w *Workspace) LoadSpec(ctx context.Context, environment string, opts ...spec.LoadOption) (*spec.Spec, spec.SubstitutionReport, error)
LoadSpec loads the spec for environment from Workspace.SpecPath using the Workspace platform and opts. Each call reads the spec from disk because envsubst depends on environment. The spec.SubstitutionReport is the report produced by that spec.Load call.
func (*Workspace) ParseManifest ¶
ParseManifest reads the spec at Workspace.SpecPath without envsubst, defaults, or platform resolution.
func (*Workspace) Platform ¶
func (w *Workspace) Platform() (*spec.PlatformConfig, error)
Platform loads and memoizes the platform configuration from the snapshotted source.
A successful load is memoized. A missing optional adjacent file returns (nil, nil). A missing or unreadable required source (explicit path or DEPLOYAH_PLATFORM_FILE) returns an error. Failed loads and the optional miss are not cached.
func (*Workspace) PlatformPath ¶
PlatformPath returns the snapshotted platform file path.