Documentation ¶
Overview ¶
Package repo implements the Helm Chart Repository.
A chart repository is an HTTP server that provides information on charts. A local repository cache is an on-disk representation of a chart repository.
There are two important file formats for chart repositories.
The first is the 'index.yaml' format, which is expressed like this:
apiVersion: v1 entries: frobnitz: - created: 2016-09-29T12:14:34.830161306-06:00 description: This is a frobnitz. digest: 587bd19a9bd9d2bc4a6d25ab91c8c8e7042c47b4ac246e37bf8e1e74386190f4 home: http://example.com keywords: - frobnitz - sprocket - dodad maintainers: - email: helm@example.com name: The Helm Team - email: nobody@example.com name: Someone Else name: frobnitz urls: - http://example-charts.com/testdata/repository/frobnitz-1.2.3.tgz version: 1.2.3 sprocket: - created: 2016-09-29T12:14:34.830507606-06:00 description: This is a sprocket" digest: 8505ff813c39502cc849a38e1e4a8ac24b8e6e1dcea88f4c34ad9b7439685ae6 home: http://example.com keywords: - frobnitz - sprocket - dodad maintainers: - email: helm@example.com name: The Helm Team - email: nobody@example.com name: Someone Else name: sprocket urls: - http://example-charts.com/testdata/repository/sprocket-1.2.0.tgz version: 1.2.0 generated: 2016-09-29T12:14:34.829721375-06:00
An index.yaml file contains the necessary descriptive information about what charts are available in a repository, and how to get them.
The second file format is the repositories.yaml file format. This file is for facilitating local cached copies of one or more chart repositories.
The format of a repository.yaml file is:
apiVersion: v1 generated: TIMESTAMP repositories: - name: stable url: http://example.com/charts cache: stable-index.yaml - name: incubator url: http://example.com/incubator cache: incubator-index.yaml
This file maps three bits of information about a repository:
- The name the user uses to refer to it
- The fully qualified URL to the repository (index.yaml will be appended)
- The name of the local cachefile
The format for both files was changed after Helm v2.0.0-Alpha.4. Helm is not backwards compatible with those earlier versions.
Index ¶
- Constants
- Variables
- func FindChartInAuthAndTLSAndPassRepoURL(...) (string, error)
- func FindChartInAuthAndTLSRepoURL(...) (string, error)
- func FindChartInAuthRepoURL(...) (string, error)
- func FindChartInRepoURL(repoURL, chartName, chartVersion, certFile, keyFile, caFile string, ...) (string, error)
- func ResolveReferenceURL(baseURL, refURL string) (string, error)
- type ChartRepository
- type ChartVersion
- type ChartVersions
- type Entry
- type File
- type IndexFile
- func (i IndexFile) Add(md *chart.Metadata, filename, baseURL, digest string)deprecated
- func (i IndexFile) Get(name, version string) (*ChartVersion, error)
- func (i IndexFile) Has(name, version string) bool
- func (i *IndexFile) Merge(f *IndexFile)
- func (i IndexFile) MustAdd(md *chart.Metadata, filename, baseURL, digest string) error
- func (i IndexFile) SortEntries()
- func (i IndexFile) WriteFile(dest string, mode os.FileMode) error
Constants ¶
const APIVersionV1 = "v1"
APIVersionV1 is the v1 API version for index and repository files.
Variables ¶
var ( // ErrNoAPIVersion indicates that an API version was not specified. ErrNoAPIVersion = errors.New("no API version specified") // ErrNoChartVersion indicates that a chart with the given version is not found. ErrNoChartVersion = errors.New("no chart version found") // ErrNoChartName indicates that a chart with the given name is not found. ErrNoChartName = errors.New("no chart name found") )
Functions ¶
func FindChartInAuthAndTLSAndPassRepoURL ¶
func FindChartInAuthAndTLSAndPassRepoURL(repoURL, username, password, chartName, chartVersion, certFile, keyFile, caFile string, insecureSkipTLSverify, passCredentialsAll bool, getters getter.Providers) (string, error)
FindChartInAuthAndTLSAndPassRepoURL finds chart in chart repository pointed by repoURL without adding repo to repositories, like FindChartInRepoURL, but it also receives credentials, TLS verify flag, and if credentials should be passed on to other domains. TODO Helm 4, FindChartInAuthAndTLSAndPassRepoURL should be integrated into FindChartInAuthRepoURL.
func FindChartInAuthAndTLSRepoURL ¶
func FindChartInAuthAndTLSRepoURL(repoURL, username, password, chartName, chartVersion, certFile, keyFile, caFile string, insecureSkipTLSverify bool, getters getter.Providers) (string, error)
FindChartInAuthAndTLSRepoURL finds chart in chart repository pointed by repoURL without adding repo to repositories, like FindChartInRepoURL, but it also receives credentials and TLS verify flag for the chart repository. TODO Helm 4, FindChartInAuthAndTLSRepoURL should be integrated into FindChartInAuthRepoURL.
func FindChartInAuthRepoURL ¶
func FindChartInAuthRepoURL(repoURL, username, password, chartName, chartVersion, certFile, keyFile, caFile string, getters getter.Providers) (string, error)
FindChartInAuthRepoURL finds chart in chart repository pointed by repoURL without adding repo to repositories, like FindChartInRepoURL, but it also receives credentials for the chart repository.
func FindChartInRepoURL ¶
func FindChartInRepoURL(repoURL, chartName, chartVersion, certFile, keyFile, caFile string, getters getter.Providers) (string, error)
FindChartInRepoURL finds chart in chart repository pointed by repoURL without adding repo to repositories
func ResolveReferenceURL ¶
ResolveReferenceURL resolves refURL relative to baseURL. If refURL is absolute, it simply returns refURL.
Types ¶
type ChartRepository ¶
type ChartRepository struct { Config *Entry ChartPaths []string IndexFile *IndexFile Client getter.Getter CachePath string }
ChartRepository represents a chart repository
func NewChartRepository ¶
func NewChartRepository(cfg *Entry, getters getter.Providers) (*ChartRepository, error)
NewChartRepository constructs ChartRepository
func (*ChartRepository) DownloadIndexFile ¶
func (r *ChartRepository) DownloadIndexFile() (string, error)
DownloadIndexFile fetches the index from a repository.
func (*ChartRepository) Index ¶
func (r *ChartRepository) Index() error
Index generates an index for the chart repository and writes an index.yaml file.
func (*ChartRepository) Load
deprecated
func (r *ChartRepository) Load() error
Load loads a directory of charts as if it were a repository.
It requires the presence of an index.yaml file in the directory.
Deprecated: remove in Helm 4.
type ChartVersion ¶
type ChartVersion struct { *chart.Metadata URLs []string `json:"urls"` Created time.Time `json:"created,omitempty"` Removed bool `json:"removed,omitempty"` Digest string `json:"digest,omitempty"` // ChecksumDeprecated is deprecated in Helm 3, and therefore ignored. Helm 3 replaced // this with Digest. However, with a strict YAML parser enabled, a field must be // present on the struct for backwards compatibility. ChecksumDeprecated string `json:"checksum,omitempty"` // EngineDeprecated is deprecated in Helm 3, and therefore ignored. However, with a strict // YAML parser enabled, this field must be present. EngineDeprecated string `json:"engine,omitempty"` // TillerVersionDeprecated is deprecated in Helm 3, and therefore ignored. However, with a strict // YAML parser enabled, this field must be present. TillerVersionDeprecated string `json:"tillerVersion,omitempty"` // URLDeprecated is deprecated in Helm 3, superseded by URLs. It is ignored. However, // with a strict YAML parser enabled, this must be present on the struct. URLDeprecated string `json:"url,omitempty"` }
ChartVersion represents a chart entry in the IndexFile
type ChartVersions ¶
type ChartVersions []*ChartVersion
ChartVersions is a list of versioned chart references. Implements a sorter on Version.
func (ChartVersions) Less ¶
func (c ChartVersions) Less(a, b int) bool
Less returns true if the version of entry a is less than the version of entry b.
func (ChartVersions) Swap ¶
func (c ChartVersions) Swap(i, j int)
Swap swaps the position of two items in the versions slice.
type Entry ¶
type Entry struct { Name string `json:"name"` URL string `json:"url"` Username string `json:"username"` Password string `json:"password"` CertFile string `json:"certFile"` KeyFile string `json:"keyFile"` CAFile string `json:"caFile"` InsecureSkipTLSverify bool `json:"insecure_skip_tls_verify"` PassCredentialsAll bool `json:"pass_credentials_all"` }
Entry represents a collection of parameters for chart repository
type File ¶
type File struct { APIVersion string `json:"apiVersion"` Generated time.Time `json:"generated"` Repositories []*Entry `json:"repositories"` }
File represents the repositories.yaml file
func NewFile ¶
func NewFile() *File
NewFile generates an empty repositories file.
Generated and APIVersion are automatically set.
type IndexFile ¶
type IndexFile struct { // This is used ONLY for validation against chartmuseum's index files and is discarded after validation. ServerInfo map[string]interface{} `json:"serverInfo,omitempty"` APIVersion string `json:"apiVersion"` Generated time.Time `json:"generated"` Entries map[string]ChartVersions `json:"entries"` PublicKeys []string `json:"publicKeys,omitempty"` // Annotations are additional mappings uninterpreted by Helm. They are made available for // other applications to add information to the index file. Annotations map[string]string `json:"annotations,omitempty"` }
IndexFile represents the index file in a chart repository
func IndexDirectory ¶
IndexDirectory reads a (flat) directory and generates an index.
It indexes only charts that have been packaged (*.tgz).
The index returned will be in an unsorted state
func LoadIndexFile ¶
LoadIndexFile takes a file at the given path and returns an IndexFile object
func (IndexFile) Get ¶
func (i IndexFile) Get(name, version string) (*ChartVersion, error)
Get returns the ChartVersion for the given name.
If version is empty, this will return the chart with the latest stable version, prerelease versions will be skipped.
func (IndexFile) Has ¶
Has returns true if the index has an entry for a chart with the given name and exact version.
func (*IndexFile) Merge ¶
Merge merges the given index file into this index.
This merges by name and version.
If one of the entries in the given index does _not_ already exist, it is added. In all other cases, the existing record is preserved.
This can leave the index in an unsorted state
func (IndexFile) MustAdd ¶
MustAdd adds a file to the index This can leave the index in an unsorted state
func (IndexFile) SortEntries ¶
func (i IndexFile) SortEntries()
SortEntries sorts the entries by version in descending order.
In canonical form, the individual version records should be sorted so that the most recent release for every version is in the 0th slot in the Entries.ChartVersions array. That way, tooling can predict the newest version without needing to parse SemVers.