Documentation

Index

Constants

View Source
const (

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

	// DefaultAPIVersion is the Kubernetes CRD API Version used for fetched
	// charts when the --api-version flag is not specified
	DefaultAPIVersion string = "charts.helm.k8s.io/v1alpha1"
)
View Source
const GoModFile = "go.mod"
View Source
const WatchesYamlFile = "watches.yaml"

Variables

This section is empty.

Functions

func CreateChart

func CreateChart(projectDir string, opts CreateChartOptions) (*scaffold.Resource, *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.

func CreateRoleScaffold

func CreateRoleScaffold(cfg *rest.Config, chart *chart.Chart) (*scaffold.Role, error)

CreateRoleScaffold generates a role scaffold from the provided helm chart. It renders a release manifest using the chart's default values and uses the Kubernetes discovery API to lookup each resource in the resulting manifest. The role scaffold will have IsClusterScoped=true if the chart lists cluster scoped resources

func PrintDepGopkgTOML

func PrintDepGopkgTOML(asFile bool) error

func PrintGoMod

func PrintGoMod(asFile bool) error

Types

type CreateChartOptions

type CreateChartOptions struct {
	// ResourceAPIVersion defines the Kubernetes GroupVersion to be associated
	// with the created chart.
	ResourceAPIVersion string

	// ResourceKind defines the Kubernetes Kind to be associated with the
	// created chart.
	ResourceKind string

	// 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
}

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

type Dockerfile

type Dockerfile struct {
	input.Input

	HelmChartsDir string
	ImageTag      string
}

Dockerfile specifies the Helm Dockerfile scaffold

func (*Dockerfile) GetInput

func (d *Dockerfile) GetInput() (input.Input, error)

GetInput gets the scaffold execution input

type DockerfileHybrid

type DockerfileHybrid struct {
	input.Input

	// HelmCharts - if true, include a COPY statement for the helm-charts directory
	HelmCharts bool

	// Watches - if true, include a COPY statement for watches.yaml
	Watches bool
}

DockerfileHybrid - Dockerfile for a hybrid operator

func (*DockerfileHybrid) GetInput

func (d *DockerfileHybrid) GetInput() (input.Input, error)

GetInput - gets the input

type Entrypoint

type Entrypoint struct {
	input.Input
}

Entrypoint - entrypoint script

func (*Entrypoint) GetInput

func (e *Entrypoint) GetInput() (input.Input, error)

type GoMod

type GoMod struct {
	input.Input
}

GoMod - the go.mod file for a Helm hybrid operator.

func (*GoMod) GetInput

func (s *GoMod) GetInput() (input.Input, error)

type GopkgToml

type GopkgToml struct {
	input.Input
}

GopkgToml - the Gopkg.toml file for a hybrid operator

func (*GopkgToml) GetInput

func (s *GopkgToml) GetInput() (input.Input, error)

type Main

type Main struct {
	input.Input
}

Main - main source file for helm operator

func (*Main) GetInput

func (m *Main) GetInput() (input.Input, error)

type Operator

type Operator struct {
	input.Input
}

Operator specifies the Helm operator.yaml manifest scaffold

func (*Operator) GetInput

func (s *Operator) GetInput() (input.Input, error)

GetInput gets the scaffold execution input

type UserSetup

type UserSetup struct {
	input.Input
}

UserSetup - userSetup script

func (*UserSetup) GetInput

func (u *UserSetup) GetInput() (input.Input, error)

type WatchesYAML

type WatchesYAML struct {
	input.Input

	Resource      *scaffold.Resource
	HelmChartsDir string
	ChartName     string
}

WatchesYAML specifies the Helm watches.yaml manifest scaffold

func (*WatchesYAML) GetInput

func (s *WatchesYAML) GetInput() (input.Input, error)

GetInput gets the scaffold execution input