chartutil

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2020 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// HelmChartsDir is the relative directory within an SDK project where Helm
	// charts are stored.
	HelmChartsDir string = "helm-charts"

	// DefaultGroup is the Kubernetes CRD API Group used for fetched
	// charts when the --group flag is not specified
	DefaultGroup string = "charts"

	// DefaultVersion is the Kubernetes CRD API Version used for fetched
	// charts when the --version flag is not specified
	DefaultVersion string = "v1alpha1"
)

Variables

This section is empty.

Functions

func CreateChart

func CreateChart(projectDir string, opts CreateOptions) (*resource.Options, *chart.Chart, error)

CreateChart scaffolds a new helm chart for the project rooted in projectDir based on the passed opts.

It returns a scaffold.Resource that can be used by the caller to create other related files. opts.ResourceAPIVersion and opts.ResourceKind are used to create the resource and must be specified if opts.Chart is empty.

If opts.Chart is not empty, opts.ResourceAPIVersion and opts.Kind can be left unset: opts.ResourceAPIVersion defaults to "charts.helm.k8s.io/v1alpha1" and opts.ResourceKind is deduced from the specified opts.Chart.

CreateChart also returns a chart.Chart that references the newly created chart.

If opts.Chart is empty, CreateChart scaffolds the default chart from helm's default template.

If opts.Chart is a local file, CreateChart verifies that it is a valid helm chart archive and unpacks it into the project's helm charts directory.

If opts.Chart is a local directory, CreateChart verifies that it is a valid helm chart directory and copies it into the project's helm charts directory.

For any other value of opts.Chart, CreateChart attempts to fetch the helm chart from a remote repository.

If opts.Repo is not specified, the following chart reference formats are supported:

  • <repoName>/<chartName>: Fetch the helm chart named chartName from the helm chart repository named repoName, as specified in the $HELM_HOME/repositories/repositories.yaml file.

  • <url>: Fetch the helm chart archive at the specified URL.

If opts.Repo is specified, only one chart reference format is supported:

  • <chartName>: Fetch the helm chart named chartName in the helm chart repository specified by opts.Repo

If opts.Version is not set, CreateChart will fetch the latest available version of the helm chart. Otherwise, CreateChart will fetch the specified version. opts.Version is not used when opts.Chart itself refers to a specific version, for example when it is a local path or a URL.

CreateChart returns an error if an error occurs creating the scaffold.Resource or creating the chart.

Types

type CreateOptions

type CreateOptions struct {
	GVK schema.GroupVersionKind

	// Chart is a chart reference for a local or remote chart.
	Chart string

	// Repo is a URL to a custom chart repository.
	Repo string

	// Version is the version of the chart to fetch.
	Version string

	// CRDVersion is the version of the `apiextensions.k8s.io` API which will be used to generate the CRD.
	CRDVersion string
}

CreateOptions is used to configure how a Helm chart is scaffolded for a new Helm operator project.

Jump to

Keyboard shortcuts

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