Documentation ¶
Index ¶
- Variables
- func LoadChartMetadata(chartPath string) (meta *helmchart.Metadata, err error)
- func LoadChartMetadataFromArchive(archive string) (*helmchart.Metadata, error)
- func LoadChartMetadataFromDir(dir string) (*helmchart.Metadata, error)
- func OverwriteChartDefaultValues(chart *helmchart.Chart, vals chartutil.Values) (bool, error)
- type Build
- type BuildError
- type BuildErrorReason
- type BuildOptions
- type Builder
- type DependencyManager
- type DependencyManagerOption
- type GetChartRepositoryCallback
- type LocalReference
- type Reference
- type RemoteReference
- type WithConcurrent
- type WithRepositories
- type WithRepositoryCallback
Constants ¶
This section is empty.
Variables ¶
var ( ErrChartReference = BuildErrorReason("chart reference error") ErrChartPull = BuildErrorReason("chart pull error") ErrChartMetadataPatch = BuildErrorReason("chart metadata patch error") ErrValuesFilesMerge = BuildErrorReason("values files merge error") ErrDependencyBuild = BuildErrorReason("dependency build error") ErrChartPackage = BuildErrorReason("chart package error") )
Functions ¶
func LoadChartMetadata ¶
LoadChartMetadata attempts to load the chart.Metadata from the "Chart.yaml" file in the directory or archive at the given chartPath. It takes "requirements.yaml" files into account, and is therefore compatible with the chart.APIVersionV1 format.
func LoadChartMetadataFromArchive ¶
LoadChartMetadataFromArchive loads the chart.Metadata from the "Chart.yaml" file in the archive at the given path. It takes "requirements.yaml" files into account, and is therefore compatible with the chart.APIVersionV1 format.
func LoadChartMetadataFromDir ¶
LoadChartMetadataFromDir loads the chart.Metadata from the "Chart.yaml" file in the directory at the given path. It takes "requirements.yaml" files into account, and is therefore compatible with the chart.APIVersionV1 format.
Types ¶
type Build ¶
type Build struct { // Path is the absolute path to the packaged chart. Path string // Name of the packaged chart. Name string // Version of the packaged chart. Version string // ValuesFiles is the list of files used to compose the chart's // default "values.yaml". ValuesFiles []string // ResolvedDependencies is the number of local and remote dependencies // collected by the DependencyManager before building the chart. ResolvedDependencies int // Packaged indicates if the Builder has packaged the chart. // This can for example be false if ValuesFiles is empty and the chart // source was already packaged. Packaged bool }
Build contains the Builder.Build result, including specific information about the built chart like ResolvedDependencies.
type BuildError ¶
BuildError contains a wrapped Err and a Reason indicating why it occurred.
func (*BuildError) Error ¶
func (e *BuildError) Error() string
Error returns Err as a string, prefixed with the Reason to provide context.
func (*BuildError) Is ¶
func (e *BuildError) Is(target error) bool
Is returns true if the Reason or Err equals target. It can be used to programmatically place an arbitrary Err in the context of the Builder:
err := &BuildError{Reason: ErrChartPull, Err: errors.New("arbitrary transport error")} errors.Is(err, ErrChartPull)
type BuildErrorReason ¶
type BuildErrorReason string
BuildErrorReason is the descriptive reason for a BuildError.
func (BuildErrorReason) Error ¶
func (e BuildErrorReason) Error() string
Error returns the string representation of BuildErrorReason.
type BuildOptions ¶
type BuildOptions struct { // VersionMetadata can be set to SemVer build metadata as defined in // the spec, and is included during packaging. // Ref: https://semver.org/#spec-item-10 VersionMetadata string // ValuesFiles can be set to a list of relative paths, used to compose // and overwrite an alternative default "values.yaml" for the chart. ValuesFiles []string // CachedChart can be set to the absolute path of a chart stored on // the local filesystem, and is used for simple validation by metadata // comparisons. CachedChart string // Force can be set to force the build of the chart, for example // because the list of ValuesFiles has changed. Force bool }
BuildOptions provides a list of options for Builder.Build.
func (BuildOptions) GetValuesFiles ¶
func (o BuildOptions) GetValuesFiles() []string
GetValuesFiles returns BuildOptions.ValuesFiles, except if it equals "values.yaml", which returns nil.
type Builder ¶
type Builder interface { // Build pulls and (optionally) packages a Helm chart with the given // Reference and BuildOptions, and writes it to p. // It returns the Build result, or an error. // It may return an error for unsupported Reference implementations. Build(ctx context.Context, ref Reference, p string, opts BuildOptions) (*Build, error) }
Builder is capable of building a (specific) chart Reference.
func NewLocalBuilder ¶
func NewLocalBuilder(dm *DependencyManager) Builder
NewLocalBuilder returns a Builder capable of building a Helm chart with a LocalReference. For chart references pointing to a directory, the DependencyManager is used to resolve missing local and remote dependencies.
func NewRemoteBuilder ¶
func NewRemoteBuilder(repository *repository.ChartRepository) Builder
NewRemoteBuilder returns a Builder capable of building a Helm chart with a RemoteReference in the given repository.ChartRepository.
type DependencyManager ¶
type DependencyManager struct {
// contains filtered or unexported fields
}
DependencyManager manages dependencies for a Helm chart.
func NewDependencyManager ¶
func NewDependencyManager(opts ...DependencyManagerOption) *DependencyManager
NewDependencyManager returns a new DependencyManager configured with the given DependencyManagerOption list.
func (*DependencyManager) Build ¶
func (dm *DependencyManager) Build(ctx context.Context, ref Reference, chart *helmchart.Chart) (int, error)
Build compiles a set of missing dependencies from chart.Chart, and attempts to resolve and build them using the information from Reference. It returns the number of resolved local and remote dependencies, or an error.
func (*DependencyManager) Clear ¶
func (dm *DependencyManager) Clear() []error
Clear iterates over the repositories, calling Unload and RemoveCache on all items. It returns a collection of (cache removal) errors.
type DependencyManagerOption ¶
type DependencyManagerOption interface {
// contains filtered or unexported methods
}
DependencyManagerOption configures an option on a DependencyManager.
type GetChartRepositoryCallback ¶
type GetChartRepositoryCallback func(url string) (*repository.ChartRepository, error)
GetChartRepositoryCallback must return a repository.ChartRepository for the URL, or an error describing why it could not be returned.
type LocalReference ¶
type LocalReference struct { // WorkDir used as chroot during build operations. // File references are not allowed to traverse outside it. WorkDir string // Path of the chart on the local filesystem. Path string }
LocalReference contains sufficient information to locate a chart on the local filesystem.
func (LocalReference) Validate ¶
func (r LocalReference) Validate() error
Validate returns an error if the LocalReference does not have a Path set.
type Reference ¶
type Reference interface { // Validate returns an error if the Reference is not valid according // to the spec of the interface implementation. Validate() error }
Reference holds information to locate a chart.
type RemoteReference ¶
type RemoteReference struct { // Name of the chart. Name string // Version of the chart. // Can be a Semver range, or empty for latest. Version string }
RemoteReference contains sufficient information to look up a chart in a ChartRepository.
func (RemoteReference) Validate ¶
func (r RemoteReference) Validate() error
Validate returns an error if the RemoteReference does not have a Name set.
type WithConcurrent ¶
type WithConcurrent int64
type WithRepositories ¶
type WithRepositories map[string]*repository.ChartRepository
type WithRepositoryCallback ¶
type WithRepositoryCallback GetChartRepositoryCallback