Documentation
¶
Overview ¶
Package helm is the format of classic Helm chart repositories (decision 0039); Helm OCI repositories are the Docker format's. It reads each chart archive's Chart.yaml, indexes every chart in the repository, in any folder, as a version of the package its name gives (decision 0018), with the per-version Metadata that index.yaml is built from, and sets the chart.* properties. Every write reaches it through the item service, so a chart deployed by a REST PUT, by checksum, from an archive, or landed by a copy, a move or a restore is indexed the same way.
A chart's provenance file, <chart>.prov, is a sidecar the format keeps with its chart (format.SidecarKeeper): it follows the chart through a delete, a copy, a move and a restore, and is never a version file.
Each write that changes a repository's charts queues the repository's index.yaml work, one item per repository (KindIndex).
Index ¶
- Constants
- Variables
- func EncodeIndex(index Index) ([]byte, error)
- func IsChartPath(p string) bool
- func IsSemver(v string) bool
- func Serves(t repo.PackageType) bool
- type Chart
- type ChartVersion
- type Dependency
- type Handler
- func (Handler) Admit(ctx context.Context, env format.Env, c repo.Config, w format.Write) (format.Write, error)
- func (Handler) Classify(_ repo.Config, path string) format.Class
- func (Handler) Deleting(ctx context.Context, env format.Env, c repo.Config, it types.Item) error
- func (Handler) Deployed(ctx context.Context, env format.Env, c repo.Config, it types.Item) error
- func (Handler) Inspect(ctx context.Context, env format.Env, _ repo.Config, w format.Write) (any, error)
- func (Handler) Owed(c repo.Config, cached bool, p string) []format.WorkRef
- func (Handler) Reindex(ctx context.Context, env format.Env, c repo.Config) error
- func (Handler) ReindexPath(ctx context.Context, env format.Env, c repo.Config, p string) error
- func (Handler) Resolve(ctx context.Context, env format.Env, c repo.Config, d format.Download) (string, error)
- func (Handler) Sidecars(_ repo.Config, p string) []string
- func (Handler) Work(ctx context.Context, env format.Env, work types.WorkItem) error
- func (Handler) WorkKinds() []string
- type Index
- type Maintainer
- type Metadata
- type Settings
Constants ¶
const ( PropName = "chart.name" PropVersion = "chart.version" PropAppVersion = "chart.appVersion" )
Properties the format sets on an indexed chart from its Chart.yaml: the keys of Artifactory's Helm package search (6.20 PackageSearchCriteria; RTFACT-15566). 7.x still writes appVersion as a property (RTFACT-26509); that 7.161 writes these three keys and no other is [I] (#216).
const APIVersionV1 = "v1"
APIVersionV1 is the apiVersion Helm gives a Chart.yaml that names none (pkg/chart/loader: "if c.Metadata.APIVersion == "" { ... APIVersionV1 }").
const IndexPath = "index.yaml"
IndexPath is where a repository's index.yaml lies: its root alone. An index.yaml in any other folder is an ordinary file.
const KindIndex = "helm.index"
KindIndex is the format's derived work (decisions 0033 and 0039): a repository's index.yaml, keyed by the repository's key alone, since one file lists every chart of the repository. Every write that changes the charts of a local or federated repository queues it in the write's own transaction, so a burst of deploys coalesces into one item.
const ProvSuffix = ".prov"
ProvSuffix makes a chart's path its provenance file's: helm fetches the file at the chart's URL plus .prov (Helm's provenance documentation).
Variables ¶
var ErrNotChart = errors.New("helm: not a usable chart archive")
ErrNotChart is content the format cannot index: no tar or tar.gz, no readable Chart.yaml where a chart keeps it, one that is no YAML mapping of Helm's fields, or one without a name or a version. Such a file is stored but not indexed (decision 0039).
Functions ¶
func EncodeIndex ¶
EncodeIndex writes Helm's fields alphabetically, omitting absent chart fields as Helm's JSON model does. Versions remain quoted even when they resemble numbers, booleans or scientific notation (RTFACT-20334).
func IsChartPath ¶
IsChartPath reports whether p names a file the format reads as a chart archive: one whose name ends .tgz or .tar.gz, as 6.20's HelmAddon.isHelmFile reads it (research 30, section 3). Anything else, a .prov included, is an ordinary file.
func Serves ¶
func Serves(t repo.PackageType) bool
Serves reports whether t is the package type of this format.
Types ¶
type Chart ¶
type Chart struct {
Name string `json:"name,omitempty" yaml:"name"`
Home string `json:"home,omitempty" yaml:"home"`
Sources []string `json:"sources,omitempty" yaml:"sources"`
Version string `json:"version,omitempty" yaml:"version"`
Description string `json:"description,omitempty" yaml:"description"`
Keywords []string `json:"keywords,omitempty" yaml:"keywords"`
Maintainers []Maintainer `json:"maintainers,omitempty" yaml:"maintainers"`
Icon string `json:"icon,omitempty" yaml:"icon"`
APIVersion string `json:"apiVersion,omitempty" yaml:"apiVersion"`
Condition string `json:"condition,omitempty" yaml:"condition"`
Tags string `json:"tags,omitempty" yaml:"tags"`
AppVersion string `json:"appVersion,omitempty" yaml:"appVersion"`
Deprecated bool `json:"deprecated,omitempty" yaml:"deprecated"`
Annotations map[string]string `json:"annotations,omitempty" yaml:"annotations"`
KubeVersion string `json:"kubeVersion,omitempty" yaml:"kubeVersion"`
Dependencies []Dependency `json:"dependencies,omitempty" yaml:"dependencies"`
Type string `json:"type,omitempty" yaml:"type"`
}
Chart is a chart's Chart.yaml as Helm's chart.Metadata reads it: the fields of its model, under the names Helm writes in index.yaml, and no other. Helm reads an index strictly, so a key outside the model would make a whole index.yaml unreadable (decision 0039); unknown keys are dropped here. A scalar read into a string keeps its text as written, so a version of 1.10 stays "1.10" and an appVersion of 504e199 stays a string (RTFACT-20334).
func ReadChart ¶
ReadChart reads the chart archive in ra, of size bytes: the Chart.yaml at its root, which a chart packed by hand may have (RTFACT-16103), or else the one directly inside a top-level folder, where helm package puts it, never a subchart's under charts/ (RTFACT-17119). A requirements.yaml beside it is read into it afterwards, as Helm's loader reads a v1 chart's dependencies (pkg/chart/loader, LoadFiles). Within one place a later entry replaces an earlier one, as extracting the archive would. ErrNotChart when the format cannot index the content; any other error is a failure to read it.
type ChartVersion ¶
type ChartVersion struct {
Chart ` yaml:",inline"`
Created string `yaml:"created" json:"created"`
Digest string `yaml:"digest" json:"digest"`
URLs []string `yaml:"urls" json:"urls"`
}
ChartVersion adds the archive's location and digest to Chart.yaml.
type Dependency ¶
type Dependency struct {
Name string `json:"name" yaml:"name"`
Version string `json:"version,omitempty" yaml:"version"`
Repository string `json:"repository" yaml:"repository"`
Condition string `json:"condition,omitempty" yaml:"condition"`
Tags []string `json:"tags,omitempty" yaml:"tags"`
Enabled bool `json:"enabled,omitempty" yaml:"enabled"`
// ImportValues holds strings and child/parent mappings, which Helm
// keeps as it reads them.
ImportValues []any `json:"import-values,omitempty" yaml:"import-values"`
Alias string `json:"alias,omitempty" yaml:"alias"`
}
Dependency is Helm's chart.Dependency, alias included: 7.x strips it from its index (RTFACT-30329), which Helm's own index keeps (decision 0039).
type Handler ¶
type Handler struct {
// The generic format's hooks for what Helm leaves alone. Admit adds
// Enforce Layout to its deploy policy (enforce.go).
generic.Handler
}
Handler is the Helm format.
func (Handler) Admit ¶
func (Handler) Admit( ctx context.Context, env format.Env, c repo.Config, w format.Write, ) (format.Write, error)
Admit applies the deploy policy of every package type, then Enforce Layout (decision 0039) to every write that lands a chart-named file in a repository that turned it on: a deploy, a checksum deploy, an archive entry, and the target of a copy or move, which the item service then reports and skips. A .prov and every other file pass, as does a checksum upload, which lands no file. The checks run in the order 7.x's documentation lists them, which is [I] (#216):
- forceMetadataNameVersion: Chart.yaml can be read and names a chart and a version;
- forceMetadataNameVersion: the version is SemVer 2.0.0;
- forceMetadataNameVersion: the file is <name>-<version> with its extension;
- forceNonDuplicateChart: no chart at another path of the repository has the same name and version. A write to the same path is an overwrite, and a move's own source is no duplicate of it.
func (Handler) Classify ¶
Classify keeps the root index out of replication: each repository derives its own metadata from the charts it receives.
func (Handler) Deleting ¶
Deleting runs before a file is removed. The item service drops a chart's version link with it and prunes a version left without files; a version that keeps another archive takes that one's Chart.yaml when the newest goes (handOver). A chart's delete, or a client's delete of the root index.yaml, queues the repository's index.yaml.
func (Handler) Deployed ¶
Deployed indexes a chart as a file of its version, and takes a file that no longer holds a chart, or holds another, out of the version it was one of. A chart anywhere in the repository is indexed (RTFACT-25956). It queues the repository's index.yaml when the charts changed, and when a client stored the root index.yaml, which the next run replaces (RTFACT-18128).
func (Handler) Inspect ¶
func (Handler) Inspect( ctx context.Context, env format.Env, _ repo.Config, w format.Write, ) (any, error)
Inspect reads a chart-named file before the write's transaction, so no decompression holds the store's write lock. Other content needs no reading.
func (Handler) Owed ¶
Owed names the work a read of the root index.yaml of a local or federated repository waits for, so a client never reads an index that lags a completed write.
func (Handler) Reindex ¶
Reindex rebuilds the repository's Helm index from every chart archive in it, a remote repository's from its cache, and queues its index.yaml. Which repositories the JFrog reindex operation accepts is the API's rule, not the index's (internal/server, reindexOps).
func (Handler) ReindexPath ¶
ReindexPath rebuilds the part of the index that the chart archives under p give: a folder, read to its last level, or one archive, as Helm's partial reindex names them (kubernetes-helm-chart-repositories, "Helm Charts Partial Re-Indexing"). A version some of whose archives lie elsewhere keeps them, as the index holds them. An empty path is the whole repository.
func (Handler) Resolve ¶
func (Handler) Resolve( ctx context.Context, env format.Env, c repo.Config, d format.Download, ) (string, error)
Resolve seeds work for a cold index before the item service calls EnsureFresh. A parked item is deliberately left parked: reading must surface its failure, not silently reset its retry budget.
func (Handler) Sidecars ¶
Sidecars names a chart's provenance file, <chart>.prov beside it, which the item service keeps with the chart (decision 0039). Any other file owns none.
type Index ¶
type Index struct {
APIVersion string `json:"apiVersion" yaml:"apiVersion"`
Entries map[string][]ChartVersion `json:"entries" yaml:"entries"`
Generated string `json:"generated" yaml:"generated"`
}
Index is Helm's repository index. Stored chart URLs are relative; only the protocol's absolute mode rewrites them for the requesting proxy.
type Maintainer ¶
type Maintainer struct {
Name string `json:"name,omitempty" yaml:"name"`
Email string `json:"email,omitempty" yaml:"email"`
URL string `json:"url,omitempty" yaml:"url"`
}
Maintainer is Helm's chart.Maintainer.
type Metadata ¶
type Metadata struct {
// Chart is the newest archive's Chart.yaml.
Chart Chart `json:"chart"`
// Path is the archive's path from the repository root, which an index
// entry's URL names.
Path string `json:"path"`
// Digest is the archive's SHA-256 in hex, index.yaml's digest.
Digest string `json:"digest"`
// Created is when the archive was last deployed, index.yaml's created:
// its item's last-modified time, which a copy and a move keep, in UTC
// to the microsecond the stores keep.
Created time.Time `json:"created"`
}
Metadata is a version's document in the package index (PackageVersion.Metadata, decision 0039): what index.yaml's entry for the version is built from, so building it opens no archive. A version's files are every chart archive in the repository with its name and version; the document is the newest one's. Everything in it follows from that archive and its item, so a reindex writes the same bytes.
func DecodeMetadata ¶
DecodeMetadata reads a version's Metadata.
type Settings ¶
type Settings struct{ RelativeURLs *bool }
Settings controls how the protocol serves the stored index. Nil retains Artifactory's default: chart URLs relative to the repository URL.
func (Settings) IsRelative ¶
IsRelative reports whether chart URLs remain relative.