Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrChartYAMLNotFound = errors.New("chart.yaml not found in archive") ErrChartYAMLTooLarge = errors.New("chart.yaml exceeds max size") )
Sentinel errors for Helm chart parsing.
var ErrChartTooLarge = errors.New("chart exceeds max unpacked size")
ErrChartTooLarge reports a chart whose unpacked size exceeds the scan limit.
var ErrNotIndex = errors.New("not a helm repository index")
ErrNotIndex is returned for a document that is not a Helm repository index.
Functions ¶
func ChartFile ¶ added in v0.6.0
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 ¶
ParseChart extracts metadata from a Helm chart tarball.
func RelativeChartFile ¶ added in v0.6.0
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 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
}
ChartVersion is the part of one index entry that proxying and merging need.
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
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
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) 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.