helm

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: AGPL-3.0 Imports: 15 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const MaxVersions = 200_000

MaxVersions caps the chart versions (entries across all charts) of an index ParseIndex accepts. The tree of an index costs tens of nodes per version, so the cap bounds what a merge keeps in memory. The largest public indexes list a few tens of thousands of versions; 200000 is several times that.

Variables

View Source
var (
	ErrChartYAMLNotFound = errors.New("chart.yaml not found in archive")
	ErrChartYAMLTooLarge = errors.New("chart.yaml exceeds max size")
)

Sentinel errors for Helm chart parsing.

View Source
var ErrChartTooLarge = errors.New("chart exceeds max unpacked size")

ErrChartTooLarge reports a chart whose unpacked size exceeds the scan limit.

View Source
var ErrNotIndex = errors.New("not a helm repository index")

ErrNotIndex is returned for a document that is not a Helm repository index.

View Source
var ErrTooLarge = errors.New("helm index lists too many chart versions")

ErrTooLarge is returned for an index listing more than MaxVersions versions.

Functions

func ChartFile added in v0.6.0

func ChartFile(u *url.URL) (string, bool)

ChartFile returns the file name a chart URL is served under (as charts/<name> of a proxy or group repository): the last segment of its path. Only http and https URLs can be served; others (oci://) report false.

func ParseChart

func ParseChart(r io.Reader) (map[string]any, error)

ParseChart extracts metadata from a Helm chart tarball.

func RelativeChartFile added in v0.6.0

func RelativeChartFile(raw string) (string, bool)

RelativeChartFile is ChartFile for a URL that may be relative (a member index's, already pointing at one of this server's repositories or at a path below it).

Types

type ChartMetadata

type ChartMetadata struct {
	APIVersion  string            `yaml:"apiVersion"`
	Name        string            `yaml:"name"`
	Version     string            `yaml:"version"`
	AppVersion  string            `yaml:"appVersion"`
	Description string            `yaml:"description"`
	Type        string            `yaml:"type"`
	Keywords    []string          `yaml:"keywords"`
	Home        string            `yaml:"home"`
	Sources     []string          `yaml:"sources"`
	Maintainers []map[string]any  `yaml:"maintainers"`
	Icon        string            `yaml:"icon"`
	Annotations map[string]string `yaml:"annotations"`
}

ChartMetadata represents the metadata from Chart.yaml.

type ChartVersion added in v0.6.0

type ChartVersion struct {
	// Name is the key of the entry's list under "entries": the name helm
	// resolves, whatever the entry's own "name" field says. Merging and the
	// hosted-wins rule go by it, so an upstream cannot list a version of a
	// chart it does not own under another name.
	Name    string
	Version string
	// Digest is the entry's "digest" field verbatim (SHA-256 hex for charts
	// built by helm package), "" when absent.
	Digest string
	// URLs are the entry's "urls" as published: absolute, or relative to the
	// repository URL.
	URLs []string
	// Created is the entry's "created" field verbatim: when the chart was
	// packaged, "" when absent. Published parses it.
	Created string
}

ChartVersion is the part of one index entry that proxying and merging need.

func (ChartVersion) Published added in v0.16.0

func (cv ChartVersion) Published() time.Time

Published is when the chart version was created as its index states it (an RFC 3339 time, as helm writes it); the zero time when the index states none or one that does not parse.

type Index added in v0.6.0

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

Index is a parsed index.yaml of a classic Helm chart repository. It keeps the YAML tree, so everything but the fields a caller rewrites is reproduced as the upstream published it (annotations, dependencies, icons, ...).

func MergeIndexes added in v0.6.0

func MergeIndexes(indexes []*Index) *Index

MergeIndexes returns the union of the indexes' charts: a chart version is listed once, from the first index that has it (name and version decide; entries without a version are skipped, as helm does). The result carries apiVersion v1 and no generation timestamp, so equal inputs give equal bytes. The entries are shared with the inputs, which must not be modified later.

func ParseIndex added in v0.6.0

func ParseIndex(doc []byte) (*Index, error)

ParseIndex parses doc. The document must be a mapping with an apiVersion and an entries mapping (or none). YAML anchors and aliases are refused: helm's own index generator never writes them, and aliased entries could be made to expand into quadratic work.

func (*Index) Marshal added in v0.6.0

func (ix *Index) Marshal() ([]byte, error)

Marshal renders the index as YAML.

func (*Index) RewriteURLs added in v0.6.0

func (ix *Index) RewriteURLs(fn func(ChartVersion) []string)

RewriteURLs replaces the urls of every chart version with what fn returns for it. A version for which fn returns no URL cannot be served and is removed, as is a chart left without versions.

func (*Index) Versions added in v0.6.0

func (ix *Index) Versions() iter.Seq[ChartVersion]

Versions yields every chart version in document order.

Jump to

Keyboard shortcuts

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