helm

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2021 License: Apache-2.0 Imports: 19 Imported by: 5

Documentation

Index

Constants

View Source
const (
	// Version of the current Chartfile implementation
	Version = 1

	// Filename of the Chartfile
	Filename = "chartfile.yaml"

	// DefaultDir is the directory used for storing Charts if not specified
	// otherwise
	DefaultDir = "charts"
)
View Source
const DefaultNameFormat = `{{ print .kind "_" .metadata.name | snakecase }}`

DefaultNameFormat to use when no nameFormat is supplied

Variables

This section is empty.

Functions

func NativeFunc

func NativeFunc(h Helm) *jsonnet.NativeFunction

NativeFunc returns a jsonnet native function that provides the same functionality as `Helm.Template` of this package. Charts are required to be present on the local filesystem, at a relative location to the file that calls `helm.template()` / `std.native('helmTemplate')`. This guarantees hermeticity

Types

type Chartfile

type Chartfile struct {
	// Version of the Chartfile schema (for future use)
	Version uint `json:"version"`

	// Repositories to source from
	Repositories Repos `json:"repositories"`

	// Requires lists Charts expected to be present in the charts folder
	Requires Requirements `json:"requires"`

	// Folder to use for storing Charts. Defaults to 'charts'
	Directory string `json:"directory,omitempty"`
}

Chartfile is the schema used to declaratively define locally required Helm Charts

type Charts

type Charts struct {
	// Manifest are the chartfile.yaml contents. It holds data about the developers intentions
	Manifest Chartfile

	// Helm is the helm implementation underneath. ExecHelm is the default, but
	// any implementation of the Helm interface may be used
	Helm Helm
	// contains filtered or unexported fields
}

Charts exposes the central Chartfile management functions

func InitChartfile

func InitChartfile(path string) (*Charts, error)

func LoadChartfile

func LoadChartfile(projectRoot string) (*Charts, error)

LoadChartfile opens a Chartfile tree

func (*Charts) Add

func (c *Charts) Add(reqs []string) error

Add adds every Chart in reqs to the Manifest after validation, and runs Vendor afterwards

func (*Charts) AddRepos added in v0.14.0

func (c *Charts) AddRepos(repos ...Repo) error

func (Charts) ChartDir

func (c Charts) ChartDir() string

ChartDir returns the directory pulled charts are saved in

func (Charts) ManifestFile

func (c Charts) ManifestFile() string

ManifestFile returns the full path to the chartfile.yaml

func (Charts) Vendor

func (c Charts) Vendor() error

Vendor pulls all Charts specified in the manifest into the local charts directory. It fetches the repository index before doing so.

type ExecHelm

type ExecHelm struct{}

ExecHelm is a Helm implementation powered by the `helm` command line utility

func (ExecHelm) Pull

func (e ExecHelm) Pull(chart, version string, opts PullOpts) error

Pull implements Helm.Pull

func (ExecHelm) RepoUpdate

func (e ExecHelm) RepoUpdate(opts Opts) error

RepoUpdate implements Helm.RepoUpdate

func (ExecHelm) Template

func (h ExecHelm) Template(name, chart string, opts TemplateOpts) (manifest.List, error)

Template expands a Helm Chart into a regular manifest.List using the `helm template` command

type Helm

type Helm interface {
	// Pull downloads a Helm Chart from a remote
	Pull(chart, version string, opts PullOpts) error

	// RepoUpdate fetches the latest remote index
	RepoUpdate(opts Opts) error

	// Template returns the individual resources of a Helm Chart
	Template(name, chart string, opts TemplateOpts) (manifest.List, error)
}

Helm provides high level access to some Helm operations

type JsonnetOpts

type JsonnetOpts struct {
	TemplateOpts

	// CalledFrom is the file that calls helmTemplate. This is used to find the
	// vendored chart relative to this file
	CalledFrom string `json:"calledFrom"`
	// NameTemplate is used to create the keys in the resulting map
	NameFormat string `json:"nameFormat"`
}

JsonnetOpts are additional properties the consumer of the native func might pass.

type Opts

type Opts struct {
	Repositories []Repo
}

Opts are additional, non-required options that all Helm operations accept

type PullOpts

type PullOpts struct {
	Opts

	// Directory to put the resulting .tgz into
	Destination string
}

PullOpts are additional, non-required options for Helm.Pull

type Repo

type Repo struct {
	Name     string `json:"name,omitempty"`
	URL      string `json:"url,omitempty"`
	CAFile   string `json:"caFile,omitempty"`
	CertFile string `json:"certFile,omitempty"`
	KeyFile  string `json:"keyFile,omitempty"`
	Username string `json:"username,omitempty"`
	Password string `json:"password,omitempty"`
}

Repo describes a single Helm repository

type Repos added in v0.14.0

type Repos []Repo

func (Repos) Has added in v0.14.0

func (r Repos) Has(repo Repo) bool

Has reports whether 'repo' is already part of the repositories

type Requirement

type Requirement struct {
	Chart   string         `json:"chart"`
	Version semver.Version `json:"version"`
}

Requirement describes a single required Helm Chart. Both, Chart and Version are required

type Requirements

type Requirements []Requirement

Requirements is an aggregate of all required Charts

func (Requirements) Has

func (r Requirements) Has(req Requirement) bool

Has reports whether 'req' is already part of the requirements

type TemplateOpts

type TemplateOpts struct {
	// Values to pass to Helm using --values
	Values map[string]interface{}

	// Kubernetes api versions used for Capabilities.APIVersions
	APIVersions []string
	// IncludeCRDs specifies whether CustomResourceDefinitions are included in
	// the template output
	IncludeCRDs bool
	// Namespace scope for this request
	Namespace string
	// NoHooks specifies whether hooks should be excluded from the template output
	NoHooks bool
}

TemplateOpts are additional, non-required options for Helm.Template

func (TemplateOpts) Flags

func (t TemplateOpts) Flags() []string

Flags returns all options apart from Values as their respective `helm template` flag equivalent

Jump to

Keyboard shortcuts

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