downloader

package
v2.10.0-rancher3+incom... Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2018 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package downloader provides a library for downloading charts.

This package contains various tools for downloading charts from repository servers, and then storing them in Helm-specific directory structures (like HELM_HOME). This library contains many functions that depend on a specific filesystem layout.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoOwnerRepo = errors.New("could not find a repo containing the given URL")

ErrNoOwnerRepo indicates that a given chart URL can't be found in any repos.

Functions

func VerifyChart

func VerifyChart(path string, keyring string) (*provenance.Verification, error)

VerifyChart takes a path to a chart archive and a keyring, and verifies the chart.

It assumes that a chart archive file is accompanied by a provenance file whose name is the archive file name plus the ".prov" extension.

Types

type ChartDownloader

type ChartDownloader struct {
	// Out is the location to write warning and info messages.
	Out io.Writer
	// Verify indicates what verification strategy to use.
	Verify VerificationStrategy
	// Keyring is the keyring file used for verification.
	Keyring string
	// HelmHome is the $HELM_HOME.
	HelmHome helmpath.Home
	// Getter collection for the operation
	Getters getter.Providers
	// Chart repository username
	Username string
	// Chart repository password
	Password string
}

ChartDownloader handles downloading a chart.

It is capable of performing verifications on charts as well.

func (*ChartDownloader) DownloadTo

func (c *ChartDownloader) DownloadTo(ref, version, dest string) (string, *provenance.Verification, error)

DownloadTo retrieves a chart. Depending on the settings, it may also download a provenance file.

If Verify is set to VerifyNever, the verification will be nil. If Verify is set to VerifyIfPossible, this will return a verification (or nil on failure), and print a warning on failure. If Verify is set to VerifyAlways, this will return a verification or an error if the verification fails. If Verify is set to VerifyLater, this will download the prov file (if it exists), but not verify it.

For VerifyNever and VerifyIfPossible, the Verification may be empty.

Returns a string path to the location where the file was downloaded and a verification (if provenance was verified), or an error if something bad happened.

func (*ChartDownloader) ResolveChartVersion

func (c *ChartDownloader) ResolveChartVersion(ref, version string) (*url.URL, getter.Getter, error)

ResolveChartVersion resolves a chart reference to a URL.

It returns the URL as well as a preconfigured repo.Getter that can fetch the URL.

A reference may be an HTTP URL, a 'reponame/chartname' reference, or a local path.

A version is a SemVer string (1.2.3-beta.1+f334a6789).

  • For fully qualified URLs, the version will be ignored (since URLs aren't versioned)
  • For a chart reference
  • If version is non-empty, this will return the URL for that version
  • If version is empty, this will return the URL for the latest version
  • If no version can be found, an error is returned

type Manager

type Manager struct {
	// Out is used to print warnings and notifications.
	Out io.Writer
	// ChartPath is the path to the unpacked base chart upon which this operates.
	ChartPath string
	// HelmHome is the $HELM_HOME directory
	HelmHome helmpath.Home
	// Verification indicates whether the chart should be verified.
	Verify VerificationStrategy
	// Debug is the global "--debug" flag
	Debug bool
	// Keyring is the key ring file.
	Keyring string
	// SkipUpdate indicates that the repository should not be updated first.
	SkipUpdate bool
	// Getter collection for the operation
	Getters []getter.Provider
}

Manager handles the lifecycle of fetching, resolving, and storing dependencies.

func (*Manager) Build

func (m *Manager) Build() error

Build rebuilds a local charts directory from a lockfile.

If the lockfile is not present, this will run a Manager.Update()

If SkipUpdate is set, this will not update the repository.

func (*Manager) Update

func (m *Manager) Update() error

Update updates a local charts directory.

It first reads the requirements.yaml file, and then attempts to negotiate versions based on that. It will download the versions from remote chart repositories unless SkipUpdate is true.

func (*Manager) UpdateRepositories

func (m *Manager) UpdateRepositories() error

UpdateRepositories updates all of the local repos to the latest.

type VerificationStrategy

type VerificationStrategy int

VerificationStrategy describes a strategy for determining whether to verify a chart.

const (
	// VerifyNever will skip all verification of a chart.
	VerifyNever VerificationStrategy = iota
	// VerifyIfPossible will attempt a verification, it will not error if verification
	// data is missing. But it will not stop processing if verification fails.
	VerifyIfPossible
	// VerifyAlways will always attempt a verification, and will fail if the
	// verification fails.
	VerifyAlways
	// VerifyLater will fetch verification data, but not do any verification.
	// This is to accommodate the case where another step of the process will
	// perform verification.
	VerifyLater
)

Jump to

Keyboard shortcuts

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