Documentation ¶
Index ¶
- Constants
- func CreateChart(projectDir string, opts CreateChartOptions) (*scaffold.Resource, *chart.Chart, error)
- func CreateRoleScaffold(cfg *rest.Config, chart *chart.Chart) (*scaffold.Role, error)
- func PrintDepGopkgTOML(asFile bool) error
- func PrintGoMod(asFile bool) error
- type CreateChartOptions
- type Dockerfile
- type DockerfileHybrid
- type Entrypoint
- type GoMod
- type GopkgToml
- type Main
- type Operator
- type UserSetup
- type WatchesYAML
Constants ¶
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" )
const GoModFile = "go.mod"
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 ¶ added in v0.8.0
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 ¶ added in v0.8.0
func PrintGoMod ¶ added in v0.8.0
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 ¶
Dockerfile specifies the Helm Dockerfile scaffold
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
type Entrypoint ¶
Entrypoint - entrypoint script