diff --git a/CHANGELOG.md b/CHANGELOG.md index 8536f8efc6..829d318f65 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## HEAD (Unreleased) +- Skip Helm test hook resources by default (https://github.com/pulumi/pulumi-kubernetes/pull/1467) + ## 2.8.0 (February 3, 2021) Note: This release fixes a bug with the Helm v3 SDK that omitted any chart resources that included a hook annotation. diff --git a/Makefile b/Makefile index 595a9671fb..d9adcce3cd 100644 --- a/Makefile +++ b/Makefile @@ -116,6 +116,7 @@ test_all:: generate_schema:: schema install_dotnet_sdk:: + rm -rf $(WORKING_DIR)/nuget/$(NUGET_PKG_NAME).*.nupkg mkdir -p $(WORKING_DIR)/nuget find . -name '*.nupkg' -print -exec cp -p {} ${WORKING_DIR}/nuget \; diff --git a/provider/pkg/gen/dotnet-templates/helm/ChartBase.cs b/provider/pkg/gen/dotnet-templates/helm/ChartBase.cs index b9565b9fdd..ce91df05ee 100644 --- a/provider/pkg/gen/dotnet-templates/helm/ChartBase.cs +++ b/provider/pkg/gen/dotnet-templates/helm/ChartBase.cs @@ -403,6 +403,12 @@ public InputList ApiVersions set => _apiVersions = value; } + /// + /// 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. + /// + public Input? IncludeTestHookResources { get; set; } + /// /// The optional namespace to install chart resources into. /// diff --git a/provider/pkg/gen/dotnet-templates/helm/Unwraps.cs b/provider/pkg/gen/dotnet-templates/helm/Unwraps.cs index c23241b282..8c0f98b628 100644 --- a/provider/pkg/gen/dotnet-templates/helm/Unwraps.cs +++ b/provider/pkg/gen/dotnet-templates/helm/Unwraps.cs @@ -24,6 +24,7 @@ namespace Pulumi.Kubernetes.Helm internal class BaseChartArgsUnwrap { public ImmutableArray ApiVersions { get; set; } + public bool? IncludeTestHookResources { get; set; } public string? Namespace { get; set; } public ImmutableDictionary Values { get; set; } = null!; public List Transformations { get; set; } = null!; @@ -67,27 +68,29 @@ internal static class Extensions public static Output> Unwrap(this Union options) { return options.Match( - v => Output.Tuple(v.ApiVersions, v.Namespace.ToNullable(), v.Values, v.Repo.ToNullable(), v.Chart, v.Version.ToNullable(), v.FetchOptions.Unwrap()).Apply(vs => + v => Output.Tuple(v.ApiVersions, v.IncludeTestHookResources.ToNullable(), v.Namespace.ToNullable(), v.Values, v.Repo.ToNullable(), v.Chart, v.Version.ToNullable(), v.FetchOptions.Unwrap()).Apply(vs => Union.FromT0( new ChartArgsUnwrap { ApiVersions = vs.Item1, - Namespace = vs.Item2, - Values = vs.Item3, + IncludeTestHookResources = vs.Item2, + Namespace = vs.Item3, + Values = vs.Item4, Transformations = v.Transformations, ResourcePrefix = v.ResourcePrefix, - Repo = vs.Item4, - Chart = vs.Item5, - Version = vs.Item6, - FetchOptions = vs.Item7 + Repo = vs.Item5, + Chart = vs.Item6, + Version = vs.Item7, + FetchOptions = vs.Item8 })), - v => Output.Tuple(v.ApiVersions, v.Namespace.ToNullable(), v.Values).Apply(vs => + v => Output.Tuple(v.ApiVersions, v.IncludeTestHookResources.ToNullable(), v.Namespace.ToNullable(), v.Values).Apply(vs => Union.FromT1( new LocalChartArgsUnwrap { ApiVersions = vs.Item1, - Namespace = vs.Item2, - Values = vs.Item3, + IncludeTestHookResources = vs.Item2, + Namespace = vs.Item3, + Values = vs.Item4, Transformations = v.Transformations, ResourcePrefix = v.ResourcePrefix, Path = v.Path diff --git a/provider/pkg/gen/dotnet-templates/helm/v3/Chart.cs b/provider/pkg/gen/dotnet-templates/helm/v3/Chart.cs index e5dd8922a2..d2d36e1ecb 100644 --- a/provider/pkg/gen/dotnet-templates/helm/v3/Chart.cs +++ b/provider/pkg/gen/dotnet-templates/helm/v3/Chart.cs @@ -309,6 +309,7 @@ private static string GetName(Union config, string re jsonOpts = new JsonOpts { ApiVersions = cfgBase.ApiVersions, + IncludeTestHookResources = cfgBase.IncludeTestHookResources, Namespace = cfgBase.Namespace, Values = cfgBase.Values, ReleaseName = releaseName, @@ -345,6 +346,7 @@ private static string GetName(Union config, string re jsonOpts = new JsonOpts { ApiVersions = cfgBase.ApiVersions, + IncludeTestHookResources = cfgBase.IncludeTestHookResources, Namespace = cfgBase.Namespace, Values = cfgBase.Values, ReleaseName = releaseName, @@ -372,6 +374,8 @@ internal class JsonOpts { [JsonPropertyName("api_versions")] public ImmutableArray ApiVersions { get; set; } + [JsonPropertyName("include_test_hook_resources")] + public bool? IncludeTestHookResources { get; set; } [JsonPropertyName("namespace")] public string? Namespace { get; set; } [JsonPropertyName("values")] diff --git a/provider/pkg/gen/go-templates/helm/v3/pulumiTypes.tmpl b/provider/pkg/gen/go-templates/helm/v3/pulumiTypes.tmpl index fa6f069e70..dec8507741 100644 --- a/provider/pkg/gen/go-templates/helm/v3/pulumiTypes.tmpl +++ b/provider/pkg/gen/go-templates/helm/v3/pulumiTypes.tmpl @@ -117,6 +117,9 @@ func (o FetchArgsOutput) ToFetchArgsOutputWithContext(ctx context.Context) Fetch 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. @@ -148,16 +151,17 @@ type ChartArgs struct { // chartArgs is a copy of ChartArgs but without using TInput in types. // Note that Transformations are omitted in JSON marshaling because functions are not serializable. type chartArgs struct { - APIVersions []string `json:"api_versions,omitempty" pulumi:"apiVersions"` - Namespace string `json:"namespace,omitempty" pulumi:"namespace"` - Values map[string]interface{} `json:"values,omitempty" pulumi:"values"` - Transformations []yaml.Transformation `json:"-" pulumi:"transformations"` - ResourcePrefix string `json:"resource_prefix,omitempty" pulumi:"resourcePrefix"` - Repo string `json:"repo,omitempty" pulumi:"repo"` - Chart string `json:"chart,omitempty" pulumi:"chart"` - Version string `json:"version,omitempty" pulumi:"version"` - FetchArgs fetchArgs `json:"fetch_opts,omitempty" pulumi:"fetchArgs"` - Path string `json:"path,omitempty" pulumi:"path"` + APIVersions []string `json:"api_versions,omitempty" pulumi:"apiVersions"` + IncludeTestHookResources bool `json:"include_test_hook_resources,omitempty" pulumi:"includeTestHookResources"` + Namespace string `json:"namespace,omitempty" pulumi:"namespace"` + Values map[string]interface{} `json:"values,omitempty" pulumi:"values"` + Transformations []yaml.Transformation `json:"-" pulumi:"transformations"` + ResourcePrefix string `json:"resource_prefix,omitempty" pulumi:"resourcePrefix"` + Repo string `json:"repo,omitempty" pulumi:"repo"` + Chart string `json:"chart,omitempty" pulumi:"chart"` + Version string `json:"version,omitempty" pulumi:"version"` + FetchArgs fetchArgs `json:"fetch_opts,omitempty" pulumi:"fetchArgs"` + Path string `json:"path,omitempty" pulumi:"path"` } type ChartArgsInput interface { diff --git a/provider/pkg/gen/nodejs-templates/helm/v3/helm.ts b/provider/pkg/gen/nodejs-templates/helm/v3/helm.ts index fe0220ad96..1b75b0d751 100644 --- a/provider/pkg/gen/nodejs-templates/helm/v3/helm.ts +++ b/provider/pkg/gen/nodejs-templates/helm/v3/helm.ts @@ -187,6 +187,10 @@ export class Chart extends yaml.CollectionComponentResource { obj["fetch_opts"] = value; break; } + case "includeTestHookResources": { + obj["include_test_hook_resources"] = value; + break; + } case "releaseName": { obj["release_name"] = value; break; @@ -232,6 +236,11 @@ interface BaseChartOpts { * The optional kubernetes api versions used for Capabilities.APIVersions. */ apiVersions?: pulumi.Input[]>; + /** + * 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?: boolean; /** * The optional namespace to install chart resources into. */ diff --git a/provider/pkg/gen/python-templates/helm/v3/helm.py b/provider/pkg/gen/python-templates/helm/v3/helm.py index 058704f30d..06678a42a0 100644 --- a/provider/pkg/gen/python-templates/helm/v3/helm.py +++ b/provider/pkg/gen/python-templates/helm/v3/helm.py @@ -383,12 +383,19 @@ class BaseChartOpts: Optional kubernetes api versions used for Capabilities.APIVersions. """ + include_test_hook_resources: Optional[pulumi.Input[bool]] + """ + 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. + """ + def __init__(self, namespace: Optional[pulumi.Input[str]] = None, values: Optional[pulumi.Inputs] = None, transformations: Optional[Sequence[Callable[[Any, pulumi.ResourceOptions], None]]] = None, resource_prefix: Optional[str] = None, - api_versions: Optional[Sequence[pulumi.Input[str]]] = None): + api_versions: Optional[Sequence[pulumi.Input[str]]] = None, + include_test_hook_resources: Optional[pulumi.Input[bool]] = None): """ :param Optional[pulumi.Input[str]] namespace: Optional namespace to install chart resources into. :param Optional[pulumi.Inputs] values: Optional overrides for chart values. @@ -399,8 +406,12 @@ def __init__(self, Example: A resource created with resource_prefix="foo" would produce a resource named "foo-resourceName". :param Optional[Sequence[pulumi.Input[str]]] api_versions: Optional kubernetes api versions used for Capabilities.APIVersions. + :param Optional[pulumi.Input[bool]] include_test_hook_resources: 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. """ self.namespace = namespace + self.include_test_hook_resources = include_test_hook_resources self.values = values self.transformations = transformations self.resource_prefix = resource_prefix @@ -448,7 +459,8 @@ def __init__(self, repo: Optional[pulumi.Input[str]] = None, version: Optional[pulumi.Input[str]] = None, fetch_opts: Optional[pulumi.Input[FetchOpts]] = None, - api_versions: Optional[Sequence[pulumi.Input[str]]] = None): + api_versions: Optional[Sequence[pulumi.Input[str]]] = None, + include_test_hook_resources: Optional[pulumi.Input[bool]] = None): """ :param pulumi.Input[str] chart: The name of the chart to deploy. If `repo` is provided, this chart name will be prefixed by the repo name. @@ -469,8 +481,12 @@ def __init__(self, fetching of the Helm chart. :param Optional[Sequence[pulumi.Input[str]]] api_versions: Optional kubernetes api versions used for Capabilities.APIVersions. + :param Optional[pulumi.Input[bool]] include_test_hook_resources: 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. """ - super(ChartOpts, self).__init__(namespace, values, transformations, resource_prefix, api_versions) + super(ChartOpts, self).__init__(namespace, values, transformations, resource_prefix, api_versions, + include_test_hook_resources) self.chart = chart self.repo = repo self.version = version @@ -493,7 +509,8 @@ def __init__(self, values: Optional[pulumi.Inputs] = None, transformations: Optional[Sequence[Callable[[Any, pulumi.ResourceOptions], None]]] = None, resource_prefix: Optional[str] = None, - api_versions: Optional[Sequence[pulumi.Input[str]]] = None): + api_versions: Optional[Sequence[pulumi.Input[str]]] = None, + include_test_hook_resources: Optional[pulumi.Input[bool]] = None): """ :param pulumi.Input[str] path: The path to the chart directory which contains the `Chart.yaml` file. @@ -506,9 +523,13 @@ def __init__(self, Example: A resource created with resource_prefix="foo" would produce a resource named "foo-resourceName". :param Optional[Sequence[pulumi.Input[str]]] api_versions: Optional kubernetes api versions used for Capabilities.APIVersions. + :param Optional[pulumi.Input[bool]] include_test_hook_resources: 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. """ - super(LocalChartOpts, self).__init__(namespace, values, transformations, resource_prefix, api_versions) + super(LocalChartOpts, self).__init__(namespace, values, transformations, resource_prefix, api_versions, + include_test_hook_resources) self.path = path diff --git a/provider/pkg/provider/invoke_helm_template.go b/provider/pkg/provider/invoke_helm_template.go index 451ab2ede3..2079af3db4 100644 --- a/provider/pkg/provider/invoke_helm_template.go +++ b/provider/pkg/provider/invoke_helm_template.go @@ -24,6 +24,7 @@ import ( "strings" pkgerrors "github.com/pkg/errors" + logger "github.com/pulumi/pulumi/sdk/v2/go/common/util/logging" "helm.sh/helm/v3/pkg/action" "helm.sh/helm/v3/pkg/chart/loader" "helm.sh/helm/v3/pkg/chartutil" @@ -32,6 +33,9 @@ import ( "helm.sh/helm/v3/pkg/storage/driver" ) +// testHookAnnotation matches test-related Helm hook annotations (test, test-success, test-failure) +var testHookAnnotation = regexp.MustCompile(`"?helm.sh\/hook"?:.*test`) + type HelmFetchOpts struct { CAFile string `json:"ca_file,omitempty"` CertFile string `json:"cert_file,omitempty"` @@ -52,14 +56,15 @@ type HelmFetchOpts struct { type HelmChartOpts struct { HelmFetchOpts `json:"fetch_opts,omitempty"` - APIVersions []string `json:"api_versions,omitempty"` - Chart string `json:"chart,omitempty"` - Namespace string `json:"namespace,omitempty"` - Path string `json:"path,omitempty"` - ReleaseName string `json:"release_name,omitempty"` - Repo string `json:"repo,omitempty"` - Values map[string]interface{} `json:"values,omitempty"` - Version string `json:"version,omitempty"` + APIVersions []string `json:"api_versions,omitempty"` + Chart string `json:"chart,omitempty"` + IncludeTestHookResources bool `json:"include_test_hook_resources,omitempty"` + Namespace string `json:"namespace,omitempty"` + Path string `json:"path,omitempty"` + ReleaseName string `json:"release_name,omitempty"` + Repo string `json:"repo,omitempty"` + Values map[string]interface{} `json:"values,omitempty"` + Version string `json:"version,omitempty"` } // helmTemplate performs Helm fetch/pull + template operations and returns the resulting YAML manifest based on the @@ -225,8 +230,14 @@ func (c *chart) template() (string, error) { manifests := strings.Builder{} manifests.WriteString(rel.Manifest) for _, hook := range rel.Hooks { - manifests.WriteString("\n---\n") - manifests.WriteString(hook.Manifest) + switch { + case !c.opts.IncludeTestHookResources && testHookAnnotation.MatchString(hook.Manifest): + logger.V(9).Infof("Skipping Helm resource with test hook: %s", hook.Name) + // Skip test hook. + default: + manifests.WriteString("\n---\n") + manifests.WriteString(hook.Manifest) + } } return manifests.String(), nil diff --git a/provider/pkg/provider/provider.go b/provider/pkg/provider/provider.go index 75b626c0dc..0dada5b7b9 100644 --- a/provider/pkg/provider/provider.go +++ b/provider/pkg/provider/provider.go @@ -26,6 +26,7 @@ import ( "os/user" "path/filepath" "reflect" + "regexp" "strings" "sync" @@ -1035,7 +1036,7 @@ func (k *kubeProvider) Check(ctx context.Context, req *pulumirpc.CheckRequest) ( var failures []*pulumirpc.CheckFailure hasHelmHook := false - for key := range newInputs.GetAnnotations() { + for key, value := range newInputs.GetAnnotations() { // If annotations with a reserved internal prefix exist, ignore them. if metadata.IsInternalAnnotation(key) { _ = k.host.Log(ctx, diag.Warning, urn, @@ -1044,12 +1045,15 @@ func (k *kubeProvider) Check(ctx context.Context, req *pulumirpc.CheckRequest) ( // If the Helm hook annotation is found, set the hasHelmHook flag. if has := metadata.IsHelmHookAnnotation(key); has { - hasHelmHook = hasHelmHook || has + // Test hooks are handled, so ignore this one. + if match, _ := regexp.MatchString(`test|test-success|test-failure`, value); !match { + hasHelmHook = hasHelmHook || has + } } } if hasHelmHook { _ = k.host.Log(ctx, diag.Warning, urn, - "This resource contains Helm hooks that are not currently supported by Pulumi. The resource will"+ + "This resource contains Helm hooks that are not currently supported by Pulumi. The resource will "+ "be created, but any hooks will not be executed. Hooks support is tracked at "+ "https://github.com/pulumi/pulumi-kubernetes/issues/555") } diff --git a/sdk/dotnet/Helm/ChartBase.cs b/sdk/dotnet/Helm/ChartBase.cs index b9565b9fdd..ce91df05ee 100644 --- a/sdk/dotnet/Helm/ChartBase.cs +++ b/sdk/dotnet/Helm/ChartBase.cs @@ -403,6 +403,12 @@ public InputList ApiVersions set => _apiVersions = value; } + /// + /// 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. + /// + public Input? IncludeTestHookResources { get; set; } + /// /// The optional namespace to install chart resources into. /// diff --git a/sdk/dotnet/Helm/Unwraps.cs b/sdk/dotnet/Helm/Unwraps.cs index c23241b282..8c0f98b628 100644 --- a/sdk/dotnet/Helm/Unwraps.cs +++ b/sdk/dotnet/Helm/Unwraps.cs @@ -24,6 +24,7 @@ namespace Pulumi.Kubernetes.Helm internal class BaseChartArgsUnwrap { public ImmutableArray ApiVersions { get; set; } + public bool? IncludeTestHookResources { get; set; } public string? Namespace { get; set; } public ImmutableDictionary Values { get; set; } = null!; public List Transformations { get; set; } = null!; @@ -67,27 +68,29 @@ internal static class Extensions public static Output> Unwrap(this Union options) { return options.Match( - v => Output.Tuple(v.ApiVersions, v.Namespace.ToNullable(), v.Values, v.Repo.ToNullable(), v.Chart, v.Version.ToNullable(), v.FetchOptions.Unwrap()).Apply(vs => + v => Output.Tuple(v.ApiVersions, v.IncludeTestHookResources.ToNullable(), v.Namespace.ToNullable(), v.Values, v.Repo.ToNullable(), v.Chart, v.Version.ToNullable(), v.FetchOptions.Unwrap()).Apply(vs => Union.FromT0( new ChartArgsUnwrap { ApiVersions = vs.Item1, - Namespace = vs.Item2, - Values = vs.Item3, + IncludeTestHookResources = vs.Item2, + Namespace = vs.Item3, + Values = vs.Item4, Transformations = v.Transformations, ResourcePrefix = v.ResourcePrefix, - Repo = vs.Item4, - Chart = vs.Item5, - Version = vs.Item6, - FetchOptions = vs.Item7 + Repo = vs.Item5, + Chart = vs.Item6, + Version = vs.Item7, + FetchOptions = vs.Item8 })), - v => Output.Tuple(v.ApiVersions, v.Namespace.ToNullable(), v.Values).Apply(vs => + v => Output.Tuple(v.ApiVersions, v.IncludeTestHookResources.ToNullable(), v.Namespace.ToNullable(), v.Values).Apply(vs => Union.FromT1( new LocalChartArgsUnwrap { ApiVersions = vs.Item1, - Namespace = vs.Item2, - Values = vs.Item3, + IncludeTestHookResources = vs.Item2, + Namespace = vs.Item3, + Values = vs.Item4, Transformations = v.Transformations, ResourcePrefix = v.ResourcePrefix, Path = v.Path diff --git a/sdk/dotnet/Helm/V3/Chart.cs b/sdk/dotnet/Helm/V3/Chart.cs index e5dd8922a2..d2d36e1ecb 100644 --- a/sdk/dotnet/Helm/V3/Chart.cs +++ b/sdk/dotnet/Helm/V3/Chart.cs @@ -309,6 +309,7 @@ private static string GetName(Union config, string re jsonOpts = new JsonOpts { ApiVersions = cfgBase.ApiVersions, + IncludeTestHookResources = cfgBase.IncludeTestHookResources, Namespace = cfgBase.Namespace, Values = cfgBase.Values, ReleaseName = releaseName, @@ -345,6 +346,7 @@ private static string GetName(Union config, string re jsonOpts = new JsonOpts { ApiVersions = cfgBase.ApiVersions, + IncludeTestHookResources = cfgBase.IncludeTestHookResources, Namespace = cfgBase.Namespace, Values = cfgBase.Values, ReleaseName = releaseName, @@ -372,6 +374,8 @@ internal class JsonOpts { [JsonPropertyName("api_versions")] public ImmutableArray ApiVersions { get; set; } + [JsonPropertyName("include_test_hook_resources")] + public bool? IncludeTestHookResources { get; set; } [JsonPropertyName("namespace")] public string? Namespace { get; set; } [JsonPropertyName("values")] diff --git a/sdk/go/kubernetes/helm/v3/pulumiTypes.go b/sdk/go/kubernetes/helm/v3/pulumiTypes.go index fa6f069e70..dec8507741 100644 --- a/sdk/go/kubernetes/helm/v3/pulumiTypes.go +++ b/sdk/go/kubernetes/helm/v3/pulumiTypes.go @@ -117,6 +117,9 @@ func (o FetchArgsOutput) ToFetchArgsOutputWithContext(ctx context.Context) Fetch 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. @@ -148,16 +151,17 @@ type ChartArgs struct { // chartArgs is a copy of ChartArgs but without using TInput in types. // Note that Transformations are omitted in JSON marshaling because functions are not serializable. type chartArgs struct { - APIVersions []string `json:"api_versions,omitempty" pulumi:"apiVersions"` - Namespace string `json:"namespace,omitempty" pulumi:"namespace"` - Values map[string]interface{} `json:"values,omitempty" pulumi:"values"` - Transformations []yaml.Transformation `json:"-" pulumi:"transformations"` - ResourcePrefix string `json:"resource_prefix,omitempty" pulumi:"resourcePrefix"` - Repo string `json:"repo,omitempty" pulumi:"repo"` - Chart string `json:"chart,omitempty" pulumi:"chart"` - Version string `json:"version,omitempty" pulumi:"version"` - FetchArgs fetchArgs `json:"fetch_opts,omitempty" pulumi:"fetchArgs"` - Path string `json:"path,omitempty" pulumi:"path"` + APIVersions []string `json:"api_versions,omitempty" pulumi:"apiVersions"` + IncludeTestHookResources bool `json:"include_test_hook_resources,omitempty" pulumi:"includeTestHookResources"` + Namespace string `json:"namespace,omitempty" pulumi:"namespace"` + Values map[string]interface{} `json:"values,omitempty" pulumi:"values"` + Transformations []yaml.Transformation `json:"-" pulumi:"transformations"` + ResourcePrefix string `json:"resource_prefix,omitempty" pulumi:"resourcePrefix"` + Repo string `json:"repo,omitempty" pulumi:"repo"` + Chart string `json:"chart,omitempty" pulumi:"chart"` + Version string `json:"version,omitempty" pulumi:"version"` + FetchArgs fetchArgs `json:"fetch_opts,omitempty" pulumi:"fetchArgs"` + Path string `json:"path,omitempty" pulumi:"path"` } type ChartArgsInput interface { diff --git a/sdk/nodejs/helm/v3/helm.ts b/sdk/nodejs/helm/v3/helm.ts index fe0220ad96..1b75b0d751 100644 --- a/sdk/nodejs/helm/v3/helm.ts +++ b/sdk/nodejs/helm/v3/helm.ts @@ -187,6 +187,10 @@ export class Chart extends yaml.CollectionComponentResource { obj["fetch_opts"] = value; break; } + case "includeTestHookResources": { + obj["include_test_hook_resources"] = value; + break; + } case "releaseName": { obj["release_name"] = value; break; @@ -232,6 +236,11 @@ interface BaseChartOpts { * The optional kubernetes api versions used for Capabilities.APIVersions. */ apiVersions?: pulumi.Input[]>; + /** + * 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?: boolean; /** * The optional namespace to install chart resources into. */ diff --git a/sdk/python/pulumi_kubernetes/helm/v3/helm.py b/sdk/python/pulumi_kubernetes/helm/v3/helm.py index 058704f30d..06678a42a0 100644 --- a/sdk/python/pulumi_kubernetes/helm/v3/helm.py +++ b/sdk/python/pulumi_kubernetes/helm/v3/helm.py @@ -383,12 +383,19 @@ class BaseChartOpts: Optional kubernetes api versions used for Capabilities.APIVersions. """ + include_test_hook_resources: Optional[pulumi.Input[bool]] + """ + 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. + """ + def __init__(self, namespace: Optional[pulumi.Input[str]] = None, values: Optional[pulumi.Inputs] = None, transformations: Optional[Sequence[Callable[[Any, pulumi.ResourceOptions], None]]] = None, resource_prefix: Optional[str] = None, - api_versions: Optional[Sequence[pulumi.Input[str]]] = None): + api_versions: Optional[Sequence[pulumi.Input[str]]] = None, + include_test_hook_resources: Optional[pulumi.Input[bool]] = None): """ :param Optional[pulumi.Input[str]] namespace: Optional namespace to install chart resources into. :param Optional[pulumi.Inputs] values: Optional overrides for chart values. @@ -399,8 +406,12 @@ def __init__(self, Example: A resource created with resource_prefix="foo" would produce a resource named "foo-resourceName". :param Optional[Sequence[pulumi.Input[str]]] api_versions: Optional kubernetes api versions used for Capabilities.APIVersions. + :param Optional[pulumi.Input[bool]] include_test_hook_resources: 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. """ self.namespace = namespace + self.include_test_hook_resources = include_test_hook_resources self.values = values self.transformations = transformations self.resource_prefix = resource_prefix @@ -448,7 +459,8 @@ def __init__(self, repo: Optional[pulumi.Input[str]] = None, version: Optional[pulumi.Input[str]] = None, fetch_opts: Optional[pulumi.Input[FetchOpts]] = None, - api_versions: Optional[Sequence[pulumi.Input[str]]] = None): + api_versions: Optional[Sequence[pulumi.Input[str]]] = None, + include_test_hook_resources: Optional[pulumi.Input[bool]] = None): """ :param pulumi.Input[str] chart: The name of the chart to deploy. If `repo` is provided, this chart name will be prefixed by the repo name. @@ -469,8 +481,12 @@ def __init__(self, fetching of the Helm chart. :param Optional[Sequence[pulumi.Input[str]]] api_versions: Optional kubernetes api versions used for Capabilities.APIVersions. + :param Optional[pulumi.Input[bool]] include_test_hook_resources: 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. """ - super(ChartOpts, self).__init__(namespace, values, transformations, resource_prefix, api_versions) + super(ChartOpts, self).__init__(namespace, values, transformations, resource_prefix, api_versions, + include_test_hook_resources) self.chart = chart self.repo = repo self.version = version @@ -493,7 +509,8 @@ def __init__(self, values: Optional[pulumi.Inputs] = None, transformations: Optional[Sequence[Callable[[Any, pulumi.ResourceOptions], None]]] = None, resource_prefix: Optional[str] = None, - api_versions: Optional[Sequence[pulumi.Input[str]]] = None): + api_versions: Optional[Sequence[pulumi.Input[str]]] = None, + include_test_hook_resources: Optional[pulumi.Input[bool]] = None): """ :param pulumi.Input[str] path: The path to the chart directory which contains the `Chart.yaml` file. @@ -506,9 +523,13 @@ def __init__(self, Example: A resource created with resource_prefix="foo" would produce a resource named "foo-resourceName". :param Optional[Sequence[pulumi.Input[str]]] api_versions: Optional kubernetes api versions used for Capabilities.APIVersions. + :param Optional[pulumi.Input[bool]] include_test_hook_resources: 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. """ - super(LocalChartOpts, self).__init__(namespace, values, transformations, resource_prefix, api_versions) + super(LocalChartOpts, self).__init__(namespace, values, transformations, resource_prefix, api_versions, + include_test_hook_resources) self.path = path