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
- Variables
- func Expand(dir string, r io.Reader) error
- func Save(c *Chart, outDir string) (string, error)
- type Chart
- func (c *Chart) ChartDepNames() ([]string, error)
- func (c *Chart) Chartfile() *Chartfile
- func (c *Chart) ChartsDir() string
- func (c *Chart) Close() error
- func (c *Chart) Dir() string
- func (c *Chart) LoadContent() (*Content, error)
- func (c *Chart) LoadMember(path string) (*Member, error)
- func (c *Chart) LoadTemplates() ([]*Member, error)
- func (c *Chart) LoadValues() (Values, error)
- func (c *Chart) TemplatesDir() string
- type Chartfile
- type Content
- type Maintainer
- type Member
- type Values
Examples ¶
Constants ¶
const ChartfileName string = "Chart.yaml"
ChartfileName is the default Chart file name.
Variables ¶
ErrNoTable indicates that a chart does not have a matching table.
Functions ¶
func Expand ¶
Expand uncompresses and extracts a chart into the specified directory.
func Save ¶
Save creates an archived chart to the given directory.
This takes an existing chart and a destination directory.
If the directory is /foo, and the chart is named bar, with version 1.0.0, this will generate /foo/bar-1.0.0.tgz.
This returns the absolute path to the chart archive file.
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 LoadChart ¶
LoadChart loads an entire chart archive.
The following are valid values for 'chfi':
- relative path to the chart archive
- absolute path to the chart archive
- name of the chart directory
func LoadData ¶
LoadData loads a chart from data, where data is a []byte containing a gzipped tar file.
func LoadDataFromReader ¶
LoadDataFromReader loads a chart from a reader
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) ChartDepNames ¶
ChartDepNames returns the list of chart names found in ChartsDir.
func (*Chart) Chartfile ¶
Chartfile gets the Chartfile (Chart.yaml) for this chart.
func (*Chart) ChartsDir ¶
ChartsDir returns the directory where dependency charts are stored.
func (*Chart) Dir ¶
Dir returns the directory where the charts are located.
func (*Chart) LoadContent ¶
LoadContent loads contents of a chart directory into Content
func (*Chart) LoadMember ¶
LoadMember loads a chart member from a given path where path is the root of the chart.
func (*Chart) LoadTemplates ¶
LoadTemplates loads the members of TemplatesDir().
func (*Chart) LoadValues ¶
LoadValues loads the contents of values.toml into a map
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:"sources,omitempty"`
Home string `yaml:"home"`
}
Chartfile describes a Helm Chart (e.g. Chart.yaml)
func LoadChartfile ¶
LoadChartfile loads a Chart.yaml file into a *Chart.
func (*Chartfile) Marshal ¶
Marshal encodes the chart file into YAML.
type Content ¶
Content is abstraction for the contents of a chart.
type Maintainer ¶
Maintainer describes a chart maintainer.
type Member ¶
type Member struct {
Path string `json:"path"` // Path from the root of the chart.
Content []byte `json:"content"` // Base64 encoded content.
}
Member is a file in a chart.
type Values ¶
type Values map[string]interface{}
Values represents a collection of chart values.
Example ¶
doc := `title="Moby Dick"
[chapter.one]
title = "Loomings"
[chapter.two]
title = "The Carpet-Bag"
[chapter.three]
title = "The Spouter Inn"
`
d, err := ReadValues([]byte(doc))
if err != nil {
panic(err)
}
ch1, err := d.Table("chapter.one")
if err != nil {
panic("could not find chapter one")
}
fmt.Print(ch1["title"])
Output: Loomings
func ReadValues ¶
ReadValues will parse TOML byte data into a Values.
func ReadValuesFile ¶
ReadValuesFile will parse a TOML file into a Values.
func (Values) Encode ¶
Encode writes serialized Values information to the given io.Writer.
func (Values) Table ¶
Table gets a table (TOML subsection) from a Values object.
The table is returned as a Values.
Compound table names may be specified with dots:
foo.bar
The above will be evaluated as "The table bar inside the table foo".
An ErrNoTable is returned if the table does not exist.
Source Files
¶
- chart.go
- chartfile.go
- doc.go
- save.go
- values.go