Documentation
¶
Overview ¶
Package deployer defines the shared interface and types for bundle deployers.
Each deployer (helm, argocd, argocdhelm) produces deployment artifacts from a configured recipe. Deployers are configured as structs with all required data, then Generate is called to produce the output.
The Deployer interface enables mockability in bundler tests and provides a consistent contract across deployer implementations. All three deployers (helm, argocd, argocdhelm) implement this interface.
Index ¶
- func GenerateFromTemplate(tmplContent string, data any, baseDir, filename string) (string, int64, error)
- func IsSafePathComponent(name string) bool
- func NormalizeVersion(v string) string
- func NormalizeVersionWithDefault(v string) string
- func SafeJoin(baseDir, name string) (string, error)
- func SortByDeploymentOrder[T any](items []T, order []string, getName func(T) string) []T
- func SortComponentNamesByDeploymentOrder(components []string, deploymentOrder []string) []string
- func SortComponentRefsByDeploymentOrder(refs []recipe.ComponentRef, order []string) []recipe.ComponentRef
- func WriteValuesFile(values map[string]any, baseDir, filename string) (string, int64, error)
- type Deployer
- type Output
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateFromTemplate ¶
func GenerateFromTemplate(tmplContent string, data any, baseDir, filename string) (string, int64, error)
GenerateFromTemplate renders a template and writes it to baseDir/filename. It uses SafeJoin to verify the output path stays within baseDir.
func IsSafePathComponent ¶
IsSafePathComponent returns true if name is a single path component without any separators or parent directory references.
func NormalizeVersion ¶
NormalizeVersion removes the 'v' prefix from a version string. It returns the input unchanged if no prefix is present.
func NormalizeVersionWithDefault ¶
NormalizeVersionWithDefault removes the 'v' prefix and defaults empty strings to "0.1.0". Use this for Helm chart metadata where a version is always required.
func SafeJoin ¶
SafeJoin joins baseDir and name, then verifies the result is contained within baseDir. This prevents path traversal when name comes from untrusted input (e.g., component names from recipe data).
func SortByDeploymentOrder ¶
SortByDeploymentOrder sorts items by deployment order using getName to extract the component name from each item. Items in the order list are sorted by their position; items not in the order list are placed after ordered items and sorted alphabetically by name.
func SortComponentNamesByDeploymentOrder ¶
SortComponentNamesByDeploymentOrder sorts component name strings by deployment order.
func SortComponentRefsByDeploymentOrder ¶
func SortComponentRefsByDeploymentOrder(refs []recipe.ComponentRef, order []string) []recipe.ComponentRef
SortComponentRefsByDeploymentOrder sorts component refs by deployment order.
Types ¶
type Deployer ¶
Deployer generates deployment bundles from configured inputs. Implementations are configured as structs, then Generate is called.
type Output ¶
type Output struct {
// Files contains the paths of generated files.
Files []string
// TotalSize is the total size of all generated files.
TotalSize int64
// Duration is the time taken to generate the output.
Duration time.Duration
// DeploymentSteps contains ordered deployment instructions for the user.
DeploymentSteps []string
// DeploymentNotes contains optional deployment notes or warnings.
DeploymentNotes []string
}
Output contains the result of deployer generation.
func (*Output) AddDataFiles ¶
AddDataFiles resolves each relative data file path against outputDir (via SafeJoin, rejecting traversal), stats the file, and appends the absolute path to Files while adding the file size to TotalSize. Used by generators to include external --data files in their output so they are covered by checksum generation.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package argocd provides Argo CD Application generation for recipes.
|
Package argocd provides Argo CD Application generation for recipes. |
|
Package argocdhelm generates a Helm chart app-of-apps for Argo CD with dynamic install-time values.
|
Package argocdhelm generates a Helm chart app-of-apps for Argo CD with dynamic install-time values. |
|
Package helm generates per-component Helm bundles from recipe results.
|
Package helm generates per-component Helm bundles from recipe results. |
|
Package localformat writes the uniform numbered local-chart bundle layout.
|
Package localformat writes the uniform numbered local-chart bundle layout. |