Documentation ¶
Index ¶
- Constants
- Variables
- func AppendMyValues(valueFiles []string) ([]string, error)
- func CombineValueFilesToFile(outFile string, inputFiles []string, chartName string, ...) error
- func FindChartFileName(dir string) (string, error)
- func FindRequirementsFileName(dir string) (string, error)
- func FindTemplatesDirName(dir string) (string, error)
- func FindValuesFileName(dir string) (string, error)
- func GenerateReadmeForChart(name string, version string, description string, chartRepo string, ...) string
- func GenerateValues(dir string, ignores []string, verbose bool) ([]byte, error)
- func GetLatestVersion(chart string, repo string, username string, password string, helmer Helmer) (string, error)
- func GetTillerAddress() string
- func HandleExternalFileRefs(element interface{}, possibles map[string]string, jsonPath string, ...) error
- func InspectChart(chart string, version string, repo string, username string, password string, ...) error
- func InstallFromChartOptions(options InstallChartOptions, helmer Helmer, kubeClient kubernetes.Interface, ...) error
- func LoadChart(data []byte) (*chart.Metadata, error)
- func LoadChartFile(fileName string) (*chart.Metadata, error)
- func LoadChartName(chartFile string) (string, error)
- func LoadChartNameAndVersion(chartFile string) (string, string, error)
- func LoadTemplatesDir(dirName string) (map[string]string, error)
- func LoadValues(data []byte) (map[string]interface{}, error)
- func LoadValuesFile(fileName string) (map[string]interface{}, error)
- func ModifyChart(chartFile string, fn func(chart *chart.Metadata) error) error
- func RestartLocalTiller() error
- func SaveFile(fileName string, contents interface{}) error
- func SetChartVersion(chartFile string, version string) error
- func SetValuesToMap(setValues []string) map[string]interface{}
- func StartLocalTiller(lazy bool) error
- func StartLocalTillerIfNotRunning() error
- type ChartListing
- type ChartSummary
- type DepSorter
- type Dependency
- type ErrNoRequirementsFile
- type HelmCLI
- func (h *HelmCLI) AddRepo(repo, URL, username, password string) error
- func (h *HelmCLI) BuildDependency() error
- func (h *HelmCLI) DecryptSecrets(location string) error
- func (h *HelmCLI) DeleteRelease(ns string, releaseName string, purge bool) error
- func (h *HelmCLI) Env() map[string]string
- func (h *HelmCLI) FetchChart(chart string, version string, untar bool, untardir string, repo string, ...) error
- func (h *HelmCLI) FindChart() (string, error)
- func (h *HelmCLI) HelmBinary() string
- func (h *HelmCLI) Init(clientOnly bool, serviceAccount string, tillerNamespace string, upgrade bool) error
- func (h *HelmCLI) InstallChart(chart string, releaseName string, ns string, version string, timeout int, ...) error
- func (h *HelmCLI) IsRepoMissing(URL string) (bool, error)
- func (h *HelmCLI) Lint() (string, error)
- func (h *HelmCLI) ListCharts() (string, error)
- func (h *HelmCLI) ListRepos() (map[string]string, error)
- func (h *HelmCLI) PackageChart() error
- func (h *HelmCLI) RemoveRepo(repo string) error
- func (h *HelmCLI) RemoveRequirementsLock() error
- func (h *HelmCLI) SearchChartVersions(chart string) ([]string, error)
- func (h *HelmCLI) SearchCharts(filter string) ([]ChartSummary, error)
- func (h *HelmCLI) SetCWD(dir string)
- func (h *HelmCLI) SetHelmBinary(binary string)
- func (h *HelmCLI) SetHost(tillerAddress string)
- func (h *HelmCLI) StatusRelease(ns string, releaseName string) error
- func (h *HelmCLI) StatusReleases(ns string) (map[string]Release, error)
- func (h *HelmCLI) Template(chart string, releaseName string, ns string, outDir string, upgrade bool, ...) error
- func (h *HelmCLI) UpdateRepo() error
- func (h *HelmCLI) UpgradeChart(chart string, releaseName string, ns string, version string, install bool, ...) error
- func (h *HelmCLI) Version(tls bool) (string, error)
- func (h *HelmCLI) VersionWithArgs(tls bool, extraArgs ...string) (string, error)
- type HelmHook
- type HelmTemplate
- func (h *HelmTemplate) AddRepo(repo, URL, username, password string) error
- func (h *HelmTemplate) BuildDependency() error
- func (h *HelmTemplate) DecryptSecrets(location string) error
- func (h *HelmTemplate) DeleteRelease(ns string, releaseName string, purge bool) error
- func (h *HelmTemplate) Env() map[string]string
- func (h *HelmTemplate) FetchChart(chart string, version string, untar bool, untardir string, repo string, ...) error
- func (h *HelmTemplate) FindChart() (string, error)
- func (h *HelmTemplate) HelmBinary() string
- func (h *HelmTemplate) Init(clientOnly bool, serviceAccount string, tillerNamespace string, upgrade bool) error
- func (h *HelmTemplate) InstallChart(chart string, releaseName string, ns string, version string, timeout int, ...) error
- func (h *HelmTemplate) IsRepoMissing(URL string) (bool, error)
- func (h *HelmTemplate) Lint() (string, error)
- func (h *HelmTemplate) ListCharts() (string, error)
- func (h *HelmTemplate) ListRepos() (map[string]string, error)
- func (h *HelmTemplate) PackageChart() error
- func (h *HelmTemplate) RemoveRepo(repo string) error
- func (h *HelmTemplate) RemoveRequirementsLock() error
- func (h *HelmTemplate) SearchChartVersions(chart string) ([]string, error)
- func (h *HelmTemplate) SearchCharts(filter string) ([]ChartSummary, error)
- func (h *HelmTemplate) SetCWD(dir string)
- func (h *HelmTemplate) SetHelmBinary(binary string)
- func (h *HelmTemplate) SetHost(tillerAddress string)
- func (h *HelmTemplate) StatusRelease(ns string, releaseName string) error
- func (h *HelmTemplate) StatusReleases(ns string) (map[string]Release, error)
- func (h *HelmTemplate) Template(chart string, releaseName string, ns string, outDir string, upgrade bool, ...) error
- func (h *HelmTemplate) UpdateRepo() error
- func (h *HelmTemplate) UpgradeChart(chart string, releaseName string, ns string, version string, install bool, ...) error
- func (h *HelmTemplate) Version(tls bool) (string, error)
- type Helmer
- type InstallChartOptions
- type Release
- type Requirements
- type Version
Constants ¶
const ( // ChartFileName file name for a chart ChartFileName = "Chart.yaml" // RequirementsFileName the file name for helm requirements RequirementsFileName = "requirements.yaml" // SecretsFileName the file name for secrets SecretsFileName = "secrets.yaml" // ValuesFileName the file name for values ValuesFileName = "values.yaml" // TemplatesDirName is the default name for the templates directory TemplatesDirName = "templates" // DefaultHelmRepositoryURL is the default cluster local helm repo DefaultHelmRepositoryURL = "http://jenkins-x-chartmuseum:8080" )
const ( // AnnotationChartName stores the chart name AnnotationChartName = "jenkins.io/chart" // AnnotationAppVersion stores the chart's app version AnnotationAppVersion = "jenkins.io/chart-app-version" // AnnotationAppDescription stores the chart's app version AnnotationAppDescription = "jenkins.io/chart-description" // AnnotationAppRepository stores the chart's app repository AnnotationAppRepository = "jenkins.io/chart-repository" // LabelReleaseName stores the chart release name LabelReleaseName = "jenkins.io/chart-release" // LabelNamespace stores the chart namespace for cluster wide resources LabelNamespace = "jenkins.io/namespace" // LabelReleaseChartVersion stores the version of a chart installation in a label LabelReleaseChartVersion = "jenkins.io/version" // LabelAppName stores the chart's app name LabelAppName = "jenkins.io/app-name" // LabelAppVersion stores the chart's app version LabelAppVersion = "jenkins.io/app-version" )
Variables ¶
var DefaultValuesTreeIgnores = []string{
"templates/*",
}
DefaultValuesTreeIgnores is the default set of ignored files for collapsing the values tree which are used if ignores is nil
Functions ¶
func AppendMyValues ¶
func CombineValueFilesToFile ¶
func CombineValueFilesToFile(outFile string, inputFiles []string, chartName string, extraValues map[string]interface{}) error
CombineValueFilesToFile iterates through the input files and combines them into a single Values object and then write it to the output file nested inside the chartName
func FindChartFileName ¶
FindChartFileName returns the default chart.yaml file name
func FindRequirementsFileName ¶
FindRequirementsFileName returns the default requirements.yaml file name
func FindTemplatesDirName ¶
FindTemplatesDirName returns the default templates/ dir name
func FindValuesFileName ¶
FindValuesFileName returns the default values.yaml file name
func GenerateReadmeForChart ¶
func GenerateReadmeForChart(name string, version string, description string, chartRepo string, gitRepo string, releaseNotesURL string, appReadme string) string
GenerateReadmeForChart generates a string that can be used as a README.MD, and includes info on the chart.
func GenerateValues ¶
GenerateValues will generate a values.yaml file in dir. It scans all subdirectories for values.yaml files, and merges them into the values.yaml in the root directory, creating a nested key structure that matches the directory structure. Any keys used that match files with the same name in the directory ( and have empty values) will be inlined as block scalars. Standard UNIX glob patterns can be passed to IgnoreFile directories.
func GetLatestVersion ¶
func GetLatestVersion(chart string, repo string, username string, password string, helmer Helmer) (string, error)
GetLatestVersion get's the latest version of a chart in a repo using helmer
func GetTillerAddress ¶ added in v1.3.875
func GetTillerAddress() string
GetTillerAddress returns the address that tiller is listening on
func HandleExternalFileRefs ¶
func HandleExternalFileRefs(element interface{}, possibles map[string]string, jsonPath string, handler func(path string, element map[string]interface{}, key string) error) error
HandleExternalFileRefs recursively scans the element map structure, looking for nested maps. If it finds keys that match any key-value pair in possibles it will call the handler. The jsonPath is used for referencing the path in the map structure when reporting errors.
func InspectChart ¶
func InspectChart(chart string, version string, repo string, username string, password string, helmer Helmer, inspector func(dir string) error) error
InspectChart fetches the specified chart in a repo using helmer, and then calls the closure on it, before cleaning up
func InstallFromChartOptions ¶
func InstallFromChartOptions(options InstallChartOptions, helmer Helmer, kubeClient kubernetes.Interface, installTimeout string) error
InstallFromChartOptions uses the helmer and kubeClient interfaces to install the chart from the options, respeciting the installTimeout
func LoadChartFile ¶
LoadChartFile loads the chart file or creates empty chart if the file does not exist
func LoadChartName ¶
func LoadChartNameAndVersion ¶
func LoadTemplatesDir ¶
LoadTemplatesDir loads the files in the templates dir or creates empty map if none exist
func LoadValues ¶
LoadValues loads the values from some data
func LoadValuesFile ¶
LoadValuesFile loads the values file or creates empty map if the file does not exist
func ModifyChart ¶
ModifyChart modifies the given chart using a callback
func RestartLocalTiller ¶ added in v1.3.875
func RestartLocalTiller() error
RestartLocalTiller resttarts locall tiller
func SetChartVersion ¶
SetChartVersion modifies the given chart file to update the version
func SetValuesToMap ¶ added in v1.3.908
SetValuesToMap converts the set of values of the form "foo.bar=123" into a helm values.yaml map structure
func StartLocalTiller ¶ added in v1.3.875
StartLocalTiller starts local tiller server
func StartLocalTillerIfNotRunning ¶ added in v1.3.875
func StartLocalTillerIfNotRunning() error
StartLocalTillerIfNotRunning starts local tiller if not running
Types ¶
type ChartListing ¶
type ChartSummary ¶
type DepSorter ¶
type DepSorter []*Dependency
DepSorter Used to avoid merge conflicts by sorting deps by name
type Dependency ¶
type Dependency struct { // Name is the name of the dependency. // // This must mach the name in the dependency's Chart.yaml. Name string `json:"name"` // Version is the version (range) of this chart. // // A lock file will always produce a single version, while a dependency // may contain a semantic version range. Version string `json:"version,omitempty"` // The URL to the repository. // // Appending `index.yaml` to this string should result in a URL that can be // used to fetch the repository index. Repository string `json:"repository"` // A yaml path that resolves to a boolean, used for enabling/disabling charts (e.g. subchart1.enabled ) Condition string `json:"condition,omitempty"` // Tags can be used to group charts for enabling/disabling together Tags []string `json:"tags,omitempty"` // Enabled bool determines if chart should be loaded Enabled bool `json:"enabled,omitempty"` // ImportValues holds the mapping of source values to parent key to be imported. Each item can be a // string or pair of child/parent sublist items. ImportValues []interface{} `json:"import-values,omitempty"` // Alias usable alias to be used for the chart Alias string `json:"alias,omitempty"` }
Dependency describes a chart upon which another chart depends.
Dependencies can be used to express developer intent, or to capture the state of a chart.
type ErrNoRequirementsFile ¶
type ErrNoRequirementsFile error
ErrNoRequirementsFile to detect error condition
type HelmCLI ¶
type HelmCLI struct { Binary string BinVersion Version CWD string Runner util.Commander Debug bool }
HelmCLI implements common helm actions based on helm CLI
func NewHelmCLI ¶
NewHelmCLI creates a new HelmCLI instance configured to use the provided helm CLI in the given current working directory
func NewHelmCLIWithRunner ¶
func NewHelmCLIWithRunner(runner util.Commander, binary string, version Version, cwd string, debug bool) *HelmCLI
NewHelmCLIWithRunner creaets a new HelmCLI interface for the given runner
func (*HelmCLI) BuildDependency ¶
BuildDependency builds the helm dependencies of the helm chart from the current working directory
func (*HelmCLI) DecryptSecrets ¶
func (*HelmCLI) DeleteRelease ¶
DeleteRelease removes the given release
func (*HelmCLI) FetchChart ¶
func (h *HelmCLI) FetchChart(chart string, version string, untar bool, untardir string, repo string, username string, password string) error
FetchChart fetches a Helm Chart
func (*HelmCLI) FindChart ¶
FindChart find a chart in the current working directory, if no chart file is found an error is returned
func (*HelmCLI) HelmBinary ¶
HelmBinary return the configured helm CLI
func (*HelmCLI) Init ¶
func (h *HelmCLI) Init(clientOnly bool, serviceAccount string, tillerNamespace string, upgrade bool) error
Init executes the helm init command according with the given flags
func (*HelmCLI) InstallChart ¶
func (h *HelmCLI) InstallChart(chart string, releaseName string, ns string, version string, timeout int, values []string, valueFiles []string, repo string, username string, password string) error
InstallChart installs a helm chart according with the given flags
func (*HelmCLI) IsRepoMissing ¶
IsRepoMissing checks if the repository with the given URL is missing from helm
func (*HelmCLI) Lint ¶
Lint lints the helm chart from the current working directory and returns the warnings in the output
func (*HelmCLI) ListCharts ¶
ListCharts execute the helm list command and returns its output
func (*HelmCLI) PackageChart ¶
PackageChart packages the chart from the current working directory
func (*HelmCLI) RemoveRepo ¶
RemoveRepo removes the given repo from helm
func (*HelmCLI) RemoveRequirementsLock ¶
RemoveRequirementsLock removes the requirements.lock file from the current working directory
func (*HelmCLI) SearchChartVersions ¶
SearchChartVersions search all version of the given chart
func (*HelmCLI) SearchCharts ¶
func (h *HelmCLI) SearchCharts(filter string) ([]ChartSummary, error)
SearchCharts searches for all the charts matching the given filter
func (*HelmCLI) SetHelmBinary ¶
SetHelmBinary configure a new helm CLI
func (*HelmCLI) StatusRelease ¶
StatusRelease returns the output of the helm status command for a given release
func (*HelmCLI) StatusReleases ¶
StatusReleases returns the status of all installed releases
func (*HelmCLI) Template ¶
func (h *HelmCLI) Template(chart string, releaseName string, ns string, outDir string, upgrade bool, values []string, valueFiles []string) error
Template generates the YAML from the chart template to the given directory
func (*HelmCLI) UpdateRepo ¶
UpdateRepo updates the helm repositories
func (*HelmCLI) UpgradeChart ¶
func (h *HelmCLI) UpgradeChart(chart string, releaseName string, ns string, version string, install bool, timeout int, force bool, wait bool, values []string, valueFiles []string, repo string, username string, password string, reuseValues bool) error
UpgradeChart upgrades a helm chart according with given helm flags reuseValues true if values from a previous install should be merged with the given values and valueFiles
type HelmHook ¶
type HelmHook struct { Kind string Name string File string Hooks []string HookDeletePolicies []string }
func MatchingHooks ¶
MatchingHooks returns the matching files which have the given hook name and if hookPolicy is not blank the hook policy too
type HelmTemplate ¶
type HelmTemplate struct { Client *HelmCLI WorkDir string CWD string Binary string Runner util.Commander KubectlValidate bool KubeClient kubernetes.Interface Namespace string }
HelmTemplate implements common helm actions but purely as client side operations delegating a separate Helmer such as HelmCLI for the client side operations
func NewHelmTemplate ¶
func NewHelmTemplate(client *HelmCLI, workDir string, kubeClient kubernetes.Interface, ns string) *HelmTemplate
NewHelmTemplate creates a new HelmTemplate instance configured to the given client side Helmer
func (*HelmTemplate) AddRepo ¶
func (h *HelmTemplate) AddRepo(repo, URL, username, password string) error
AddRepo adds a new helm repo with the given name and URL
func (*HelmTemplate) BuildDependency ¶
func (h *HelmTemplate) BuildDependency() error
BuildDependency builds the helm dependencies of the helm chart from the current working directory
func (*HelmTemplate) DecryptSecrets ¶
func (h *HelmTemplate) DecryptSecrets(location string) error
func (*HelmTemplate) DeleteRelease ¶
func (h *HelmTemplate) DeleteRelease(ns string, releaseName string, purge bool) error
DeleteRelease removes the given release
func (*HelmTemplate) Env ¶
func (h *HelmTemplate) Env() map[string]string
Env returns the environment variables for the helmer
func (*HelmTemplate) FetchChart ¶
func (h *HelmTemplate) FetchChart(chart string, version string, untar bool, untardir string, repo string, username string, password string) error
FetchChart fetches a Helm Chart
func (*HelmTemplate) FindChart ¶
func (h *HelmTemplate) FindChart() (string, error)
FindChart find a chart in the current working directory, if no chart file is found an error is returned
func (*HelmTemplate) HelmBinary ¶
func (h *HelmTemplate) HelmBinary() string
HelmBinary return the configured helm CLI
func (*HelmTemplate) Init ¶
func (h *HelmTemplate) Init(clientOnly bool, serviceAccount string, tillerNamespace string, upgrade bool) error
Init executes the helm init command according with the given flags
func (*HelmTemplate) InstallChart ¶
func (h *HelmTemplate) InstallChart(chart string, releaseName string, ns string, version string, timeout int, values []string, valueFiles []string, repo string, username string, password string) error
InstallChart installs a helm chart according with the given flags
func (*HelmTemplate) IsRepoMissing ¶
func (h *HelmTemplate) IsRepoMissing(URL string) (bool, error)
IsRepoMissing checks if the repository with the given URL is missing from helm
func (*HelmTemplate) Lint ¶
func (h *HelmTemplate) Lint() (string, error)
Lint lints the helm chart from the current working directory and returns the warnings in the output
func (*HelmTemplate) ListCharts ¶
func (h *HelmTemplate) ListCharts() (string, error)
ListCharts execute the helm list command and returns its output
func (*HelmTemplate) ListRepos ¶
func (h *HelmTemplate) ListRepos() (map[string]string, error)
ListRepos list the installed helm repos together with their URL
func (*HelmTemplate) PackageChart ¶
func (h *HelmTemplate) PackageChart() error
PackageChart packages the chart from the current working directory
func (*HelmTemplate) RemoveRepo ¶
func (h *HelmTemplate) RemoveRepo(repo string) error
RemoveRepo removes the given repo from helm
func (*HelmTemplate) RemoveRequirementsLock ¶
func (h *HelmTemplate) RemoveRequirementsLock() error
RemoveRequirementsLock removes the requirements.lock file from the current working directory
func (*HelmTemplate) SearchChartVersions ¶
func (h *HelmTemplate) SearchChartVersions(chart string) ([]string, error)
SearchChartVersions search all version of the given chart
func (*HelmTemplate) SearchCharts ¶
func (h *HelmTemplate) SearchCharts(filter string) ([]ChartSummary, error)
SearchCharts searches for all the charts matching the given filter
func (*HelmTemplate) SetCWD ¶
func (h *HelmTemplate) SetCWD(dir string)
SetCWD configures the common working directory of helm CLI
func (*HelmTemplate) SetHelmBinary ¶
func (h *HelmTemplate) SetHelmBinary(binary string)
SetHelmBinary configure a new helm CLI
func (*HelmTemplate) SetHost ¶
func (h *HelmTemplate) SetHost(tillerAddress string)
SetHost is used to point at a locally running tiller
func (*HelmTemplate) StatusRelease ¶
func (h *HelmTemplate) StatusRelease(ns string, releaseName string) error
StatusRelease returns the output of the helm status command for a given release
func (*HelmTemplate) StatusReleases ¶
func (h *HelmTemplate) StatusReleases(ns string) (map[string]Release, error)
StatusReleases returns the status of all installed releases
func (*HelmTemplate) Template ¶ added in v1.3.942
func (h *HelmTemplate) Template(chart string, releaseName string, ns string, outDir string, upgrade bool, values []string, valueFiles []string) error
Template generates the YAML from the chart template to the given directory
func (*HelmTemplate) UpdateRepo ¶
func (h *HelmTemplate) UpdateRepo() error
UpdateRepo updates the helm repositories
func (*HelmTemplate) UpgradeChart ¶
func (h *HelmTemplate) UpgradeChart(chart string, releaseName string, ns string, version string, install bool, timeout int, force bool, wait bool, values []string, valueFiles []string, repo string, username string, password string, reuseValues bool) error
UpgradeChart upgrades a helm chart according with given helm flags
type Helmer ¶
type Helmer interface { SetCWD(dir string) HelmBinary() string SetHelmBinary(binary string) Init(clientOnly bool, serviceAccount string, tillerNamespace string, upgrade bool) error AddRepo(repo, URL, username, password string) error RemoveRepo(repo string) error ListRepos() (map[string]string, error) UpdateRepo() error IsRepoMissing(URL string) (bool, error) RemoveRequirementsLock() error BuildDependency() error InstallChart(chart string, releaseName string, ns string, version string, timeout int, values []string, valueFiles []string, repo string, username string, password string) error FetchChart(chart string, version string, untar bool, untardir string, repo string, username string, password string) error UpgradeChart(chart string, releaseName string, ns string, version string, install bool, timeout int, force bool, wait bool, values []string, valueFiles []string, repo string, username string, password string, reuseValues bool) error DeleteRelease(ns string, releaseName string, purge bool) error ListCharts() (string, error) SearchChartVersions(chart string) ([]string, error) FindChart() (string, error) PackageChart() error StatusRelease(ns string, releaseName string) error StatusReleases(ns string) (map[string]Release, error) Lint() (string, error) Version(tls bool) (string, error) SearchCharts(filter string) ([]ChartSummary, error) SetHost(host string) Env() map[string]string DecryptSecrets(location string) error Template(chartDir string, releaseName string, ns string, outputDir string, upgrade bool, values []string, valueFiles []string) error }
Helmer defines common helm actions used within Jenkins X
type InstallChartOptions ¶
type Requirements ¶
type Requirements struct {
Dependencies []*Dependency `json:"dependencies"`
}
Requirements is a list of requirements for a chart.
Requirements are charts upon which this chart depends. This expresses developer intent.
func LoadRequirements ¶
func LoadRequirements(data []byte) (*Requirements, error)
LoadRequirements loads the requirements from some data
func LoadRequirementsFile ¶
func LoadRequirementsFile(fileName string) (*Requirements, error)
LoadRequirementsFile loads the requirements file or creates empty requirements if the file does not exist
func (*Requirements) RemoveApplication ¶
func (r *Requirements) RemoveApplication(app string) bool
RemoveApplication removes the given app name. Returns true if a dependency was removed
func (*Requirements) SetAppVersion ¶
func (r *Requirements) SetAppVersion(app string, version string, repository string, alias string)
SetAppVersion sets the version of the app to use