helmutil

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2022 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultIndexFilePerm is default permissions for index file.
	DefaultIndexFilePerm = 0644
)

Variables

This section is empty.

Functions

func Digest added in v0.9.0

func Digest(in io.Reader) (string, error)

Digest hashes a reader and returns a SHA256 digest.

func DigestFile added in v0.9.0

func DigestFile(filename string) (string, error)

DigestFile calculates a SHA256 hash for a given file.

func IsHelm3 added in v0.9.0

func IsHelm3() bool

IsHelm3 returns true if helm is version 3+.

func SetupHelm added in v0.9.0

func SetupHelm()

Types

type Chart added in v0.9.0

type Chart interface {
	// Name returns chart name.
	// Example: "foo".
	Name() string

	// Version returns chart version.
	// Example: "0.1.0".
	Version() string

	// Metadata returns chart metadata.
	Metadata() ChartMetadata
}

Chart describes a helm chart.

func LoadArchive added in v0.9.0

func LoadArchive(r io.Reader) (Chart, error)

LoadArchive returns chart loaded from the archive file reader.

func LoadChart added in v0.9.0

func LoadChart(fpath string) (Chart, error)

LoadChart returns chart loaded from the file system by path.

type ChartMetadata added in v0.9.0

type ChartMetadata interface {
	// MarshalJSON marshals chart metadata to JSON.
	MarshalJSON() ([]byte, error)

	// UnmarshalJSON unmarshals chart metadata from JSON.
	UnmarshalJSON([]byte) error

	// Value returns underlying chart metadata value.
	Value() interface{}
}

ChartMetadata describes helm chart metadata.

func NewChartMetadata added in v0.9.0

func NewChartMetadata() ChartMetadata

NewChartMetadata returns a new helm chart metadata.

type ChartV2 added in v0.9.0

type ChartV2 struct {
	// contains filtered or unexported fields
}

ChartV2 implements Chart in Helm v2.

func (ChartV2) Metadata added in v0.9.0

func (c ChartV2) Metadata() ChartMetadata

func (ChartV2) Name added in v0.9.0

func (c ChartV2) Name() string

func (ChartV2) Version added in v0.9.0

func (c ChartV2) Version() string

type ChartV3 added in v0.9.0

type ChartV3 struct {
	// contains filtered or unexported fields
}

ChartV3 implements Chart in Helm v3.

func (ChartV3) Metadata added in v0.9.0

func (c ChartV3) Metadata() ChartMetadata

func (ChartV3) Name added in v0.9.0

func (c ChartV3) Name() string

func (ChartV3) Version added in v0.9.0

func (c ChartV3) Version() string

type Index added in v0.9.0

type Index interface {
	// Add adds chart version to the index.
	//
	// Note: this can leave the index in an unsorted state.
	Add(metadata interface{}, filename, baseURL, digest string) error

	// AddOrReplace adds chart version to the index, replacing the version if it exists instead
	// of adding it to the list of versions. Note that helm Add method does not control whether
	// the chart version exists, allowing for duplicates. This methods prevents duplicates
	// by replacing the chart.
	//
	// Note: this can leave the index in an unsorted state.
	AddOrReplace(metadata interface{}, filename, baseURL, digest string) error

	// Delete removes chart version from the index and returns url to the deleted item.
	Delete(name, version string) (url string, err error)

	// Has returns true if the index has an entry for a chart with the given name and exact version.
	Has(name, version string) bool

	// SortEntries sorts the entries by version in descending order.
	SortEntries()

	// MarshalBinary encodes index to a binary form.
	MarshalBinary() (data []byte, err error)

	// UnmarshalBinary decodes index from a binary form.
	UnmarshalBinary(b []byte) error

	// Reader returns io.Reader for index.
	Reader() (io.Reader, error)

	// WriteFile writes an index file to the given destination path.
	WriteFile(dest string, mode os.FileMode) error
}

Index describes helm chart repo index.

func LoadIndex added in v0.9.0

func LoadIndex(fpath string) (Index, error)

LoadIndex loads index from the file.

func NewIndex added in v0.9.0

func NewIndex() Index

NewIndex returns a new Index based either on Helm v2 or Helm v3.

type IndexV2 added in v0.9.0

type IndexV2 struct {
	// contains filtered or unexported fields
}

func (*IndexV2) Add added in v0.9.0

func (idx *IndexV2) Add(metadata interface{}, filename, baseURL, digest string) error

func (*IndexV2) AddOrReplace added in v0.9.0

func (idx *IndexV2) AddOrReplace(metadata interface{}, filename, baseURL, digest string) error

func (*IndexV2) Delete added in v0.9.0

func (idx *IndexV2) Delete(name, version string) (url string, err error)

func (*IndexV2) Has added in v0.9.0

func (idx *IndexV2) Has(name, version string) bool

func (*IndexV2) MarshalBinary added in v0.9.0

func (idx *IndexV2) MarshalBinary() (data []byte, err error)

func (*IndexV2) Reader added in v0.9.0

func (idx *IndexV2) Reader() (io.Reader, error)

func (*IndexV2) SortEntries added in v0.9.0

func (idx *IndexV2) SortEntries()

func (*IndexV2) UnmarshalBinary added in v0.9.0

func (idx *IndexV2) UnmarshalBinary(data []byte) error

func (*IndexV2) WriteFile added in v0.9.0

func (idx *IndexV2) WriteFile(dest string, mode os.FileMode) error

type IndexV3 added in v0.9.0

type IndexV3 struct {
	// contains filtered or unexported fields
}

func (*IndexV3) Add added in v0.9.0

func (idx *IndexV3) Add(metadata interface{}, filename, baseURL, digest string) error

func (*IndexV3) AddOrReplace added in v0.9.0

func (idx *IndexV3) AddOrReplace(metadata interface{}, filename, baseURL, digest string) error

func (*IndexV3) Delete added in v0.9.0

func (idx *IndexV3) Delete(name, version string) (url string, err error)

func (*IndexV3) Has added in v0.9.0

func (idx *IndexV3) Has(name, version string) bool

func (*IndexV3) MarshalBinary added in v0.9.0

func (idx *IndexV3) MarshalBinary() (data []byte, err error)

func (*IndexV3) Reader added in v0.9.0

func (idx *IndexV3) Reader() (io.Reader, error)

func (*IndexV3) SortEntries added in v0.9.0

func (idx *IndexV3) SortEntries()

func (*IndexV3) UnmarshalBinary added in v0.9.0

func (idx *IndexV3) UnmarshalBinary(data []byte) error

func (*IndexV3) WriteFile added in v0.9.0

func (idx *IndexV3) WriteFile(dest string, mode os.FileMode) error

type RepoEntry added in v0.9.0

type RepoEntry interface {
	// URL returns repo URL.
	// Examples:
	// - https://kubernetes-charts.storage.googleapis.com/
	// - s3://my-charts
	URL() string

	// IndexURI returns repo index file URL.
	// Examples:
	// - https://kubernetes-charts.storage.googleapis.com/index.yaml
	// - s3://my-charts/index.yaml
	IndexURL() string

	// CacheFile returns repo local cache file path.
	// Examples:
	// - /Users/foo/Library/Caches/helm/repository/my-charts-index.yaml (on macOS)
	// - /home/foo/.cache/helm/repository/my-charts-index.yaml (on Linux)
	CacheFile() string
}

func LookupRepoEntry

func LookupRepoEntry(name string) (RepoEntry, error)

LookupRepoEntry returns an entry from helm's repositories.yaml file by name.

type RepoEntryV2 added in v0.9.0

type RepoEntryV2 struct {
	// contains filtered or unexported fields
}

RepoEntryV2 implements RepoEntry in Helm v2.

func (RepoEntryV2) CacheFile added in v0.9.0

func (r RepoEntryV2) CacheFile() string

func (RepoEntryV2) IndexURL added in v0.9.0

func (r RepoEntryV2) IndexURL() string

func (RepoEntryV2) URL added in v0.9.0

func (r RepoEntryV2) URL() string

type RepoEntryV3 added in v0.9.0

type RepoEntryV3 struct {
	// contains filtered or unexported fields
}

RepoEntryV3 implements RepoEntry in Helm v3.

func (RepoEntryV3) CacheFile added in v0.9.0

func (r RepoEntryV3) CacheFile() string

func (RepoEntryV3) IndexURL added in v0.9.0

func (r RepoEntryV3) IndexURL() string

func (RepoEntryV3) URL added in v0.9.0

func (r RepoEntryV3) URL() string

Jump to

Keyboard shortcuts

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