downloader

package
v2.0.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2016 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

This section is empty.

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
}

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.

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, error)

ResolveChartVersion resolves a chart reference to a 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
	// Keyring is the key ring file.
	Keyring string
}

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()

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.

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
)

Jump to

Keyboard shortcuts

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