Documentation ¶
Overview ¶
Package chart implements the Chart format.
This package provides tools for working with the Chart format, including the Chartfile (chart.yaml) and compressed chart archives.
Index ¶
Constants ¶
const ( SchemeHTTP = "http" SchemeHTTPS = "https" SchemeHelm = "helm" SchemeFile = "file" )
Constants defining recognized URL schemes.
const ChartfileName string = "Chart.yaml"
ChartfileName is the default Chart file name.
const TarNameRegex = `([0-9A-Za-z\-_/]+)-(v?([0-9]+)(\.[0-9]+)?(\.[0-9]+)?` +
`(-([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?` +
`(\+([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?)(.tgz)?`
TarNameRegex parses the name component of a URI and breaks it into a name and version.
This borrows liberally from github.com/Masterminds/semver.
Variables ¶
var ErrLocal = errors.New("cannot use local Locator as remote")
ErrLocal indicates that a local URL was used as a remote URL.
var ErrRemote = errors.New("cannot use remote Locator as local")
ErrRemote indicates that a remote URL was used as a local URL.
Functions ¶
Types ¶
type Chart ¶
type Chart struct {
// contains filtered or unexported fields
}
Chart represents a complete chart.
A chart consists of the following parts:
- Chart.yaml: In code, we refer to this as the Chartfile
- templates/*: The template directory
- README.md: Optional README file
- LICENSE: Optional license file
- hooks/: Optional hooks registry
- docs/: Optional docs directory
Packed charts are stored in gzipped tar archives (.tgz). Unpackaged charts are directories where the directory name is the Chartfile.Name.
Optionally, a chart might also locate a provenance (.prov) file that it can use for cryptographic signing.
func Create ¶
Create creates a new chart in a directory.
Inside of dir, this will create a directory based on the name of chartfile.Name. It will then write the Chart.yaml into this directory and create the (empty) appropriate directories.
The returned *Chart will point to the newly created directory.
If dir does not exist, this will return an error. If Chart.yaml or any directories cannot be created, this will return an error. In such a case, this will attempt to clean up by removing the new chart directory.
func Load ¶
Load loads a chart from a chart archive.
A chart archive is a gzipped tar archive that follows the Chart format specification.
func LoadData ¶
LoadData loads a chart from data, where data is a []byte containing a gzipped tar file.
func LoadDir ¶
LoadDir loads an entire chart from a directory.
This includes the Chart.yaml (*Chartfile) and all of the manifests.
If you are just reading the Chart.yaml file, it is substantially more performant to use LoadChartfile.
func (*Chart) Icon ¶
Icon returns the path to the icon.svg file.
If an icon is not found in the chart, this will return an error.
func (*Chart) TemplatesDir ¶
TemplatesDir returns the directory where the templates are stored.
type Chartfile ¶
type Chartfile struct { Name string `yaml:"name"` Description string `yaml:"description"` Version string `yaml:"version"` Keywords []string `yaml:"keywords,omitempty"` Maintainers []*Maintainer `yaml:"maintainers,omitempty"` Source []string `yaml:"source,omitempty"` Home string `yaml:"home"` Dependencies []*Dependency `yaml:"dependencies,omitempty"` Environment []*EnvConstraint `yaml:"environment,omitempty"` }
Chartfile describes a Helm Chart (e.g. Chart.yaml)
func LoadChartfile ¶
LoadChartfile loads a Chart.yaml file into a *Chart.
type Dependency ¶
type Dependency struct { Name string `yaml:"name,omitempty"` Version string `yaml:"version"` Location string `yaml:"location"` }
Dependency describes a specific dependency.
func (*Dependency) VersionOK ¶
func (d *Dependency) VersionOK(version string) bool
VersionOK returns true if the given version meets the constraints.
It returns false if the version string or constraint is unparsable or if the version does not meet the constraint.
type EnvConstraint ¶
type EnvConstraint struct { Name string `yaml:"name"` Version string `yaml:"version"` Extensions []string `yaml:"extensions,omitempty"` APIGroups []string `yaml:"apiGroups,omitempty"` }
EnvConstraint specifies environmental constraints.
type Locator ¶
type Locator struct { // The scheme of the URL. Typically one of http, https, helm, or file. Scheme string // The host information, if applicable. Host string // The bucket name Bucket string // The chart name Name string // The version or version range. Version string // If this is a local chart, the path to the chart. LocalRef string // contains filtered or unexported fields }
Locator describes the location of a Chart.
func (*Locator) Local ¶
Local returns a local version of the path.
This will return an error if the URL does not reference a local chart.
type Maintainer ¶
Maintainer describes a chart maintainer.