output

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareReleaseSpecs

func CompareReleaseSpecs(release1, release2 *unstructured.Unstructured) (bool, error)

CompareReleaseSpecs compares two releases and returns true if their specs are identical. This uses the shared hash package which implements the same hashing algorithm used by the controller for consistency.

To ensure consistent comparison between generated releases (which may have Go int types) and file-loaded releases (which have float64 types from YAML parsing), we normalize both specs by serializing to YAML and back before hashing.

func FindLatestRelease

func FindLatestRelease(outputDir, componentName string) (*unstructured.Unstructured, string, error)

FindLatestRelease finds the most recent release file for a given component Returns the release object and the file path, or nil if no existing release found

func GetNextVersionNumber

func GetNextVersionNumber(outputDir, componentName, dateStr string) (string, error)

GetNextVersionNumber finds the next version number for a component on a given date Returns "1" if no releases exist for that date, otherwise returns the incremented version

Types

type BulkBindingWriteOptions

type BulkBindingWriteOptions struct {
	Config        *config.ReleaseConfig // Config for output directory resolution
	OutputDir     string                // Default output directory
	Resolver      OutputDirResolverFunc // Optional resolver for output directory
	ExistingPaths map[string]string     // bindingName → original full file path for update-in-place
	DryRun        bool                  // If true, write to stdout
	Stdout        io.Writer             // Writer for dry-run output
}

BulkBindingWriteOptions configures bulk binding write operations

type BulkWriteOptions

type BulkWriteOptions struct {
	Config          *config.ReleaseConfig // Config for output directory resolution
	OutputDir       string                // Default output directory
	Resolver        OutputDirResolverFunc // Optional resolver for output directory
	DryRun          bool                  // If true, write to stdout
	SkipIfUnchanged bool                  // If true, skip writing if release is identical to latest
	Stdout          io.Writer             // Writer for dry-run output
}

BulkWriteOptions configures bulk write operations

type BulkWriteResult

type BulkWriteResult struct {
	OutputPaths []string // Paths where files were written (empty for dry-run)
	Skipped     []string // Release names that were skipped (unchanged)
	Errors      []error  // Any errors encountered during writing
}

BulkWriteResult contains the result of a bulk write operation

type OutputDirResolverFunc added in v0.15.0

type OutputDirResolverFunc func(projectName, componentName string) string

OutputDirResolverFunc resolves the output directory for a given project and component. Returns the directory path, or empty string to fall through to the default.

type WorkloadWriteParams added in v0.12.0

type WorkloadWriteParams struct {
	Namespace     string
	RepoPath      string
	ProjectName   string
	ComponentName string
	OutputPath    string                       // If specified, always use this path
	WorkloadCR    *openchoreov1alpha1.Workload // The generated workload CR
	DryRun        bool
}

WorkloadWriteParams contains parameters for writing a workload in file-system mode

type WorkloadWriter added in v0.12.0

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

WorkloadWriter handles writing workloads in file-system mode

func NewWorkloadWriter added in v0.12.0

func NewWorkloadWriter(idx *fsmode.Index) *WorkloadWriter

NewWorkloadWriter creates a new WorkloadWriter

func (*WorkloadWriter) WriteWorkload added in v0.12.0

func (w *WorkloadWriter) WriteWorkload(params WorkloadWriteParams) (string, error)

WriteWorkload writes a workload to the appropriate location

type WriteOptions

type WriteOptions struct {
	OutputDir       string // Optional: specific output directory
	DryRun          bool   // If true, write to stdout instead of file
	SkipIfUnchanged bool   // If true, skip writing if release is identical to latest
	Stdout          io.Writer
}

WriteOptions configures the write operation

type Writer

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

Writer handles writing resources to files or stdout

func NewWriter

func NewWriter(baseDir string) *Writer

NewWriter creates a new writer with the given base directory

func (*Writer) WriteBinding

func (w *Writer) WriteBinding(binding *unstructured.Unstructured, opts WriteOptions) (string, bool, error)

WriteBinding writes a ReleaseBinding to a file or stdout Returns the output path and a boolean (always false for bindings, kept for consistency)

func (*Writer) WriteBulkBindings

func (w *Writer) WriteBulkBindings(
	bindings []*unstructured.Unstructured,
	opts BulkBindingWriteOptions,
) (*BulkWriteResult, error)

WriteBulkBindings writes multiple bindings according to config

func (*Writer) WriteBulkReleases

func (w *Writer) WriteBulkReleases(
	releases []*unstructured.Unstructured,
	opts BulkWriteOptions,
) (*BulkWriteResult, error)

WriteBulkReleases writes multiple releases according to config

func (*Writer) WriteRelease

func (w *Writer) WriteRelease(release *unstructured.Unstructured, opts WriteOptions) (string, bool, error)

WriteRelease writes a ComponentRelease to a file or stdout Returns the output path and a boolean indicating if the release was skipped (unchanged)

func (*Writer) WriteResource

func (w *Writer) WriteResource(resource *unstructured.Unstructured, outputPath string, dryRun bool) error

WriteResource writes any unstructured resource to a file or stdout

Jump to

Keyboard shortcuts

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