From fefbe280416aa66650cb1cbc93e237cccbe49fea Mon Sep 17 00:00:00 2001 From: Levi Blackstone Date: Mon, 4 Oct 2021 16:01:19 -0600 Subject: [PATCH 1/6] Schema --- .../pulumi-resource-kubernetes/schema.json | 140 ++++++++---------- provider/pkg/gen/overlays.go | 64 ++++++++ provider/pkg/gen/schema.go | 82 +--------- 3 files changed, 131 insertions(+), 155 deletions(-) diff --git a/provider/cmd/pulumi-resource-kubernetes/schema.json b/provider/cmd/pulumi-resource-kubernetes/schema.json index d27ee331be..29516750a3 100644 --- a/provider/cmd/pulumi-resource-kubernetes/schema.json +++ b/provider/cmd/pulumi-resource-kubernetes/schema.json @@ -22,26 +22,6 @@ "type": "boolean", "description": "BETA FEATURE - If present and set to true, enable server-side diff calculations.\nThis feature is in developer preview, and is disabled by default.\n\nThis config can be specified in the following ways, using this precedence:\n1. This `enableDryRun` parameter.\n2. The `PULUMI_K8S_ENABLE_DRY_RUN` environment variable." }, - "helmDriver": { - "type": "string", - "description": "BETA FEATURE - Used for supporting Helm Release resource (Beta). The backend storage driver for Helm. Values are: configmap, secret, memory, sql." - }, - "helmPluginsPath": { - "type": "string", - "description": "BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the helm plugins directory." - }, - "helmRegistryConfigPath": { - "type": "string", - "description": "BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the registry config file." - }, - "helmRepositoryCache": { - "type": "string", - "description": "BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the file containing cached repository indexes." - }, - "helmRepositoryConfigPath": { - "type": "string", - "description": "BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the file containing repository names and URLs." - }, "kubeconfig": { "type": "string", "description": "The contents of a kubeconfig file or the path to a kubeconfig file. If this is set, this config will be used instead of $KUBECONFIG.", @@ -66,10 +46,6 @@ "suppressHelmHookWarnings": { "type": "boolean", "description": "If present and set to true, suppress unsupported Helm hook warnings from the CLI.\n\nThis config can be specified in the following ways, using this precedence:\n1. This `suppressHelmHookWarnings` parameter.\n2. The `PULUMI_K8S_SUPPRESS_HELM_HOOK_WARNINGS` environment variable." - }, - "suppressHelmReleaseBetaWarning": { - "type": "boolean", - "description": "While Helm Release provider is in beta, by default 'pulumi up' will log a warning if the resource is used. If present and set to true, this warning is omitted." } } }, @@ -23085,6 +23061,66 @@ } } }, + "kubernetes:index:HelmReleaseSettings": { + "description": "BETA FEATURE - Options to configure the Helm Release resource.", + "properties": { + "driver": { + "type": "string", + "description": "The backend storage driver for Helm. Values are: configmap, secret, memory, sql.", + "defaultInfo": { + "environment": [ + "PULUMI_K8S_HELM_DRIVER" + ] + } + }, + "pluginsPath": { + "type": "string", + "description": "The path to the helm plugins directory.", + "defaultInfo": { + "environment": [ + "PULUMI_K8S_HELM_PLUGINS_PATH" + ] + } + }, + "registryConfigPath": { + "type": "string", + "description": "The path to the registry config file.", + "defaultInfo": { + "environment": [ + "PULUMI_K8S_HELM_REGISTRY_CONFIG_PATH" + ] + } + }, + "repositoryCache": { + "type": "string", + "description": "The path to the file containing cached repository indexes.", + "defaultInfo": { + "environment": [ + "PULUMI_K8S_HELM_REPOSITORY_CACHE" + ] + } + }, + "repositoryConfigPath": { + "type": "string", + "description": "The path to the file containing repository names and URLs.", + "defaultInfo": { + "environment": [ + "PULUMI_K8S_HELM_REPOSITORY_CONFIG_PATH" + ] + } + }, + "suppressBetaWarning": { + "type": "boolean", + "description": "While Helm Release provider is in beta, by default 'pulumi up' will log a warning if the resource is used. If present and set to \"true\", this warning is omitted.", + "defaultInfo": { + "environment": [ + "PULUMI_K8S_SUPPRESS_HELM_RELEASE_BETA_WARNING" + ] + } + } + }, + "type": "object" + }, "kubernetes:index:KubeClientSettings": { "description": "Options for tuning the Kubernetes client used by a Provider.", "properties": { @@ -29935,50 +29971,9 @@ ] } }, - "helmDriver": { - "type": "string", - "description": "BETA FEATURE - Used for supporting Helm Release resource (Beta). The backend storage driver for Helm. Values are: configmap, secret, memory, sql.", - "defaultInfo": { - "environment": [ - "PULUMI_K8S_HELM_DRIVER" - ] - } - }, - "helmPluginsPath": { - "type": "string", - "description": "BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the helm plugins directory.", - "defaultInfo": { - "environment": [ - "PULUMI_K8S_HELM_PLUGINS_PATH" - ] - } - }, - "helmRegistryConfigPath": { - "type": "string", - "description": "BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the registry config file.", - "defaultInfo": { - "environment": [ - "PULUMI_K8S_HELM_REGISTRY_CONFIG_PATH" - ] - } - }, - "helmRepositoryCache": { - "type": "string", - "description": "BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the file containing cached repository indexes.", - "defaultInfo": { - "environment": [ - "PULUMI_K8s_HELM_REPOSITORY_CACHE" - ] - } - }, - "helmRepositoryConfigPath": { - "type": "string", - "description": "BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the file containing repository names and URLs.", - "defaultInfo": { - "environment": [ - "PULUMI_K8S_HELM_REPOSITORY_CONFIG_PATH" - ] - } + "helmReleaseSettings": { + "$ref": "#/types/kubernetes:index:HelmReleaseSettings", + "description": "BETA FEATURE - Options to configure the Helm Release resource." }, "kubeClientSettings": { "$ref": "#/types/kubernetes:index:KubeClientSettings", @@ -30023,15 +30018,6 @@ "PULUMI_K8S_SUPPRESS_HELM_HOOK_WARNINGS" ] } - }, - "suppressHelmReleaseBetaWarning": { - "type": "boolean", - "description": "While Helm Release provider is in beta, by default 'pulumi up' will log a warning if the resource is used. If present and set to \"true\", this warning is omitted.", - "defaultInfo": { - "environment": [ - "PULUMI_K8S_SUPPRESS_HELM_RELEASE_BETA_WARNING" - ] - } } } }, diff --git a/provider/pkg/gen/overlays.go b/provider/pkg/gen/overlays.go index 407f54a212..1ff0ef0409 100644 --- a/provider/pkg/gen/overlays.go +++ b/provider/pkg/gen/overlays.go @@ -466,6 +466,69 @@ var kubeClientSettings = pschema.ComplexTypeSpec{ }, } +var helmReleaseSettings = pschema.ComplexTypeSpec{ + ObjectTypeSpec: pschema.ObjectTypeSpec{ + Description: "BETA FEATURE - Options to configure the Helm Release resource.", + Properties: map[string]pschema.PropertySpec{ + "driver": { + DefaultInfo: &pschema.DefaultSpec{ + Environment: []string{ + "PULUMI_K8S_HELM_DRIVER", + }, + }, + Description: "The backend storage driver for Helm. Values are: configmap, secret, memory, sql.", + TypeSpec: pschema.TypeSpec{Type: "string"}, + }, + "pluginsPath": { + DefaultInfo: &pschema.DefaultSpec{ + Environment: []string{ + "PULUMI_K8S_HELM_PLUGINS_PATH", + }, + }, + Description: "The path to the helm plugins directory.", + TypeSpec: pschema.TypeSpec{Type: "string"}, + }, + "registryConfigPath": { + DefaultInfo: &pschema.DefaultSpec{ + Environment: []string{ + "PULUMI_K8S_HELM_REGISTRY_CONFIG_PATH", + }, + }, + Description: "The path to the registry config file.", + TypeSpec: pschema.TypeSpec{Type: "string"}, + }, + "repositoryConfigPath": { + DefaultInfo: &pschema.DefaultSpec{ + Environment: []string{ + "PULUMI_K8S_HELM_REPOSITORY_CONFIG_PATH", + }, + }, + Description: "The path to the file containing repository names and URLs.", + TypeSpec: pschema.TypeSpec{Type: "string"}, + }, + "repositoryCache": { + DefaultInfo: &pschema.DefaultSpec{ + Environment: []string{ + "PULUMI_K8S_HELM_REPOSITORY_CACHE", + }, + }, + Description: "The path to the file containing cached repository indexes.", + TypeSpec: pschema.TypeSpec{Type: "string"}, + }, + "suppressBetaWarning": { + DefaultInfo: &pschema.DefaultSpec{ + Environment: []string{ + "PULUMI_K8S_SUPPRESS_HELM_RELEASE_BETA_WARNING", + }, + }, + Description: "While Helm Release provider is in beta, by default 'pulumi up' will log a warning if the resource is used. If present and set to \"true\", this warning is omitted.", + TypeSpec: pschema.TypeSpec{Type: "boolean"}, + }, + }, + Type: "object", + }, +} + var helmV3ReleaseResource = pschema.ResourceSpec{ ObjectTypeSpec: pschema.ObjectTypeSpec{ Description: "A Release is an instance of a chart running in a Kubernetes cluster.\n\nA Chart is a Helm package. It contains all of the resource definitions necessary to run an application, tool, or service inside of a Kubernetes cluster.", @@ -974,6 +1037,7 @@ func init() { typeOverlays["kubernetes:helm.sh/v3:RepositoryOpts"] = helmV3RepoOpts typeOverlays["kubernetes:helm.sh/v3:ReleaseStatus"] = helmV3ReleaseStatus typeOverlays["kubernetes:index:KubeClientSettings"] = kubeClientSettings + typeOverlays["kubernetes:index:HelmReleaseSettings"] = helmReleaseSettings resourceOverlays["kubernetes:helm.sh/v3:Release"] = helmV3ReleaseResource } diff --git a/provider/pkg/gen/schema.go b/provider/pkg/gen/schema.go index 95c67dd8ae..192de67c33 100644 --- a/provider/pkg/gen/schema.go +++ b/provider/pkg/gen/schema.go @@ -76,30 +76,6 @@ func PulumiSchema(swagger map[string]interface{}) pschema.PackageSpec { Description: "If present and set to true, suppress apiVersion deprecation warnings from the CLI.\n\nThis config can be specified in the following ways, using this precedence:\n1. This `suppressDeprecationWarnings` parameter.\n2. The `PULUMI_K8S_SUPPRESS_DEPRECATION_WARNINGS` environment variable.", TypeSpec: pschema.TypeSpec{Type: "boolean"}, }, - "suppressHelmReleaseBetaWarning": { - Description: "While Helm Release provider is in beta, by default 'pulumi up' will log a warning if the resource is used. If present and set to true, this warning is omitted.", - TypeSpec: pschema.TypeSpec{Type: "boolean"}, - }, - "helmDriver": { - Description: "BETA FEATURE - Used for supporting Helm Release resource (Beta). The backend storage driver for Helm. Values are: configmap, secret, memory, sql.", - TypeSpec: pschema.TypeSpec{Type: "string"}, - }, - "helmPluginsPath": { - Description: "BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the helm plugins directory.", - TypeSpec: pschema.TypeSpec{Type: "string"}, - }, - "helmRegistryConfigPath": { - Description: "BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the registry config file.", - TypeSpec: pschema.TypeSpec{Type: "string"}, - }, - "helmRepositoryConfigPath": { - Description: "BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the file containing repository names and URLs.", - TypeSpec: pschema.TypeSpec{Type: "string"}, - }, - "helmRepositoryCache": { - Description: "BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the file containing cached repository indexes.", - TypeSpec: pschema.TypeSpec{Type: "string"}, - }, "suppressHelmHookWarnings": { Description: "If present and set to true, suppress unsupported Helm hook warnings from the CLI.\n\nThis config can be specified in the following ways, using this precedence:\n1. This `suppressHelmHookWarnings` parameter.\n2. The `PULUMI_K8S_SUPPRESS_HELM_HOOK_WARNINGS` environment variable.", TypeSpec: pschema.TypeSpec{Type: "boolean"}, @@ -161,64 +137,14 @@ func PulumiSchema(swagger map[string]interface{}) pschema.PackageSpec { Description: "If present and set to true, suppress apiVersion deprecation warnings from the CLI.", TypeSpec: pschema.TypeSpec{Type: "boolean"}, }, - "suppressHelmReleaseBetaWarning": { - DefaultInfo: &pschema.DefaultSpec{ - Environment: []string{ - "PULUMI_K8S_SUPPRESS_HELM_RELEASE_BETA_WARNING", - }, - }, - Description: "While Helm Release provider is in beta, by default 'pulumi up' will log a warning if the resource is used. If present and set to \"true\", this warning is omitted.", - TypeSpec: pschema.TypeSpec{Type: "boolean"}, - }, - "helmDriver": { - DefaultInfo: &pschema.DefaultSpec{ - Environment: []string{ - "PULUMI_K8S_HELM_DRIVER", - }, - }, - Description: "BETA FEATURE - Used for supporting Helm Release resource (Beta). The backend storage driver for Helm. Values are: configmap, secret, memory, sql.", - TypeSpec: pschema.TypeSpec{Type: "string"}, - }, - "helmPluginsPath": { - DefaultInfo: &pschema.DefaultSpec{ - Environment: []string{ - "PULUMI_K8S_HELM_PLUGINS_PATH", - }, - }, - Description: "BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the helm plugins directory.", - TypeSpec: pschema.TypeSpec{Type: "string"}, - }, - "helmRegistryConfigPath": { - DefaultInfo: &pschema.DefaultSpec{ - Environment: []string{ - "PULUMI_K8S_HELM_REGISTRY_CONFIG_PATH", - }, - }, - Description: "BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the registry config file.", - TypeSpec: pschema.TypeSpec{Type: "string"}, - }, - "helmRepositoryConfigPath": { - DefaultInfo: &pschema.DefaultSpec{ - Environment: []string{ - "PULUMI_K8S_HELM_REPOSITORY_CONFIG_PATH", - }, - }, - Description: "BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the file containing repository names and URLs.", - TypeSpec: pschema.TypeSpec{Type: "string"}, - }, - "helmRepositoryCache": { - DefaultInfo: &pschema.DefaultSpec{ - Environment: []string{ - "PULUMI_K8s_HELM_REPOSITORY_CACHE", - }, - }, - Description: "BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the file containing cached repository indexes.", - TypeSpec: pschema.TypeSpec{Type: "string"}, - }, "kubeClientSettings": { Description: "Options for tuning the Kubernetes client used by a Provider.", TypeSpec: pschema.TypeSpec{Ref: "#/types/kubernetes:index:KubeClientSettings"}, }, + "helmReleaseSettings": { + Description: "BETA FEATURE - Options to configure the Helm Release resource.", + TypeSpec: pschema.TypeSpec{Ref: "#/types/kubernetes:index:HelmReleaseSettings"}, + }, "suppressHelmHookWarnings": { DefaultInfo: &pschema.DefaultSpec{ Environment: []string{ From cbe2d481bebb42008f85f04d4544881db3cd11a4 Mon Sep 17 00:00:00 2001 From: Levi Blackstone Date: Mon, 4 Oct 2021 16:01:37 -0600 Subject: [PATCH 2/6] SDKs --- sdk/dotnet/Config/Config.cs | 60 ----- sdk/dotnet/Inputs/HelmReleaseSettingsArgs.cs | 64 +++++ sdk/dotnet/Provider.cs | 42 +--- sdk/go/kubernetes/config/config.go | 30 --- sdk/go/kubernetes/provider.go | 46 +--- sdk/go/kubernetes/providers/provider.go | 46 +--- sdk/go/kubernetes/pulumiTypes.go | 237 +++++++++++++++++++ sdk/nodejs/provider.ts | 31 +-- sdk/nodejs/types/input.ts | 30 +++ sdk/python/pulumi_kubernetes/_inputs.py | 117 +++++++++ sdk/python/pulumi_kubernetes/provider.py | 156 ++---------- 11 files changed, 478 insertions(+), 381 deletions(-) create mode 100644 sdk/dotnet/Inputs/HelmReleaseSettingsArgs.cs diff --git a/sdk/dotnet/Config/Config.cs b/sdk/dotnet/Config/Config.cs index 5039237cd1..3dc396ba37 100644 --- a/sdk/dotnet/Config/Config.cs +++ b/sdk/dotnet/Config/Config.cs @@ -67,56 +67,6 @@ public static bool? EnableDryRun set => _enableDryRun.Set(value); } - private static readonly __Value _helmDriver = new __Value(() => __config.Get("helmDriver")); - /// - /// BETA FEATURE - Used for supporting Helm Release resource (Beta). The backend storage driver for Helm. Values are: configmap, secret, memory, sql. - /// - public static string? HelmDriver - { - get => _helmDriver.Get(); - set => _helmDriver.Set(value); - } - - private static readonly __Value _helmPluginsPath = new __Value(() => __config.Get("helmPluginsPath")); - /// - /// BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the helm plugins directory. - /// - public static string? HelmPluginsPath - { - get => _helmPluginsPath.Get(); - set => _helmPluginsPath.Set(value); - } - - private static readonly __Value _helmRegistryConfigPath = new __Value(() => __config.Get("helmRegistryConfigPath")); - /// - /// BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the registry config file. - /// - public static string? HelmRegistryConfigPath - { - get => _helmRegistryConfigPath.Get(); - set => _helmRegistryConfigPath.Set(value); - } - - private static readonly __Value _helmRepositoryCache = new __Value(() => __config.Get("helmRepositoryCache")); - /// - /// BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the file containing cached repository indexes. - /// - public static string? HelmRepositoryCache - { - get => _helmRepositoryCache.Get(); - set => _helmRepositoryCache.Set(value); - } - - private static readonly __Value _helmRepositoryConfigPath = new __Value(() => __config.Get("helmRepositoryConfigPath")); - /// - /// BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the file containing repository names and URLs. - /// - public static string? HelmRepositoryConfigPath - { - get => _helmRepositoryConfigPath.Get(); - set => _helmRepositoryConfigPath.Set(value); - } - private static readonly __Value _kubeconfig = new __Value(() => __config.Get("kubeconfig")); /// /// The contents of a kubeconfig file or the path to a kubeconfig file. If this is set, this config will be used instead of $KUBECONFIG. @@ -187,15 +137,5 @@ public static bool? SuppressHelmHookWarnings set => _suppressHelmHookWarnings.Set(value); } - private static readonly __Value _suppressHelmReleaseBetaWarning = new __Value(() => __config.GetBoolean("suppressHelmReleaseBetaWarning")); - /// - /// While Helm Release provider is in beta, by default 'pulumi up' will log a warning if the resource is used. If present and set to true, this warning is omitted. - /// - public static bool? SuppressHelmReleaseBetaWarning - { - get => _suppressHelmReleaseBetaWarning.Get(); - set => _suppressHelmReleaseBetaWarning.Set(value); - } - } } diff --git a/sdk/dotnet/Inputs/HelmReleaseSettingsArgs.cs b/sdk/dotnet/Inputs/HelmReleaseSettingsArgs.cs new file mode 100644 index 0000000000..9495689d00 --- /dev/null +++ b/sdk/dotnet/Inputs/HelmReleaseSettingsArgs.cs @@ -0,0 +1,64 @@ +// *** WARNING: this file was generated by pulumigen. *** +// *** Do not edit by hand unless you're certain you know what you are doing! *** + +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Threading.Tasks; +using Pulumi.Serialization; + +namespace Pulumi.Kubernetes.Types.Inputs.Provider +{ + + /// + /// BETA FEATURE - Options to configure the Helm Release resource. + /// + public class HelmReleaseSettingsArgs : Pulumi.ResourceArgs + { + /// + /// The backend storage driver for Helm. Values are: configmap, secret, memory, sql. + /// + [Input("driver")] + public Input? Driver { get; set; } + + /// + /// The path to the helm plugins directory. + /// + [Input("pluginsPath")] + public Input? PluginsPath { get; set; } + + /// + /// The path to the registry config file. + /// + [Input("registryConfigPath")] + public Input? RegistryConfigPath { get; set; } + + /// + /// The path to the file containing cached repository indexes. + /// + [Input("repositoryCache")] + public Input? RepositoryCache { get; set; } + + /// + /// The path to the file containing repository names and URLs. + /// + [Input("repositoryConfigPath")] + public Input? RepositoryConfigPath { get; set; } + + /// + /// While Helm Release provider is in beta, by default 'pulumi up' will log a warning if the resource is used. If present and set to "true", this warning is omitted. + /// + [Input("suppressBetaWarning")] + public Input? SuppressBetaWarning { get; set; } + + public HelmReleaseSettingsArgs() + { + Driver = Utilities.GetEnv("PULUMI_K8S_HELM_DRIVER"); + PluginsPath = Utilities.GetEnv("PULUMI_K8S_HELM_PLUGINS_PATH"); + RegistryConfigPath = Utilities.GetEnv("PULUMI_K8S_HELM_REGISTRY_CONFIG_PATH"); + RepositoryCache = Utilities.GetEnv("PULUMI_K8S_HELM_REPOSITORY_CACHE"); + RepositoryConfigPath = Utilities.GetEnv("PULUMI_K8S_HELM_REPOSITORY_CONFIG_PATH"); + SuppressBetaWarning = Utilities.GetEnvBoolean("PULUMI_K8S_SUPPRESS_HELM_RELEASE_BETA_WARNING"); + } + } +} diff --git a/sdk/dotnet/Provider.cs b/sdk/dotnet/Provider.cs index 04a937f34f..41cfe14d4e 100644 --- a/sdk/dotnet/Provider.cs +++ b/sdk/dotnet/Provider.cs @@ -66,34 +66,10 @@ public sealed class ProviderArgs : Pulumi.ResourceArgs public Input? EnableDryRun { get; set; } /// - /// BETA FEATURE - Used for supporting Helm Release resource (Beta). The backend storage driver for Helm. Values are: configmap, secret, memory, sql. + /// BETA FEATURE - Options to configure the Helm Release resource. /// - [Input("helmDriver")] - public Input? HelmDriver { get; set; } - - /// - /// BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the helm plugins directory. - /// - [Input("helmPluginsPath")] - public Input? HelmPluginsPath { get; set; } - - /// - /// BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the registry config file. - /// - [Input("helmRegistryConfigPath")] - public Input? HelmRegistryConfigPath { get; set; } - - /// - /// BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the file containing cached repository indexes. - /// - [Input("helmRepositoryCache")] - public Input? HelmRepositoryCache { get; set; } - - /// - /// BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the file containing repository names and URLs. - /// - [Input("helmRepositoryConfigPath")] - public Input? HelmRepositoryConfigPath { get; set; } + [Input("helmReleaseSettings", json: true)] + public Input? HelmReleaseSettings { get; set; } /// /// Options for tuning the Kubernetes client used by a Provider. @@ -143,24 +119,12 @@ public sealed class ProviderArgs : Pulumi.ResourceArgs [Input("suppressHelmHookWarnings", json: true)] public Input? SuppressHelmHookWarnings { get; set; } - /// - /// While Helm Release provider is in beta, by default 'pulumi up' will log a warning if the resource is used. If present and set to "true", this warning is omitted. - /// - [Input("suppressHelmReleaseBetaWarning", json: true)] - public Input? SuppressHelmReleaseBetaWarning { get; set; } - public ProviderArgs() { EnableDryRun = Utilities.GetEnvBoolean("PULUMI_K8S_ENABLE_DRY_RUN"); - HelmDriver = Utilities.GetEnv("PULUMI_K8S_HELM_DRIVER"); - HelmPluginsPath = Utilities.GetEnv("PULUMI_K8S_HELM_PLUGINS_PATH"); - HelmRegistryConfigPath = Utilities.GetEnv("PULUMI_K8S_HELM_REGISTRY_CONFIG_PATH"); - HelmRepositoryCache = Utilities.GetEnv("PULUMI_K8s_HELM_REPOSITORY_CACHE"); - HelmRepositoryConfigPath = Utilities.GetEnv("PULUMI_K8S_HELM_REPOSITORY_CONFIG_PATH"); KubeConfig = Utilities.GetEnv("KUBECONFIG"); SuppressDeprecationWarnings = Utilities.GetEnvBoolean("PULUMI_K8S_SUPPRESS_DEPRECATION_WARNINGS"); SuppressHelmHookWarnings = Utilities.GetEnvBoolean("PULUMI_K8S_SUPPRESS_HELM_HOOK_WARNINGS"); - SuppressHelmReleaseBetaWarning = Utilities.GetEnvBoolean("PULUMI_K8S_SUPPRESS_HELM_RELEASE_BETA_WARNING"); } } } diff --git a/sdk/go/kubernetes/config/config.go b/sdk/go/kubernetes/config/config.go index 6c6d8261d5..6b8a759c2a 100644 --- a/sdk/go/kubernetes/config/config.go +++ b/sdk/go/kubernetes/config/config.go @@ -28,31 +28,6 @@ func GetEnableDryRun(ctx *pulumi.Context) bool { return config.GetBool(ctx, "kubernetes:enableDryRun") } -// BETA FEATURE - Used for supporting Helm Release resource (Beta). The backend storage driver for Helm. Values are: configmap, secret, memory, sql. -func GetHelmDriver(ctx *pulumi.Context) string { - return config.Get(ctx, "kubernetes:helmDriver") -} - -// BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the helm plugins directory. -func GetHelmPluginsPath(ctx *pulumi.Context) string { - return config.Get(ctx, "kubernetes:helmPluginsPath") -} - -// BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the registry config file. -func GetHelmRegistryConfigPath(ctx *pulumi.Context) string { - return config.Get(ctx, "kubernetes:helmRegistryConfigPath") -} - -// BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the file containing cached repository indexes. -func GetHelmRepositoryCache(ctx *pulumi.Context) string { - return config.Get(ctx, "kubernetes:helmRepositoryCache") -} - -// BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the file containing repository names and URLs. -func GetHelmRepositoryConfigPath(ctx *pulumi.Context) string { - return config.Get(ctx, "kubernetes:helmRepositoryConfigPath") -} - // The contents of a kubeconfig file or the path to a kubeconfig file. If this is set, this config will be used instead of $KUBECONFIG. func GetKubeconfig(ctx *pulumi.Context) string { return config.Get(ctx, "kubernetes:kubeconfig") @@ -97,8 +72,3 @@ func GetSuppressDeprecationWarnings(ctx *pulumi.Context) bool { func GetSuppressHelmHookWarnings(ctx *pulumi.Context) bool { return config.GetBool(ctx, "kubernetes:suppressHelmHookWarnings") } - -// While Helm Release provider is in beta, by default 'pulumi up' will log a warning if the resource is used. If present and set to true, this warning is omitted. -func GetSuppressHelmReleaseBetaWarning(ctx *pulumi.Context) bool { - return config.GetBool(ctx, "kubernetes:suppressHelmReleaseBetaWarning") -} diff --git a/sdk/go/kubernetes/provider.go b/sdk/go/kubernetes/provider.go index 7615dd9391..cad9a05f93 100644 --- a/sdk/go/kubernetes/provider.go +++ b/sdk/go/kubernetes/provider.go @@ -25,21 +25,6 @@ func NewProvider(ctx *pulumi.Context, if args.EnableDryRun == nil { args.EnableDryRun = pulumi.BoolPtr(getEnvOrDefault(false, parseEnvBool, "PULUMI_K8S_ENABLE_DRY_RUN").(bool)) } - if args.HelmDriver == nil { - args.HelmDriver = pulumi.StringPtr(getEnvOrDefault("", nil, "PULUMI_K8S_HELM_DRIVER").(string)) - } - if args.HelmPluginsPath == nil { - args.HelmPluginsPath = pulumi.StringPtr(getEnvOrDefault("", nil, "PULUMI_K8S_HELM_PLUGINS_PATH").(string)) - } - if args.HelmRegistryConfigPath == nil { - args.HelmRegistryConfigPath = pulumi.StringPtr(getEnvOrDefault("", nil, "PULUMI_K8S_HELM_REGISTRY_CONFIG_PATH").(string)) - } - if args.HelmRepositoryCache == nil { - args.HelmRepositoryCache = pulumi.StringPtr(getEnvOrDefault("", nil, "PULUMI_K8s_HELM_REPOSITORY_CACHE").(string)) - } - if args.HelmRepositoryConfigPath == nil { - args.HelmRepositoryConfigPath = pulumi.StringPtr(getEnvOrDefault("", nil, "PULUMI_K8S_HELM_REPOSITORY_CONFIG_PATH").(string)) - } if args.Kubeconfig == nil { args.Kubeconfig = pulumi.StringPtr(getEnvOrDefault("", nil, "KUBECONFIG").(string)) } @@ -49,9 +34,6 @@ func NewProvider(ctx *pulumi.Context, if args.SuppressHelmHookWarnings == nil { args.SuppressHelmHookWarnings = pulumi.BoolPtr(getEnvOrDefault(false, parseEnvBool, "PULUMI_K8S_SUPPRESS_HELM_HOOK_WARNINGS").(bool)) } - if args.SuppressHelmReleaseBetaWarning == nil { - args.SuppressHelmReleaseBetaWarning = pulumi.BoolPtr(getEnvOrDefault(false, parseEnvBool, "PULUMI_K8S_SUPPRESS_HELM_RELEASE_BETA_WARNING").(bool)) - } var resource Provider err := ctx.RegisterResource("pulumi:providers:kubernetes", name, args, &resource, opts...) if err != nil { @@ -68,16 +50,8 @@ type providerArgs struct { // BETA FEATURE - If present and set to true, enable server-side diff calculations. // This feature is in developer preview, and is disabled by default. EnableDryRun *bool `pulumi:"enableDryRun"` - // BETA FEATURE - Used for supporting Helm Release resource (Beta). The backend storage driver for Helm. Values are: configmap, secret, memory, sql. - HelmDriver *string `pulumi:"helmDriver"` - // BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the helm plugins directory. - HelmPluginsPath *string `pulumi:"helmPluginsPath"` - // BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the registry config file. - HelmRegistryConfigPath *string `pulumi:"helmRegistryConfigPath"` - // BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the file containing cached repository indexes. - HelmRepositoryCache *string `pulumi:"helmRepositoryCache"` - // BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the file containing repository names and URLs. - HelmRepositoryConfigPath *string `pulumi:"helmRepositoryConfigPath"` + // BETA FEATURE - Options to configure the Helm Release resource. + HelmReleaseSettings *HelmReleaseSettings `pulumi:"helmReleaseSettings"` // Options for tuning the Kubernetes client used by a Provider. KubeClientSettings *KubeClientSettings `pulumi:"kubeClientSettings"` // The contents of a kubeconfig file or the path to a kubeconfig file. @@ -102,8 +76,6 @@ type providerArgs struct { SuppressDeprecationWarnings *bool `pulumi:"suppressDeprecationWarnings"` // If present and set to true, suppress unsupported Helm hook warnings from the CLI. SuppressHelmHookWarnings *bool `pulumi:"suppressHelmHookWarnings"` - // While Helm Release provider is in beta, by default 'pulumi up' will log a warning if the resource is used. If present and set to "true", this warning is omitted. - SuppressHelmReleaseBetaWarning *bool `pulumi:"suppressHelmReleaseBetaWarning"` } // The set of arguments for constructing a Provider resource. @@ -115,16 +87,8 @@ type ProviderArgs struct { // BETA FEATURE - If present and set to true, enable server-side diff calculations. // This feature is in developer preview, and is disabled by default. EnableDryRun pulumi.BoolPtrInput - // BETA FEATURE - Used for supporting Helm Release resource (Beta). The backend storage driver for Helm. Values are: configmap, secret, memory, sql. - HelmDriver pulumi.StringPtrInput - // BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the helm plugins directory. - HelmPluginsPath pulumi.StringPtrInput - // BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the registry config file. - HelmRegistryConfigPath pulumi.StringPtrInput - // BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the file containing cached repository indexes. - HelmRepositoryCache pulumi.StringPtrInput - // BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the file containing repository names and URLs. - HelmRepositoryConfigPath pulumi.StringPtrInput + // BETA FEATURE - Options to configure the Helm Release resource. + HelmReleaseSettings HelmReleaseSettingsPtrInput // Options for tuning the Kubernetes client used by a Provider. KubeClientSettings KubeClientSettingsPtrInput // The contents of a kubeconfig file or the path to a kubeconfig file. @@ -149,8 +113,6 @@ type ProviderArgs struct { SuppressDeprecationWarnings pulumi.BoolPtrInput // If present and set to true, suppress unsupported Helm hook warnings from the CLI. SuppressHelmHookWarnings pulumi.BoolPtrInput - // While Helm Release provider is in beta, by default 'pulumi up' will log a warning if the resource is used. If present and set to "true", this warning is omitted. - SuppressHelmReleaseBetaWarning pulumi.BoolPtrInput } func (ProviderArgs) ElementType() reflect.Type { diff --git a/sdk/go/kubernetes/providers/provider.go b/sdk/go/kubernetes/providers/provider.go index c539cef66e..5862a62030 100644 --- a/sdk/go/kubernetes/providers/provider.go +++ b/sdk/go/kubernetes/providers/provider.go @@ -27,21 +27,6 @@ func NewProvider(ctx *pulumi.Context, if args.EnableDryRun == nil { args.EnableDryRun = pulumi.BoolPtr(getEnvOrDefault(false, parseEnvBool, "PULUMI_K8S_ENABLE_DRY_RUN").(bool)) } - if args.HelmDriver == nil { - args.HelmDriver = pulumi.StringPtr(getEnvOrDefault("", nil, "PULUMI_K8S_HELM_DRIVER").(string)) - } - if args.HelmPluginsPath == nil { - args.HelmPluginsPath = pulumi.StringPtr(getEnvOrDefault("", nil, "PULUMI_K8S_HELM_PLUGINS_PATH").(string)) - } - if args.HelmRegistryConfigPath == nil { - args.HelmRegistryConfigPath = pulumi.StringPtr(getEnvOrDefault("", nil, "PULUMI_K8S_HELM_REGISTRY_CONFIG_PATH").(string)) - } - if args.HelmRepositoryCache == nil { - args.HelmRepositoryCache = pulumi.StringPtr(getEnvOrDefault("", nil, "PULUMI_K8s_HELM_REPOSITORY_CACHE").(string)) - } - if args.HelmRepositoryConfigPath == nil { - args.HelmRepositoryConfigPath = pulumi.StringPtr(getEnvOrDefault("", nil, "PULUMI_K8S_HELM_REPOSITORY_CONFIG_PATH").(string)) - } if args.Kubeconfig == nil { args.Kubeconfig = pulumi.StringPtr(getEnvOrDefault("", nil, "KUBECONFIG").(string)) } @@ -51,9 +36,6 @@ func NewProvider(ctx *pulumi.Context, if args.SuppressHelmHookWarnings == nil { args.SuppressHelmHookWarnings = pulumi.BoolPtr(getEnvOrDefault(false, parseEnvBool, "PULUMI_K8S_SUPPRESS_HELM_HOOK_WARNINGS").(bool)) } - if args.SuppressHelmReleaseBetaWarning == nil { - args.SuppressHelmReleaseBetaWarning = pulumi.BoolPtr(getEnvOrDefault(false, parseEnvBool, "PULUMI_K8S_SUPPRESS_HELM_RELEASE_BETA_WARNING").(bool)) - } var resource Provider err := ctx.RegisterResource("pulumi:providers:kubernetes", name, args, &resource, opts...) if err != nil { @@ -71,16 +53,8 @@ type providerArgs struct { // BETA FEATURE - If present and set to true, enable server-side diff calculations. // This feature is in developer preview, and is disabled by default. EnableDryRun *bool `pulumi:"enableDryRun"` - // BETA FEATURE - Used for supporting Helm Release resource (Beta). The backend storage driver for Helm. Values are: configmap, secret, memory, sql. - HelmDriver *string `pulumi:"helmDriver"` - // BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the helm plugins directory. - HelmPluginsPath *string `pulumi:"helmPluginsPath"` - // BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the registry config file. - HelmRegistryConfigPath *string `pulumi:"helmRegistryConfigPath"` - // BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the file containing cached repository indexes. - HelmRepositoryCache *string `pulumi:"helmRepositoryCache"` - // BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the file containing repository names and URLs. - HelmRepositoryConfigPath *string `pulumi:"helmRepositoryConfigPath"` + // BETA FEATURE - Options to configure the Helm Release resource. + HelmReleaseSettings *HelmReleaseSettings `pulumi:"helmReleaseSettings"` // Options for tuning the Kubernetes client used by a Provider. KubeClientSettings *KubeClientSettings `pulumi:"kubeClientSettings"` // The contents of a kubeconfig file or the path to a kubeconfig file. @@ -105,8 +79,6 @@ type providerArgs struct { SuppressDeprecationWarnings *bool `pulumi:"suppressDeprecationWarnings"` // If present and set to true, suppress unsupported Helm hook warnings from the CLI. SuppressHelmHookWarnings *bool `pulumi:"suppressHelmHookWarnings"` - // While Helm Release provider is in beta, by default 'pulumi up' will log a warning if the resource is used. If present and set to "true", this warning is omitted. - SuppressHelmReleaseBetaWarning *bool `pulumi:"suppressHelmReleaseBetaWarning"` } // The set of arguments for constructing a Provider resource. @@ -119,16 +91,8 @@ type ProviderArgs struct { // BETA FEATURE - If present and set to true, enable server-side diff calculations. // This feature is in developer preview, and is disabled by default. EnableDryRun pulumi.BoolPtrInput - // BETA FEATURE - Used for supporting Helm Release resource (Beta). The backend storage driver for Helm. Values are: configmap, secret, memory, sql. - HelmDriver pulumi.StringPtrInput - // BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the helm plugins directory. - HelmPluginsPath pulumi.StringPtrInput - // BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the registry config file. - HelmRegistryConfigPath pulumi.StringPtrInput - // BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the file containing cached repository indexes. - HelmRepositoryCache pulumi.StringPtrInput - // BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the file containing repository names and URLs. - HelmRepositoryConfigPath pulumi.StringPtrInput + // BETA FEATURE - Options to configure the Helm Release resource. + HelmReleaseSettings HelmReleaseSettingsPtrInput // Options for tuning the Kubernetes client used by a Provider. KubeClientSettings KubeClientSettingsPtrInput // The contents of a kubeconfig file or the path to a kubeconfig file. @@ -153,8 +117,6 @@ type ProviderArgs struct { SuppressDeprecationWarnings pulumi.BoolPtrInput // If present and set to true, suppress unsupported Helm hook warnings from the CLI. SuppressHelmHookWarnings pulumi.BoolPtrInput - // While Helm Release provider is in beta, by default 'pulumi up' will log a warning if the resource is used. If present and set to "true", this warning is omitted. - SuppressHelmReleaseBetaWarning pulumi.BoolPtrInput } // Deprecated: Use `github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes` instead diff --git a/sdk/go/kubernetes/pulumiTypes.go b/sdk/go/kubernetes/pulumiTypes.go index 49601ac365..0be955c750 100644 --- a/sdk/go/kubernetes/pulumiTypes.go +++ b/sdk/go/kubernetes/pulumiTypes.go @@ -10,6 +10,241 @@ import ( "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) +// BETA FEATURE - Options to configure the Helm Release resource. +type HelmReleaseSettings struct { + // The backend storage driver for Helm. Values are: configmap, secret, memory, sql. + Driver *string `pulumi:"driver"` + // The path to the helm plugins directory. + PluginsPath *string `pulumi:"pluginsPath"` + // The path to the registry config file. + RegistryConfigPath *string `pulumi:"registryConfigPath"` + // The path to the file containing cached repository indexes. + RepositoryCache *string `pulumi:"repositoryCache"` + // The path to the file containing repository names and URLs. + RepositoryConfigPath *string `pulumi:"repositoryConfigPath"` + // While Helm Release provider is in beta, by default 'pulumi up' will log a warning if the resource is used. If present and set to "true", this warning is omitted. + SuppressBetaWarning *bool `pulumi:"suppressBetaWarning"` +} + +// HelmReleaseSettingsInput is an input type that accepts HelmReleaseSettingsArgs and HelmReleaseSettingsOutput values. +// You can construct a concrete instance of `HelmReleaseSettingsInput` via: +// +// HelmReleaseSettingsArgs{...} +type HelmReleaseSettingsInput interface { + pulumi.Input + + ToHelmReleaseSettingsOutput() HelmReleaseSettingsOutput + ToHelmReleaseSettingsOutputWithContext(context.Context) HelmReleaseSettingsOutput +} + +// BETA FEATURE - Options to configure the Helm Release resource. +type HelmReleaseSettingsArgs struct { + // The backend storage driver for Helm. Values are: configmap, secret, memory, sql. + Driver pulumi.StringPtrInput `pulumi:"driver"` + // The path to the helm plugins directory. + PluginsPath pulumi.StringPtrInput `pulumi:"pluginsPath"` + // The path to the registry config file. + RegistryConfigPath pulumi.StringPtrInput `pulumi:"registryConfigPath"` + // The path to the file containing cached repository indexes. + RepositoryCache pulumi.StringPtrInput `pulumi:"repositoryCache"` + // The path to the file containing repository names and URLs. + RepositoryConfigPath pulumi.StringPtrInput `pulumi:"repositoryConfigPath"` + // While Helm Release provider is in beta, by default 'pulumi up' will log a warning if the resource is used. If present and set to "true", this warning is omitted. + SuppressBetaWarning pulumi.BoolPtrInput `pulumi:"suppressBetaWarning"` +} + +func (HelmReleaseSettingsArgs) ElementType() reflect.Type { + return reflect.TypeOf((*HelmReleaseSettings)(nil)).Elem() +} + +func (i HelmReleaseSettingsArgs) ToHelmReleaseSettingsOutput() HelmReleaseSettingsOutput { + return i.ToHelmReleaseSettingsOutputWithContext(context.Background()) +} + +func (i HelmReleaseSettingsArgs) ToHelmReleaseSettingsOutputWithContext(ctx context.Context) HelmReleaseSettingsOutput { + return pulumi.ToOutputWithContext(ctx, i).(HelmReleaseSettingsOutput) +} + +func (i HelmReleaseSettingsArgs) ToHelmReleaseSettingsPtrOutput() HelmReleaseSettingsPtrOutput { + return i.ToHelmReleaseSettingsPtrOutputWithContext(context.Background()) +} + +func (i HelmReleaseSettingsArgs) ToHelmReleaseSettingsPtrOutputWithContext(ctx context.Context) HelmReleaseSettingsPtrOutput { + return pulumi.ToOutputWithContext(ctx, i).(HelmReleaseSettingsOutput).ToHelmReleaseSettingsPtrOutputWithContext(ctx) +} + +// HelmReleaseSettingsPtrInput is an input type that accepts HelmReleaseSettingsArgs, HelmReleaseSettingsPtr and HelmReleaseSettingsPtrOutput values. +// You can construct a concrete instance of `HelmReleaseSettingsPtrInput` via: +// +// HelmReleaseSettingsArgs{...} +// +// or: +// +// nil +type HelmReleaseSettingsPtrInput interface { + pulumi.Input + + ToHelmReleaseSettingsPtrOutput() HelmReleaseSettingsPtrOutput + ToHelmReleaseSettingsPtrOutputWithContext(context.Context) HelmReleaseSettingsPtrOutput +} + +type helmReleaseSettingsPtrType HelmReleaseSettingsArgs + +func HelmReleaseSettingsPtr(v *HelmReleaseSettingsArgs) HelmReleaseSettingsPtrInput { + return (*helmReleaseSettingsPtrType)(v) +} + +func (*helmReleaseSettingsPtrType) ElementType() reflect.Type { + return reflect.TypeOf((**HelmReleaseSettings)(nil)).Elem() +} + +func (i *helmReleaseSettingsPtrType) ToHelmReleaseSettingsPtrOutput() HelmReleaseSettingsPtrOutput { + return i.ToHelmReleaseSettingsPtrOutputWithContext(context.Background()) +} + +func (i *helmReleaseSettingsPtrType) ToHelmReleaseSettingsPtrOutputWithContext(ctx context.Context) HelmReleaseSettingsPtrOutput { + return pulumi.ToOutputWithContext(ctx, i).(HelmReleaseSettingsPtrOutput) +} + +// BETA FEATURE - Options to configure the Helm Release resource. +type HelmReleaseSettingsOutput struct{ *pulumi.OutputState } + +func (HelmReleaseSettingsOutput) ElementType() reflect.Type { + return reflect.TypeOf((*HelmReleaseSettings)(nil)).Elem() +} + +func (o HelmReleaseSettingsOutput) ToHelmReleaseSettingsOutput() HelmReleaseSettingsOutput { + return o +} + +func (o HelmReleaseSettingsOutput) ToHelmReleaseSettingsOutputWithContext(ctx context.Context) HelmReleaseSettingsOutput { + return o +} + +func (o HelmReleaseSettingsOutput) ToHelmReleaseSettingsPtrOutput() HelmReleaseSettingsPtrOutput { + return o.ToHelmReleaseSettingsPtrOutputWithContext(context.Background()) +} + +func (o HelmReleaseSettingsOutput) ToHelmReleaseSettingsPtrOutputWithContext(ctx context.Context) HelmReleaseSettingsPtrOutput { + return o.ApplyTWithContext(ctx, func(_ context.Context, v HelmReleaseSettings) *HelmReleaseSettings { + return &v + }).(HelmReleaseSettingsPtrOutput) +} + +// The backend storage driver for Helm. Values are: configmap, secret, memory, sql. +func (o HelmReleaseSettingsOutput) Driver() pulumi.StringPtrOutput { + return o.ApplyT(func(v HelmReleaseSettings) *string { return v.Driver }).(pulumi.StringPtrOutput) +} + +// The path to the helm plugins directory. +func (o HelmReleaseSettingsOutput) PluginsPath() pulumi.StringPtrOutput { + return o.ApplyT(func(v HelmReleaseSettings) *string { return v.PluginsPath }).(pulumi.StringPtrOutput) +} + +// The path to the registry config file. +func (o HelmReleaseSettingsOutput) RegistryConfigPath() pulumi.StringPtrOutput { + return o.ApplyT(func(v HelmReleaseSettings) *string { return v.RegistryConfigPath }).(pulumi.StringPtrOutput) +} + +// The path to the file containing cached repository indexes. +func (o HelmReleaseSettingsOutput) RepositoryCache() pulumi.StringPtrOutput { + return o.ApplyT(func(v HelmReleaseSettings) *string { return v.RepositoryCache }).(pulumi.StringPtrOutput) +} + +// The path to the file containing repository names and URLs. +func (o HelmReleaseSettingsOutput) RepositoryConfigPath() pulumi.StringPtrOutput { + return o.ApplyT(func(v HelmReleaseSettings) *string { return v.RepositoryConfigPath }).(pulumi.StringPtrOutput) +} + +// While Helm Release provider is in beta, by default 'pulumi up' will log a warning if the resource is used. If present and set to "true", this warning is omitted. +func (o HelmReleaseSettingsOutput) SuppressBetaWarning() pulumi.BoolPtrOutput { + return o.ApplyT(func(v HelmReleaseSettings) *bool { return v.SuppressBetaWarning }).(pulumi.BoolPtrOutput) +} + +type HelmReleaseSettingsPtrOutput struct{ *pulumi.OutputState } + +func (HelmReleaseSettingsPtrOutput) ElementType() reflect.Type { + return reflect.TypeOf((**HelmReleaseSettings)(nil)).Elem() +} + +func (o HelmReleaseSettingsPtrOutput) ToHelmReleaseSettingsPtrOutput() HelmReleaseSettingsPtrOutput { + return o +} + +func (o HelmReleaseSettingsPtrOutput) ToHelmReleaseSettingsPtrOutputWithContext(ctx context.Context) HelmReleaseSettingsPtrOutput { + return o +} + +func (o HelmReleaseSettingsPtrOutput) Elem() HelmReleaseSettingsOutput { + return o.ApplyT(func(v *HelmReleaseSettings) HelmReleaseSettings { + if v != nil { + return *v + } + var ret HelmReleaseSettings + return ret + }).(HelmReleaseSettingsOutput) +} + +// The backend storage driver for Helm. Values are: configmap, secret, memory, sql. +func (o HelmReleaseSettingsPtrOutput) Driver() pulumi.StringPtrOutput { + return o.ApplyT(func(v *HelmReleaseSettings) *string { + if v == nil { + return nil + } + return v.Driver + }).(pulumi.StringPtrOutput) +} + +// The path to the helm plugins directory. +func (o HelmReleaseSettingsPtrOutput) PluginsPath() pulumi.StringPtrOutput { + return o.ApplyT(func(v *HelmReleaseSettings) *string { + if v == nil { + return nil + } + return v.PluginsPath + }).(pulumi.StringPtrOutput) +} + +// The path to the registry config file. +func (o HelmReleaseSettingsPtrOutput) RegistryConfigPath() pulumi.StringPtrOutput { + return o.ApplyT(func(v *HelmReleaseSettings) *string { + if v == nil { + return nil + } + return v.RegistryConfigPath + }).(pulumi.StringPtrOutput) +} + +// The path to the file containing cached repository indexes. +func (o HelmReleaseSettingsPtrOutput) RepositoryCache() pulumi.StringPtrOutput { + return o.ApplyT(func(v *HelmReleaseSettings) *string { + if v == nil { + return nil + } + return v.RepositoryCache + }).(pulumi.StringPtrOutput) +} + +// The path to the file containing repository names and URLs. +func (o HelmReleaseSettingsPtrOutput) RepositoryConfigPath() pulumi.StringPtrOutput { + return o.ApplyT(func(v *HelmReleaseSettings) *string { + if v == nil { + return nil + } + return v.RepositoryConfigPath + }).(pulumi.StringPtrOutput) +} + +// While Helm Release provider is in beta, by default 'pulumi up' will log a warning if the resource is used. If present and set to "true", this warning is omitted. +func (o HelmReleaseSettingsPtrOutput) SuppressBetaWarning() pulumi.BoolPtrOutput { + return o.ApplyT(func(v *HelmReleaseSettings) *bool { + if v == nil { + return nil + } + return v.SuppressBetaWarning + }).(pulumi.BoolPtrOutput) +} + // Options for tuning the Kubernetes client used by a Provider. type KubeClientSettings struct { // Maximum burst for throttle. Default value is 10. @@ -170,6 +405,8 @@ func (o KubeClientSettingsPtrOutput) Qps() pulumi.Float64PtrOutput { } func init() { + pulumi.RegisterOutputType(HelmReleaseSettingsOutput{}) + pulumi.RegisterOutputType(HelmReleaseSettingsPtrOutput{}) pulumi.RegisterOutputType(KubeClientSettingsOutput{}) pulumi.RegisterOutputType(KubeClientSettingsPtrOutput{}) } diff --git a/sdk/nodejs/provider.ts b/sdk/nodejs/provider.ts index 5c3df98529..6f60369fbb 100644 --- a/sdk/nodejs/provider.ts +++ b/sdk/nodejs/provider.ts @@ -38,18 +38,13 @@ export class Provider extends pulumi.ProviderResource { inputs["cluster"] = args ? args.cluster : undefined; inputs["context"] = args ? args.context : undefined; inputs["enableDryRun"] = pulumi.output((args ? args.enableDryRun : undefined) ?? utilities.getEnvBoolean("PULUMI_K8S_ENABLE_DRY_RUN")).apply(JSON.stringify); - inputs["helmDriver"] = (args ? args.helmDriver : undefined) ?? utilities.getEnv("PULUMI_K8S_HELM_DRIVER"); - inputs["helmPluginsPath"] = (args ? args.helmPluginsPath : undefined) ?? utilities.getEnv("PULUMI_K8S_HELM_PLUGINS_PATH"); - inputs["helmRegistryConfigPath"] = (args ? args.helmRegistryConfigPath : undefined) ?? utilities.getEnv("PULUMI_K8S_HELM_REGISTRY_CONFIG_PATH"); - inputs["helmRepositoryCache"] = (args ? args.helmRepositoryCache : undefined) ?? utilities.getEnv("PULUMI_K8s_HELM_REPOSITORY_CACHE"); - inputs["helmRepositoryConfigPath"] = (args ? args.helmRepositoryConfigPath : undefined) ?? utilities.getEnv("PULUMI_K8S_HELM_REPOSITORY_CONFIG_PATH"); + inputs["helmReleaseSettings"] = pulumi.output(args ? args.helmReleaseSettings : undefined).apply(JSON.stringify); inputs["kubeClientSettings"] = pulumi.output(args ? args.kubeClientSettings : undefined).apply(JSON.stringify); inputs["kubeconfig"] = (args ? args.kubeconfig : undefined) ?? utilities.getEnv("KUBECONFIG"); inputs["namespace"] = args ? args.namespace : undefined; inputs["renderYamlToDirectory"] = args ? args.renderYamlToDirectory : undefined; inputs["suppressDeprecationWarnings"] = pulumi.output((args ? args.suppressDeprecationWarnings : undefined) ?? utilities.getEnvBoolean("PULUMI_K8S_SUPPRESS_DEPRECATION_WARNINGS")).apply(JSON.stringify); inputs["suppressHelmHookWarnings"] = pulumi.output((args ? args.suppressHelmHookWarnings : undefined) ?? utilities.getEnvBoolean("PULUMI_K8S_SUPPRESS_HELM_HOOK_WARNINGS")).apply(JSON.stringify); - inputs["suppressHelmReleaseBetaWarning"] = pulumi.output((args ? args.suppressHelmReleaseBetaWarning : undefined) ?? utilities.getEnvBoolean("PULUMI_K8S_SUPPRESS_HELM_RELEASE_BETA_WARNING")).apply(JSON.stringify); } if (!opts.version) { opts = pulumi.mergeOptions(opts, { version: utilities.getVersion()}); @@ -76,25 +71,9 @@ export interface ProviderArgs { */ enableDryRun?: pulumi.Input; /** - * BETA FEATURE - Used for supporting Helm Release resource (Beta). The backend storage driver for Helm. Values are: configmap, secret, memory, sql. + * BETA FEATURE - Options to configure the Helm Release resource. */ - helmDriver?: pulumi.Input; - /** - * BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the helm plugins directory. - */ - helmPluginsPath?: pulumi.Input; - /** - * BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the registry config file. - */ - helmRegistryConfigPath?: pulumi.Input; - /** - * BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the file containing cached repository indexes. - */ - helmRepositoryCache?: pulumi.Input; - /** - * BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the file containing repository names and URLs. - */ - helmRepositoryConfigPath?: pulumi.Input; + helmReleaseSettings?: pulumi.Input; /** * Options for tuning the Kubernetes client used by a Provider. */ @@ -131,8 +110,4 @@ export interface ProviderArgs { * If present and set to true, suppress unsupported Helm hook warnings from the CLI. */ suppressHelmHookWarnings?: pulumi.Input; - /** - * While Helm Release provider is in beta, by default 'pulumi up' will log a warning if the resource is used. If present and set to "true", this warning is omitted. - */ - suppressHelmReleaseBetaWarning?: pulumi.Input; } diff --git a/sdk/nodejs/types/input.ts b/sdk/nodejs/types/input.ts index 0177485a3e..5b9e4c4299 100644 --- a/sdk/nodejs/types/input.ts +++ b/sdk/nodejs/types/input.ts @@ -4,6 +4,36 @@ import * as pulumi from "@pulumi/pulumi"; import { input as inputs, output as outputs, enums } from "../types"; +/** + * BETA FEATURE - Options to configure the Helm Release resource. + */ +export interface HelmReleaseSettings { + /** + * The backend storage driver for Helm. Values are: configmap, secret, memory, sql. + */ + driver?: pulumi.Input; + /** + * The path to the helm plugins directory. + */ + pluginsPath?: pulumi.Input; + /** + * The path to the registry config file. + */ + registryConfigPath?: pulumi.Input; + /** + * The path to the file containing cached repository indexes. + */ + repositoryCache?: pulumi.Input; + /** + * The path to the file containing repository names and URLs. + */ + repositoryConfigPath?: pulumi.Input; + /** + * While Helm Release provider is in beta, by default 'pulumi up' will log a warning if the resource is used. If present and set to "true", this warning is omitted. + */ + suppressBetaWarning?: pulumi.Input; +} + /** * Options for tuning the Kubernetes client used by a Provider. */ diff --git a/sdk/python/pulumi_kubernetes/_inputs.py b/sdk/python/pulumi_kubernetes/_inputs.py index c102ccee1c..89e26e418a 100644 --- a/sdk/python/pulumi_kubernetes/_inputs.py +++ b/sdk/python/pulumi_kubernetes/_inputs.py @@ -9,9 +9,126 @@ from . import _utilities __all__ = [ + 'HelmReleaseSettingsArgs', 'KubeClientSettingsArgs', ] +@pulumi.input_type +class HelmReleaseSettingsArgs: + def __init__(__self__, *, + driver: Optional[pulumi.Input[str]] = None, + plugins_path: Optional[pulumi.Input[str]] = None, + registry_config_path: Optional[pulumi.Input[str]] = None, + repository_cache: Optional[pulumi.Input[str]] = None, + repository_config_path: Optional[pulumi.Input[str]] = None, + suppress_beta_warning: Optional[pulumi.Input[bool]] = None): + """ + BETA FEATURE - Options to configure the Helm Release resource. + :param pulumi.Input[str] driver: The backend storage driver for Helm. Values are: configmap, secret, memory, sql. + :param pulumi.Input[str] plugins_path: The path to the helm plugins directory. + :param pulumi.Input[str] registry_config_path: The path to the registry config file. + :param pulumi.Input[str] repository_cache: The path to the file containing cached repository indexes. + :param pulumi.Input[str] repository_config_path: The path to the file containing repository names and URLs. + :param pulumi.Input[bool] suppress_beta_warning: While Helm Release provider is in beta, by default 'pulumi up' will log a warning if the resource is used. If present and set to "true", this warning is omitted. + """ + if driver is None: + driver = _utilities.get_env('PULUMI_K8S_HELM_DRIVER') + if driver is not None: + pulumi.set(__self__, "driver", driver) + if plugins_path is None: + plugins_path = _utilities.get_env('PULUMI_K8S_HELM_PLUGINS_PATH') + if plugins_path is not None: + pulumi.set(__self__, "plugins_path", plugins_path) + if registry_config_path is None: + registry_config_path = _utilities.get_env('PULUMI_K8S_HELM_REGISTRY_CONFIG_PATH') + if registry_config_path is not None: + pulumi.set(__self__, "registry_config_path", registry_config_path) + if repository_cache is None: + repository_cache = _utilities.get_env('PULUMI_K8S_HELM_REPOSITORY_CACHE') + if repository_cache is not None: + pulumi.set(__self__, "repository_cache", repository_cache) + if repository_config_path is None: + repository_config_path = _utilities.get_env('PULUMI_K8S_HELM_REPOSITORY_CONFIG_PATH') + if repository_config_path is not None: + pulumi.set(__self__, "repository_config_path", repository_config_path) + if suppress_beta_warning is None: + suppress_beta_warning = _utilities.get_env_bool('PULUMI_K8S_SUPPRESS_HELM_RELEASE_BETA_WARNING') + if suppress_beta_warning is not None: + pulumi.set(__self__, "suppress_beta_warning", suppress_beta_warning) + + @property + @pulumi.getter + def driver(self) -> Optional[pulumi.Input[str]]: + """ + The backend storage driver for Helm. Values are: configmap, secret, memory, sql. + """ + return pulumi.get(self, "driver") + + @driver.setter + def driver(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "driver", value) + + @property + @pulumi.getter(name="pluginsPath") + def plugins_path(self) -> Optional[pulumi.Input[str]]: + """ + The path to the helm plugins directory. + """ + return pulumi.get(self, "plugins_path") + + @plugins_path.setter + def plugins_path(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "plugins_path", value) + + @property + @pulumi.getter(name="registryConfigPath") + def registry_config_path(self) -> Optional[pulumi.Input[str]]: + """ + The path to the registry config file. + """ + return pulumi.get(self, "registry_config_path") + + @registry_config_path.setter + def registry_config_path(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "registry_config_path", value) + + @property + @pulumi.getter(name="repositoryCache") + def repository_cache(self) -> Optional[pulumi.Input[str]]: + """ + The path to the file containing cached repository indexes. + """ + return pulumi.get(self, "repository_cache") + + @repository_cache.setter + def repository_cache(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "repository_cache", value) + + @property + @pulumi.getter(name="repositoryConfigPath") + def repository_config_path(self) -> Optional[pulumi.Input[str]]: + """ + The path to the file containing repository names and URLs. + """ + return pulumi.get(self, "repository_config_path") + + @repository_config_path.setter + def repository_config_path(self, value: Optional[pulumi.Input[str]]): + pulumi.set(self, "repository_config_path", value) + + @property + @pulumi.getter(name="suppressBetaWarning") + def suppress_beta_warning(self) -> Optional[pulumi.Input[bool]]: + """ + While Helm Release provider is in beta, by default 'pulumi up' will log a warning if the resource is used. If present and set to "true", this warning is omitted. + """ + return pulumi.get(self, "suppress_beta_warning") + + @suppress_beta_warning.setter + def suppress_beta_warning(self, value: Optional[pulumi.Input[bool]]): + pulumi.set(self, "suppress_beta_warning", value) + + @pulumi.input_type class KubeClientSettingsArgs: def __init__(__self__, *, diff --git a/sdk/python/pulumi_kubernetes/provider.py b/sdk/python/pulumi_kubernetes/provider.py index 35fab73e06..4db285cb2f 100644 --- a/sdk/python/pulumi_kubernetes/provider.py +++ b/sdk/python/pulumi_kubernetes/provider.py @@ -17,29 +17,20 @@ def __init__(__self__, *, cluster: Optional[pulumi.Input[str]] = None, context: Optional[pulumi.Input[str]] = None, enable_dry_run: Optional[pulumi.Input[bool]] = None, - helm_driver: Optional[pulumi.Input[str]] = None, - helm_plugins_path: Optional[pulumi.Input[str]] = None, - helm_registry_config_path: Optional[pulumi.Input[str]] = None, - helm_repository_cache: Optional[pulumi.Input[str]] = None, - helm_repository_config_path: Optional[pulumi.Input[str]] = None, + helm_release_settings: Optional[pulumi.Input['HelmReleaseSettingsArgs']] = None, kube_client_settings: Optional[pulumi.Input['KubeClientSettingsArgs']] = None, kubeconfig: Optional[pulumi.Input[str]] = None, namespace: Optional[pulumi.Input[str]] = None, render_yaml_to_directory: Optional[pulumi.Input[str]] = None, suppress_deprecation_warnings: Optional[pulumi.Input[bool]] = None, - suppress_helm_hook_warnings: Optional[pulumi.Input[bool]] = None, - suppress_helm_release_beta_warning: Optional[pulumi.Input[bool]] = None): + suppress_helm_hook_warnings: Optional[pulumi.Input[bool]] = None): """ The set of arguments for constructing a Provider resource. :param pulumi.Input[str] cluster: If present, the name of the kubeconfig cluster to use. :param pulumi.Input[str] context: If present, the name of the kubeconfig context to use. :param pulumi.Input[bool] enable_dry_run: BETA FEATURE - If present and set to true, enable server-side diff calculations. This feature is in developer preview, and is disabled by default. - :param pulumi.Input[str] helm_driver: BETA FEATURE - Used for supporting Helm Release resource (Beta). The backend storage driver for Helm. Values are: configmap, secret, memory, sql. - :param pulumi.Input[str] helm_plugins_path: BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the helm plugins directory. - :param pulumi.Input[str] helm_registry_config_path: BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the registry config file. - :param pulumi.Input[str] helm_repository_cache: BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the file containing cached repository indexes. - :param pulumi.Input[str] helm_repository_config_path: BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the file containing repository names and URLs. + :param pulumi.Input['HelmReleaseSettingsArgs'] helm_release_settings: BETA FEATURE - Options to configure the Helm Release resource. :param pulumi.Input['KubeClientSettingsArgs'] kube_client_settings: Options for tuning the Kubernetes client used by a Provider. :param pulumi.Input[str] kubeconfig: The contents of a kubeconfig file or the path to a kubeconfig file. :param pulumi.Input[str] namespace: If present, the default namespace to use. This flag is ignored for cluster-scoped resources. @@ -58,7 +49,6 @@ def __init__(__self__, *, used in these resources will be rendered in plaintext to the resulting YAML. :param pulumi.Input[bool] suppress_deprecation_warnings: If present and set to true, suppress apiVersion deprecation warnings from the CLI. :param pulumi.Input[bool] suppress_helm_hook_warnings: If present and set to true, suppress unsupported Helm hook warnings from the CLI. - :param pulumi.Input[bool] suppress_helm_release_beta_warning: While Helm Release provider is in beta, by default 'pulumi up' will log a warning if the resource is used. If present and set to "true", this warning is omitted. """ if cluster is not None: pulumi.set(__self__, "cluster", cluster) @@ -68,26 +58,8 @@ def __init__(__self__, *, enable_dry_run = _utilities.get_env_bool('PULUMI_K8S_ENABLE_DRY_RUN') if enable_dry_run is not None: pulumi.set(__self__, "enable_dry_run", enable_dry_run) - if helm_driver is None: - helm_driver = _utilities.get_env('PULUMI_K8S_HELM_DRIVER') - if helm_driver is not None: - pulumi.set(__self__, "helm_driver", helm_driver) - if helm_plugins_path is None: - helm_plugins_path = _utilities.get_env('PULUMI_K8S_HELM_PLUGINS_PATH') - if helm_plugins_path is not None: - pulumi.set(__self__, "helm_plugins_path", helm_plugins_path) - if helm_registry_config_path is None: - helm_registry_config_path = _utilities.get_env('PULUMI_K8S_HELM_REGISTRY_CONFIG_PATH') - if helm_registry_config_path is not None: - pulumi.set(__self__, "helm_registry_config_path", helm_registry_config_path) - if helm_repository_cache is None: - helm_repository_cache = _utilities.get_env('PULUMI_K8s_HELM_REPOSITORY_CACHE') - if helm_repository_cache is not None: - pulumi.set(__self__, "helm_repository_cache", helm_repository_cache) - if helm_repository_config_path is None: - helm_repository_config_path = _utilities.get_env('PULUMI_K8S_HELM_REPOSITORY_CONFIG_PATH') - if helm_repository_config_path is not None: - pulumi.set(__self__, "helm_repository_config_path", helm_repository_config_path) + if helm_release_settings is not None: + pulumi.set(__self__, "helm_release_settings", helm_release_settings) if kube_client_settings is not None: pulumi.set(__self__, "kube_client_settings", kube_client_settings) if kubeconfig is None: @@ -106,10 +78,6 @@ def __init__(__self__, *, suppress_helm_hook_warnings = _utilities.get_env_bool('PULUMI_K8S_SUPPRESS_HELM_HOOK_WARNINGS') if suppress_helm_hook_warnings is not None: pulumi.set(__self__, "suppress_helm_hook_warnings", suppress_helm_hook_warnings) - if suppress_helm_release_beta_warning is None: - suppress_helm_release_beta_warning = _utilities.get_env_bool('PULUMI_K8S_SUPPRESS_HELM_RELEASE_BETA_WARNING') - if suppress_helm_release_beta_warning is not None: - pulumi.set(__self__, "suppress_helm_release_beta_warning", suppress_helm_release_beta_warning) @property @pulumi.getter @@ -149,64 +117,16 @@ def enable_dry_run(self, value: Optional[pulumi.Input[bool]]): pulumi.set(self, "enable_dry_run", value) @property - @pulumi.getter(name="helmDriver") - def helm_driver(self) -> Optional[pulumi.Input[str]]: - """ - BETA FEATURE - Used for supporting Helm Release resource (Beta). The backend storage driver for Helm. Values are: configmap, secret, memory, sql. - """ - return pulumi.get(self, "helm_driver") - - @helm_driver.setter - def helm_driver(self, value: Optional[pulumi.Input[str]]): - pulumi.set(self, "helm_driver", value) - - @property - @pulumi.getter(name="helmPluginsPath") - def helm_plugins_path(self) -> Optional[pulumi.Input[str]]: - """ - BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the helm plugins directory. - """ - return pulumi.get(self, "helm_plugins_path") - - @helm_plugins_path.setter - def helm_plugins_path(self, value: Optional[pulumi.Input[str]]): - pulumi.set(self, "helm_plugins_path", value) - - @property - @pulumi.getter(name="helmRegistryConfigPath") - def helm_registry_config_path(self) -> Optional[pulumi.Input[str]]: - """ - BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the registry config file. - """ - return pulumi.get(self, "helm_registry_config_path") - - @helm_registry_config_path.setter - def helm_registry_config_path(self, value: Optional[pulumi.Input[str]]): - pulumi.set(self, "helm_registry_config_path", value) - - @property - @pulumi.getter(name="helmRepositoryCache") - def helm_repository_cache(self) -> Optional[pulumi.Input[str]]: + @pulumi.getter(name="helmReleaseSettings") + def helm_release_settings(self) -> Optional[pulumi.Input['HelmReleaseSettingsArgs']]: """ - BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the file containing cached repository indexes. + BETA FEATURE - Options to configure the Helm Release resource. """ - return pulumi.get(self, "helm_repository_cache") + return pulumi.get(self, "helm_release_settings") - @helm_repository_cache.setter - def helm_repository_cache(self, value: Optional[pulumi.Input[str]]): - pulumi.set(self, "helm_repository_cache", value) - - @property - @pulumi.getter(name="helmRepositoryConfigPath") - def helm_repository_config_path(self) -> Optional[pulumi.Input[str]]: - """ - BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the file containing repository names and URLs. - """ - return pulumi.get(self, "helm_repository_config_path") - - @helm_repository_config_path.setter - def helm_repository_config_path(self, value: Optional[pulumi.Input[str]]): - pulumi.set(self, "helm_repository_config_path", value) + @helm_release_settings.setter + def helm_release_settings(self, value: Optional[pulumi.Input['HelmReleaseSettingsArgs']]): + pulumi.set(self, "helm_release_settings", value) @property @pulumi.getter(name="kubeClientSettings") @@ -292,18 +212,6 @@ def suppress_helm_hook_warnings(self) -> Optional[pulumi.Input[bool]]: def suppress_helm_hook_warnings(self, value: Optional[pulumi.Input[bool]]): pulumi.set(self, "suppress_helm_hook_warnings", value) - @property - @pulumi.getter(name="suppressHelmReleaseBetaWarning") - def suppress_helm_release_beta_warning(self) -> Optional[pulumi.Input[bool]]: - """ - While Helm Release provider is in beta, by default 'pulumi up' will log a warning if the resource is used. If present and set to "true", this warning is omitted. - """ - return pulumi.get(self, "suppress_helm_release_beta_warning") - - @suppress_helm_release_beta_warning.setter - def suppress_helm_release_beta_warning(self, value: Optional[pulumi.Input[bool]]): - pulumi.set(self, "suppress_helm_release_beta_warning", value) - class Provider(pulumi.ProviderResource): @overload @@ -313,18 +221,13 @@ def __init__(__self__, cluster: Optional[pulumi.Input[str]] = None, context: Optional[pulumi.Input[str]] = None, enable_dry_run: Optional[pulumi.Input[bool]] = None, - helm_driver: Optional[pulumi.Input[str]] = None, - helm_plugins_path: Optional[pulumi.Input[str]] = None, - helm_registry_config_path: Optional[pulumi.Input[str]] = None, - helm_repository_cache: Optional[pulumi.Input[str]] = None, - helm_repository_config_path: Optional[pulumi.Input[str]] = None, + helm_release_settings: Optional[pulumi.Input[pulumi.InputType['HelmReleaseSettingsArgs']]] = None, kube_client_settings: Optional[pulumi.Input[pulumi.InputType['KubeClientSettingsArgs']]] = None, kubeconfig: Optional[pulumi.Input[str]] = None, namespace: Optional[pulumi.Input[str]] = None, render_yaml_to_directory: Optional[pulumi.Input[str]] = None, suppress_deprecation_warnings: Optional[pulumi.Input[bool]] = None, suppress_helm_hook_warnings: Optional[pulumi.Input[bool]] = None, - suppress_helm_release_beta_warning: Optional[pulumi.Input[bool]] = None, __props__=None): """ The provider type for the kubernetes package. @@ -335,11 +238,7 @@ def __init__(__self__, :param pulumi.Input[str] context: If present, the name of the kubeconfig context to use. :param pulumi.Input[bool] enable_dry_run: BETA FEATURE - If present and set to true, enable server-side diff calculations. This feature is in developer preview, and is disabled by default. - :param pulumi.Input[str] helm_driver: BETA FEATURE - Used for supporting Helm Release resource (Beta). The backend storage driver for Helm. Values are: configmap, secret, memory, sql. - :param pulumi.Input[str] helm_plugins_path: BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the helm plugins directory. - :param pulumi.Input[str] helm_registry_config_path: BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the registry config file. - :param pulumi.Input[str] helm_repository_cache: BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the file containing cached repository indexes. - :param pulumi.Input[str] helm_repository_config_path: BETA FEATURE - Used for supporting Helm Release resource (Beta). The path to the file containing repository names and URLs. + :param pulumi.Input[pulumi.InputType['HelmReleaseSettingsArgs']] helm_release_settings: BETA FEATURE - Options to configure the Helm Release resource. :param pulumi.Input[pulumi.InputType['KubeClientSettingsArgs']] kube_client_settings: Options for tuning the Kubernetes client used by a Provider. :param pulumi.Input[str] kubeconfig: The contents of a kubeconfig file or the path to a kubeconfig file. :param pulumi.Input[str] namespace: If present, the default namespace to use. This flag is ignored for cluster-scoped resources. @@ -358,7 +257,6 @@ def __init__(__self__, used in these resources will be rendered in plaintext to the resulting YAML. :param pulumi.Input[bool] suppress_deprecation_warnings: If present and set to true, suppress apiVersion deprecation warnings from the CLI. :param pulumi.Input[bool] suppress_helm_hook_warnings: If present and set to true, suppress unsupported Helm hook warnings from the CLI. - :param pulumi.Input[bool] suppress_helm_release_beta_warning: While Helm Release provider is in beta, by default 'pulumi up' will log a warning if the resource is used. If present and set to "true", this warning is omitted. """ ... @overload @@ -387,18 +285,13 @@ def _internal_init(__self__, cluster: Optional[pulumi.Input[str]] = None, context: Optional[pulumi.Input[str]] = None, enable_dry_run: Optional[pulumi.Input[bool]] = None, - helm_driver: Optional[pulumi.Input[str]] = None, - helm_plugins_path: Optional[pulumi.Input[str]] = None, - helm_registry_config_path: Optional[pulumi.Input[str]] = None, - helm_repository_cache: Optional[pulumi.Input[str]] = None, - helm_repository_config_path: Optional[pulumi.Input[str]] = None, + helm_release_settings: Optional[pulumi.Input[pulumi.InputType['HelmReleaseSettingsArgs']]] = None, kube_client_settings: Optional[pulumi.Input[pulumi.InputType['KubeClientSettingsArgs']]] = None, kubeconfig: Optional[pulumi.Input[str]] = None, namespace: Optional[pulumi.Input[str]] = None, render_yaml_to_directory: Optional[pulumi.Input[str]] = None, suppress_deprecation_warnings: Optional[pulumi.Input[bool]] = None, suppress_helm_hook_warnings: Optional[pulumi.Input[bool]] = None, - suppress_helm_release_beta_warning: Optional[pulumi.Input[bool]] = None, __props__=None): if opts is None: opts = pulumi.ResourceOptions() @@ -416,21 +309,7 @@ def _internal_init(__self__, if enable_dry_run is None: enable_dry_run = _utilities.get_env_bool('PULUMI_K8S_ENABLE_DRY_RUN') __props__.__dict__["enable_dry_run"] = pulumi.Output.from_input(enable_dry_run).apply(pulumi.runtime.to_json) if enable_dry_run is not None else None - if helm_driver is None: - helm_driver = _utilities.get_env('PULUMI_K8S_HELM_DRIVER') - __props__.__dict__["helm_driver"] = helm_driver - if helm_plugins_path is None: - helm_plugins_path = _utilities.get_env('PULUMI_K8S_HELM_PLUGINS_PATH') - __props__.__dict__["helm_plugins_path"] = helm_plugins_path - if helm_registry_config_path is None: - helm_registry_config_path = _utilities.get_env('PULUMI_K8S_HELM_REGISTRY_CONFIG_PATH') - __props__.__dict__["helm_registry_config_path"] = helm_registry_config_path - if helm_repository_cache is None: - helm_repository_cache = _utilities.get_env('PULUMI_K8s_HELM_REPOSITORY_CACHE') - __props__.__dict__["helm_repository_cache"] = helm_repository_cache - if helm_repository_config_path is None: - helm_repository_config_path = _utilities.get_env('PULUMI_K8S_HELM_REPOSITORY_CONFIG_PATH') - __props__.__dict__["helm_repository_config_path"] = helm_repository_config_path + __props__.__dict__["helm_release_settings"] = pulumi.Output.from_input(helm_release_settings).apply(pulumi.runtime.to_json) if helm_release_settings is not None else None __props__.__dict__["kube_client_settings"] = pulumi.Output.from_input(kube_client_settings).apply(pulumi.runtime.to_json) if kube_client_settings is not None else None if kubeconfig is None: kubeconfig = _utilities.get_env('KUBECONFIG') @@ -443,9 +322,6 @@ def _internal_init(__self__, if suppress_helm_hook_warnings is None: suppress_helm_hook_warnings = _utilities.get_env_bool('PULUMI_K8S_SUPPRESS_HELM_HOOK_WARNINGS') __props__.__dict__["suppress_helm_hook_warnings"] = pulumi.Output.from_input(suppress_helm_hook_warnings).apply(pulumi.runtime.to_json) if suppress_helm_hook_warnings is not None else None - if suppress_helm_release_beta_warning is None: - suppress_helm_release_beta_warning = _utilities.get_env_bool('PULUMI_K8S_SUPPRESS_HELM_RELEASE_BETA_WARNING') - __props__.__dict__["suppress_helm_release_beta_warning"] = pulumi.Output.from_input(suppress_helm_release_beta_warning).apply(pulumi.runtime.to_json) if suppress_helm_release_beta_warning is not None else None super(Provider, __self__).__init__( 'kubernetes', resource_name, From 06878d324e737e39d7ede6f24a608f9ad4486c12 Mon Sep 17 00:00:00 2001 From: Levi Blackstone Date: Mon, 4 Oct 2021 16:01:44 -0600 Subject: [PATCH 3/6] Provider --- provider/pkg/provider/provider.go | 94 +++++++++---------------------- provider/pkg/provider/types.go | 16 ++++++ 2 files changed, 44 insertions(+), 66 deletions(-) diff --git a/provider/pkg/provider/provider.go b/provider/pkg/provider/provider.go index a2baf1482d..83a30483d0 100644 --- a/provider/pkg/provider/provider.go +++ b/provider/pkg/provider/provider.go @@ -465,79 +465,41 @@ func (k *kubeProvider) Configure(_ context.Context, req *pulumirpc.ConfigureRequ k.yamlDirectory = renderYamlToDirectory() k.yamlRenderMode = len(k.yamlDirectory) > 0 - suppressHelmReleaseBetaWarning := func() bool { - if disabled, exists := vars["kubernetes:config:suppressHelmReleaseBetaWarning"]; exists { - return disabled == trueStr - } - - // If the provider flag is not set, fall back to the ENV var. - if disabled, exists := os.LookupEnv("PULUMI_K8S_SUPPRESS_HELM_RELEASE_BETA_WARNING"); exists { - return disabled == trueStr + var helmReleaseSettings HelmReleaseSettings + if obj, ok := vars["kubernetes:config:helmReleaseSettings"]; ok { + err := json.Unmarshal([]byte(obj), &helmReleaseSettings) + if err != nil { + return nil, fmt.Errorf("failed to unmarshal helmReleaseSettings option: %w", err) } - return false } - k.suppressHelmReleaseBetaWarning = suppressHelmReleaseBetaWarning() - - helmDriver := func() string { - if driver, exists := vars["kubernetes:config:helmDriver"]; exists { - return driver - } - // If the provider flag is not set, fall back to the ENV var. - if driver, exists := os.LookupEnv("PULUMI_K8S_HELM_DRIVER"); exists { - return driver - } - - return "secret" + if helmReleaseSettings.Driver != nil { + k.helmDriver = *helmReleaseSettings.Driver + } else { + k.helmDriver = "secret" } - k.helmDriver = helmDriver() // TODO: Make sure this is in provider state - - helmPluginsPath := func() string { - if pluginsPath, exists := vars["kubernetes:config:helmPluginsPath"]; exists { - return pluginsPath - } - // If the provider flag is not set, fall back to the ENV var. - if pluginsPath, exists := os.LookupEnv("PULUMI_K8S_HELM_PLUGINS_PATH"); exists { - return pluginsPath - } - return helmpath.DataPath("plugins") + if helmReleaseSettings.PluginsPath != nil { + k.helmPluginsPath = *helmReleaseSettings.PluginsPath + } else { + k.helmPluginsPath = helmpath.DataPath("plugins") } - k.helmPluginsPath = helmPluginsPath() - - helmRegistryConfigPath := func() string { - if registryPath, exists := vars["kubernetes:config:helmRegistryConfigPath"]; exists { - return registryPath - } - // If the provider flag is not set, fall back to the ENV var. - if registryPath, exists := os.LookupEnv("PULUMI_K8S_HELM_REGISTRY_CONFIG_PATH"); exists { - return registryPath - } - return helmpath.ConfigPath("registry.json") + if helmReleaseSettings.RegistryConfigPath != nil { + k.helmRegistryConfigPath = *helmReleaseSettings.RegistryConfigPath + } else { + k.helmRegistryConfigPath = helmpath.ConfigPath("registry.json") } - k.helmRegistryConfigPath = helmRegistryConfigPath() - - helmRepositoryConfigPath := func() string { - if repositoryConfigPath, exists := vars["kubernetes:config:helmRepositoryConfigPath"]; exists { - return repositoryConfigPath - } - - if repositoryConfigPath, exists := os.LookupEnv("PULUMI_K8S_HELM_REPOSITORY_CONFIG_PATH"); exists { - return repositoryConfigPath - } - return helmpath.ConfigPath("repositories.yaml") + if helmReleaseSettings.RepositoryCache != nil { + k.helmRepositoryCache = *helmReleaseSettings.RepositoryCache + } else { + k.helmRepositoryCache = helmpath.CachePath("repository") } - k.helmRepositoryConfigPath = helmRepositoryConfigPath() - - helmRepositoryCache := func() string { - if repositoryCache, exists := vars["kubernetes:config:helmRepositoryCache"]; exists { - return repositoryCache - } - - if repositoryCache, exists := os.LookupEnv("PULUMI_K8s_HELM_REPOSITORY_CACHE"); exists { - return repositoryCache - } - return helmpath.CachePath("repository") + if helmReleaseSettings.RepositoryConfigPath != nil { + k.helmRepositoryConfigPath = *helmReleaseSettings.RepositoryConfigPath + } else { + k.helmRepositoryConfigPath = helmpath.ConfigPath("repositories.yaml") + } + if helmReleaseSettings.SuppressBetaWarning != nil { + k.suppressHelmReleaseBetaWarning = *helmReleaseSettings.SuppressBetaWarning } - k.helmRepositoryCache = helmRepositoryCache() // Rather than erroring out on an invalid k8s config, mark the cluster as unreachable and conditionally bail out on // operations that require a valid cluster. This will allow us to perform invoke operations using the default diff --git a/provider/pkg/provider/types.go b/provider/pkg/provider/types.go index 7e8100b133..1557301805 100644 --- a/provider/pkg/provider/types.go +++ b/provider/pkg/provider/types.go @@ -17,6 +17,22 @@ package provider // Note: These types must match the types defined in the Go SDK (sdk/go/kubernetes/config/pulumiTypes.go). // Copying the types avoids having the provider depend on the SDK. +// BETA FEATURE - Options to configure the Helm Release resource. +type HelmReleaseSettings struct { + // The backend storage driver for Helm. Values are: configmap, secret, memory, sql. + Driver *string `json:"driver"` + // The path to the helm plugins directory. + PluginsPath *string `json:"pluginsPath"` + // The path to the registry config file. + RegistryConfigPath *string `json:"registryConfigPath"` + // The path to the file containing cached repository indexes. + RepositoryCache *string `json:"repositoryCache"` + // The path to the file containing repository names and URLs. + RepositoryConfigPath *string `json:"repositoryConfigPath"` + // While Helm Release provider is in beta, by default 'pulumi up' will log a warning if the resource is used. If present and set to "true", this warning is omitted. + SuppressBetaWarning *bool `json:"suppressBetaWarning"` +} + // Options for tuning the Kubernetes client used by a Provider. type KubeClientSettings struct { // Maximum burst for throttle. Default value is 10. From 6cd7761de791c891d684390f434eecdcb43e0708 Mon Sep 17 00:00:00 2001 From: Levi Blackstone Date: Mon, 4 Oct 2021 16:05:03 -0600 Subject: [PATCH 4/6] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 463a3c4b5e..54337686b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ - Always override namespace for helm release operations (https://github.com/pulumi/pulumi-kubernetes/pull/1747) - Add k8s client tuning settings to Provider (https://github.com/pulumi/pulumi-kubernetes/pull/1748) +- Nest helm.Release Provider settings (https://github.com/pulumi/pulumi-kubernetes/pull/1751) ## 3.7.3 (September 30, 2021) - Use helm release's namespace on templates where namespace is left unspecified (https://github.com/pulumi/pulumi-kubernetes/pull/1733) From d358f8541acd6fa2091f6bdd85f71ba353299bed Mon Sep 17 00:00:00 2001 From: Levi Blackstone Date: Tue, 5 Oct 2021 09:00:07 -0600 Subject: [PATCH 5/6] Revert to explicitly handling env vars --- provider/pkg/provider/provider.go | 94 +++++++++++++++++++++++-------- 1 file changed, 72 insertions(+), 22 deletions(-) diff --git a/provider/pkg/provider/provider.go b/provider/pkg/provider/provider.go index 83a30483d0..0ced45e2f2 100644 --- a/provider/pkg/provider/provider.go +++ b/provider/pkg/provider/provider.go @@ -472,34 +472,84 @@ func (k *kubeProvider) Configure(_ context.Context, req *pulumirpc.ConfigureRequ return nil, fmt.Errorf("failed to unmarshal helmReleaseSettings option: %w", err) } } - if helmReleaseSettings.Driver != nil { - k.helmDriver = *helmReleaseSettings.Driver - } else { - k.helmDriver = "secret" + + // TODO: Once https://github.com/pulumi/pulumi/issues/8132 is fixed, we can drop the env var handling logic. + + helmDriver := func() string { + if helmReleaseSettings.Driver != nil { + return *helmReleaseSettings.Driver + } + + // If the provider flag is not set, fall back to the ENV var. + if driver, exists := os.LookupEnv("PULUMI_K8S_HELM_DRIVER"); exists { + return driver + } + return "secret" } - if helmReleaseSettings.PluginsPath != nil { - k.helmPluginsPath = *helmReleaseSettings.PluginsPath - } else { - k.helmPluginsPath = helmpath.DataPath("plugins") + k.helmDriver = helmDriver() // TODO: Make sure this is in provider state + + helmPluginsPath := func() string { + if helmReleaseSettings.PluginsPath != nil { + return *helmReleaseSettings.PluginsPath + } + + // If the provider flag is not set, fall back to the ENV var. + if pluginsPath, exists := os.LookupEnv("PULUMI_K8S_HELM_PLUGINS_PATH"); exists { + return pluginsPath + } + return helmpath.DataPath("plugins") } - if helmReleaseSettings.RegistryConfigPath != nil { - k.helmRegistryConfigPath = *helmReleaseSettings.RegistryConfigPath - } else { - k.helmRegistryConfigPath = helmpath.ConfigPath("registry.json") + k.helmPluginsPath = helmPluginsPath() + + helmRegistryConfigPath := func() string { + if helmReleaseSettings.RegistryConfigPath != nil { + return *helmReleaseSettings.RegistryConfigPath + } + + // If the provider flag is not set, fall back to the ENV var. + if registryPath, exists := os.LookupEnv("PULUMI_K8S_HELM_REGISTRY_CONFIG_PATH"); exists { + return registryPath + } + return helmpath.ConfigPath("registry.json") } - if helmReleaseSettings.RepositoryCache != nil { - k.helmRepositoryCache = *helmReleaseSettings.RepositoryCache - } else { - k.helmRepositoryCache = helmpath.CachePath("repository") + k.helmRegistryConfigPath = helmRegistryConfigPath() + + helmRepositoryConfigPath := func() string { + if helmReleaseSettings.RepositoryConfigPath != nil { + return *helmReleaseSettings.RepositoryConfigPath + } + + if repositoryConfigPath, exists := os.LookupEnv("PULUMI_K8S_HELM_REPOSITORY_CONFIG_PATH"); exists { + return repositoryConfigPath + } + return helmpath.ConfigPath("repositories.yaml") } - if helmReleaseSettings.RepositoryConfigPath != nil { - k.helmRepositoryConfigPath = *helmReleaseSettings.RepositoryConfigPath - } else { - k.helmRepositoryConfigPath = helmpath.ConfigPath("repositories.yaml") + k.helmRepositoryConfigPath = helmRepositoryConfigPath() + + helmRepositoryCache := func() string { + if helmReleaseSettings.RepositoryCache != nil { + return *helmReleaseSettings.RepositoryCache + } + + if repositoryCache, exists := os.LookupEnv("PULUMI_K8S_HELM_REPOSITORY_CACHE"); exists { + return repositoryCache + } + return helmpath.CachePath("repository") } - if helmReleaseSettings.SuppressBetaWarning != nil { - k.suppressHelmReleaseBetaWarning = *helmReleaseSettings.SuppressBetaWarning + k.helmRepositoryCache = helmRepositoryCache() + + suppressHelmReleaseBetaWarning := func() bool { + if helmReleaseSettings.SuppressBetaWarning != nil { + return *helmReleaseSettings.SuppressBetaWarning + } + + // If the provider flag is not set, fall back to the ENV var. + if disabled, exists := os.LookupEnv("PULUMI_K8S_SUPPRESS_HELM_RELEASE_BETA_WARNING"); exists { + return disabled == trueStr + } + return false } + k.suppressHelmReleaseBetaWarning = suppressHelmReleaseBetaWarning() // Rather than erroring out on an invalid k8s config, mark the cluster as unreachable and conditionally bail out on // operations that require a valid cluster. This will allow us to perform invoke operations using the default From df133ce6fcec2d029274a4c220e62aafbb61aa7f Mon Sep 17 00:00:00 2001 From: Levi Blackstone Date: Wed, 6 Oct 2021 14:17:08 -0600 Subject: [PATCH 6/6] Add usage note --- CHANGELOG.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 89ae72b97a..d1d405a37e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,25 @@ ## HEAD (Unreleased) +Breaking change note: + +#1751 moved the Helm Release (beta) Provider options into a complex type called `helmReleaseSettings`. Following this +change, you can set these options in the following ways: + +1. As arguments to a first-class Provider + ```typescript + new k8s.Provider("test", { helmReleaseSettings: { driver: "secret" } }); + ``` + +1. Stack configuration for the default Provider + ``` + pulumi config set --path kubernetes:helmReleaseSettings.driver "secret" + ``` + +1. As environment variables + ``` + EXPORT PULUMI_K8S_HELM_DRIVER="secret" + ``` + - [sdk/dotnet] Fix creation of CustomResources (https://github.com/pulumi/pulumi-kubernetes/pull/1741) - Always override namespace for helm release operations (https://github.com/pulumi/pulumi-kubernetes/pull/1747) - Add k8s client tuning settings to Provider (https://github.com/pulumi/pulumi-kubernetes/pull/1748)