Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Chart ¶
type Chart struct { pulumi.ResourceState Resources pulumi.Output }
Chart is a component representing a collection of resources described by an arbitrary Helm Chart. The Chart can be fetched from any source that is accessible to the `helm` command line. Values in the `values.yml` file can be overridden using `ChartOpts.values` (equivalent to `--set` or having multiple `values.yml` files). Objects can be transformed arbitrarily by supplying callbacks to `ChartOpts.transformations`.
`Chart` does not use Tiller. The Chart specified is copied and expanded locally; the semantics are equivalent to running `helm template` and then using Pulumi to manage the resulting YAML manifests. Any values that would be retrieved in-cluster are assigned fake values, and none of Tiller's server-side validity testing is executed.
## Example Usage ### Local Chart Directory
```go package main
import (
"github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes/helm/v3" "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() { pulumi.Run(func(ctx *pulumi.Context) error { _, err := helm.NewChart(ctx, "nginx-ingress", helm.ChartArgs{ Path: pulumi.String("./nginx-ingress"), }) if err != nil { return err } return nil }) }
``` ### Remote Chart
```go package main
import (
"github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes/helm/v3" "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() { pulumi.Run(func(ctx *pulumi.Context) error { _, err := helm.NewChart(ctx, "nginx-ingress", helm.ChartArgs{ Chart: pulumi.String("nginx-ingress"), Version: pulumi.String("1.24.4"), FetchArgs: helm.FetchArgs{ Repo: pulumi.String("https://charts.helm.sh/stable"), }, }) if err != nil { return err } return nil }) }
``` ### Set Chart values
```go package main
import (
"github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes/helm/v3" "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() { pulumi.Run(func(ctx *pulumi.Context) error { _, err := helm.NewChart(ctx, "nginx-ingress", helm.ChartArgs{ Chart: pulumi.String("nginx-ingress"), Version: pulumi.String("1.24.4"), FetchArgs: helm.FetchArgs{ Repo: pulumi.String("https://charts.helm.sh/stable"), }, Values: pulumi.Map{ "controller": pulumi.Map{ "metrics": pulumi.Map{ "enabled": pulumi.Bool(true), }, }, }, }) if err != nil { return err } return nil }) }
``` ### Deploy Chart into Namespace
```go package main
import (
"github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes/helm/v3" "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() { pulumi.Run(func(ctx *pulumi.Context) error { _, err := helm.NewChart(ctx, "nginx-ingress", helm.ChartArgs{ Chart: pulumi.String("nginx-ingress"), Version: pulumi.String("1.24.4"), Namespace: pulumi.String("test-namespace"), FetchArgs: helm.FetchArgs{ Repo: pulumi.String("https://charts.helm.sh/stable"), }, }) if err != nil { return err } return nil }) }
``` ### Chart with Transformations
```go package main
import (
"github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes/helm/v3" "github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes/yaml" "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() { pulumi.Run(func(ctx *pulumi.Context) error { _, err := helm.NewChart(ctx, "nginx-ingress", helm.ChartArgs{ Chart: pulumi.String("nginx-ingress"), Version: pulumi.String("1.24.4"), FetchArgs: helm.FetchArgs{ Repo: pulumi.String("https://charts.helm.sh/stable"), }, Transformations: []yaml.Transformation{ // Make every service private to the cluster, i.e., turn all services into ClusterIP // instead of LoadBalancer. func(state map[string]interface{}, opts ...pulumi.ResourceOption) { if state["kind"] == "Service" { spec := state["spec"].(map[string]interface{}) spec["type"] = "ClusterIP" } }, // Set a resource alias for a previous name. func(state map[string]interface{}, opts ...pulumi.ResourceOption) { if state["kind"] == "Deployment" { aliases := pulumi.Aliases([]pulumi.Alias{ { Name: pulumi.String("oldName"), }, }) opts = append(opts, aliases) } }, // Omit a resource from the Chart by transforming the specified resource definition // to an empty List. func(state map[string]interface{}, opts ...pulumi.ResourceOption) { name := state["metadata"].(map[string]interface{})["name"] if state["kind"] == "Pod" && name == "test" { state["apiVersion"] = "core/v1" state["kind"] = "List" } }, }, }) if err != nil { return err } return nil }) }
```
func NewChart ¶
func NewChart(ctx *pulumi.Context, name string, args ChartArgs, opts ...pulumi.ResourceOption) (*Chart, error)
NewChart registers a new resource with the given unique name, arguments, and options.
func (*Chart) GetResource ¶
GetResource returns a resource defined by a built-in Kubernetes group/version/kind, name and namespace. For example, GetResource("v1/Pod", "foo", "") would return a Pod called "foo" from the "default" namespace.
type ChartArgs ¶
type ChartArgs struct { // The optional Kubernetes API versions used for Capabilities.APIVersions. APIVersions pulumi.StringArrayInput // By default, Helm resources with the `test`, `test-success`, and `test-failure` hooks are not installed. Set // this flag to true to include these resources. IncludeTestHookResources pulumi.BoolInput // The optional namespace to install chart resources into. Namespace pulumi.StringInput // Overrides for chart values. Values pulumi.MapInput // Transformations is an optional list of transformations to apply to Kubernetes resource definitions // before registering with the engine. Transformations []yaml.Transformation // ResourcePrefix is an optional prefix for the auto-generated resource names. For example, a resource named `bar` // created with resource prefix of `"foo"` would produce a resource named `"foo-bar"`. ResourcePrefix string // (Remote chart) The repository name of the chart to deploy. Example: "stable". Repo pulumi.StringInput // (Remote chart) The name of the chart to deploy. If Repo is specified, this chart name will be prefixed // by the repo name. // Example: Repo: "stable", Chart: "nginx-ingress" -> "stable/nginx-ingress" // Example: Chart: "stable/nginx-ingress" -> "stable/nginx-ingress" Chart pulumi.StringInput // (Remote chart) The version of the chart to deploy. If not provided, the latest version will be deployed. Version pulumi.StringInput // (Remote chart) Additional options to customize the fetching of the Helm chart. FetchArgs FetchArgsInput // (Local chart) The path to the chart directory which contains the `Chart.yaml` file. // If Path is set, any remote chart args (Repo, Chart, Version, FetchArgs) will be ignored. Path pulumi.StringInput }
ChartArgs specifies arguments for constructing a Chart resource.
func (ChartArgs) ElementType ¶
func (ChartArgs) ToChartArgsOutput ¶
func (i ChartArgs) ToChartArgsOutput() ChartArgsOutput
func (ChartArgs) ToChartArgsOutputWithContext ¶
func (i ChartArgs) ToChartArgsOutputWithContext(ctx context.Context) ChartArgsOutput
type ChartArgsInput ¶
type ChartArgsInput interface { pulumi.Input ToChartArgsOutput() ChartArgsOutput ToChartArgsOutputWithContext(context.Context) ChartArgsOutput }
type ChartArgsOutput ¶
type ChartArgsOutput struct{ *pulumi.OutputState }
func (ChartArgsOutput) ElementType ¶
func (ChartArgsOutput) ElementType() reflect.Type
func (ChartArgsOutput) ToChartArgsOutput ¶
func (o ChartArgsOutput) ToChartArgsOutput() ChartArgsOutput
func (ChartArgsOutput) ToChartArgsOutputWithContext ¶
func (o ChartArgsOutput) ToChartArgsOutputWithContext(ctx context.Context) ChartArgsOutput
type FetchArgs ¶
type FetchArgs struct { // Specific version of a chart. If unset, the latest version is fetched. Version pulumi.StringInput // Verify certificates of HTTPS-enabled servers using this CA bundle. CAFile pulumi.StringInput // Identify HTTPS client using this SSL certificate file. CertFile pulumi.StringInput // Identify HTTPS client using this SSL key file. KeyFile pulumi.StringInput // Location to write the chart. If Destination and UntarDir are specified, UntarDir is // appended to Destination (default "."). Destination pulumi.StringInput // Keyring containing public keys (default "~/.gnupg/pubring.gpg"). Keyring pulumi.StringInput // Chart repository password. Password pulumi.StringInput // Chart repository URL for the requested chart. Repo pulumi.StringInput // Location to expand the chart. (default "."). UntarDir pulumi.StringInput // Chart repository username. Username pulumi.StringInput // Location of your Helm config. Overrides $HELM_HOME (default "~/.helm"). Home pulumi.StringInput // Use development versions, too. Equivalent to version '>0.0.0-0'. If Version is set, // Devel is ignored. Devel pulumi.BoolPtrInput // Fetch the provenance file, but don't perform verification. Prov pulumi.BoolPtrInput // If false, leave the chart as a tarball after downloading. Untar pulumi.BoolPtrInput // Verify the package against its signature. Verify pulumi.BoolPtrInput }
FetchArgs specifies arguments for fetching the Helm chart.
func (FetchArgs) ElementType ¶
func (FetchArgs) ToFetchArgsOutput ¶
func (i FetchArgs) ToFetchArgsOutput() FetchArgsOutput
func (FetchArgs) ToFetchArgsOutputWithContext ¶
func (i FetchArgs) ToFetchArgsOutputWithContext(ctx context.Context) FetchArgsOutput
type FetchArgsInput ¶
type FetchArgsInput interface { pulumi.Input ToFetchArgsOutput() FetchArgsOutput ToFetchArgsOutputWithContext(context.Context) FetchArgsOutput }
type FetchArgsOutput ¶
type FetchArgsOutput struct{ *pulumi.OutputState }
func (FetchArgsOutput) ElementType ¶
func (FetchArgsOutput) ElementType() reflect.Type
func (FetchArgsOutput) ToFetchArgsOutput ¶
func (o FetchArgsOutput) ToFetchArgsOutput() FetchArgsOutput
func (FetchArgsOutput) ToFetchArgsOutputWithContext ¶
func (o FetchArgsOutput) ToFetchArgsOutputWithContext(ctx context.Context) FetchArgsOutput