Skip to content

Commit

Permalink
[sdk/go] Re-add deprecated Provider file (#1687)
Browse files Browse the repository at this point in the history
The Go SDK erroneously included an old version of
the Provider resource until v3.6.0 when it was incidentally
removed as part of another update. To avoid breaking
user code that was referring to this path, re-add a copy
of the Provider with included deprecation notices to
move to the intended path.
  • Loading branch information
lblackstone committed Aug 23, 2021
1 parent 45dfe90 commit 79c8d5d
Show file tree
Hide file tree
Showing 8 changed files with 246 additions and 29 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## HEAD (Unreleased)

- [sdk/go] Re-add deprecated Provider file (https://github.com/pulumi/pulumi-kubernetes/pull/1687)

## 3.6.2 (August 20, 2021)

- Fix environment variable name in disable Helm hook warnings message (https://github.com/pulumi/pulumi-kubernetes/pull/1683)
Expand Down
9 changes: 9 additions & 0 deletions provider/cmd/pulumi-gen-kubernetes/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,15 @@ func writeGoClient(pkg *schema.Package, outdir string, templateDir string) {
return templateResources.Resources[i].Token < templateResources.Resources[j].Token
})

// We mistakenly included an older version of the Go Provider at
// `github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes/providers` that was later removed in v3.6.0.
// Re-add this file with deprecation notices in preparation for future removal.
deprecatedComment := "// Deprecated: Use `github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes` instead"
deprecatedProviderFile := string(files["kubernetes/provider.go"])
deprecatedProviderFile = strings.ReplaceAll(deprecatedProviderFile, "\nfunc", fmt.Sprintf("\n%s\nfunc", deprecatedComment))
deprecatedProviderFile = strings.ReplaceAll(deprecatedProviderFile, "\ntype", fmt.Sprintf("\n%s\ntype", deprecatedComment))
files["kubernetes/providers/provider.go"] = []byte(deprecatedProviderFile)

files["kubernetes/pulumiTypes.go"] = mustLoadGoFile(filepath.Join(templateDir, "pulumiTypes.go"))
files["kubernetes/apiextensions/customResource.go"] = mustLoadGoFile(filepath.Join(templateDir, "apiextensions", "customResource.go"))
files["kubernetes/helm/v2/chart.go"] = mustLoadGoFile(filepath.Join(templateDir, "helm", "v2", "chart.go"))
Expand Down
2 changes: 1 addition & 1 deletion provider/cmd/pulumi-resource-kubernetes/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -29625,7 +29625,7 @@
},
"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.",
"description": "If present and set to true, suppress unsupported Helm hook warnings from the CLI.",
"defaultInfo": {
"environment": [
"PULUMI_K8S_SUPPRESS_HELM_HOOK_WARNINGS"
Expand Down
4 changes: 0 additions & 4 deletions sdk/dotnet/Provider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,6 @@ public sealed class ProviderArgs : Pulumi.ResourceArgs

/// <summary>
/// If present and set to true, suppress unsupported Helm hook warnings from the CLI.
///
/// This config can be specified in the following ways, using this precedence:
/// 1. This `suppressHelmHookWarnings` parameter.
/// 2. The `PULUMI_K8S_SUPPRESS_HELM_HOOK_WARNINGS` environment variable.
/// </summary>
[Input("suppressHelmHookWarnings", json: true)]
public Input<bool>? SuppressHelmHookWarnings { get; set; }
Expand Down
8 changes: 0 additions & 8 deletions sdk/go/kubernetes/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@ type providerArgs struct {
// If present and set to true, suppress apiVersion deprecation warnings from the CLI.
SuppressDeprecationWarnings *bool `pulumi:"suppressDeprecationWarnings"`
// If present and set to true, suppress unsupported Helm hook warnings from the CLI.
//
// This config can be specified in the following ways, using this precedence:
// 1. This `suppressHelmHookWarnings` parameter.
// 2. The `PULUMI_K8S_SUPPRESS_HELM_HOOK_WARNINGS` environment variable.
SuppressHelmHookWarnings *bool `pulumi:"suppressHelmHookWarnings"`
}

Expand Down Expand Up @@ -108,10 +104,6 @@ type ProviderArgs struct {
// If present and set to true, suppress apiVersion deprecation warnings from the CLI.
SuppressDeprecationWarnings pulumi.BoolPtrInput
// If present and set to true, suppress unsupported Helm hook warnings from the CLI.
//
// This config can be specified in the following ways, using this precedence:
// 1. This `suppressHelmHookWarnings` parameter.
// 2. The `PULUMI_K8S_SUPPRESS_HELM_HOOK_WARNINGS` environment variable.
SuppressHelmHookWarnings pulumi.BoolPtrInput
}

Expand Down
234 changes: 234 additions & 0 deletions sdk/go/kubernetes/providers/provider.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
// *** WARNING: this file was generated by pulumigen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

package kubernetes

import (
"context"
"reflect"

"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

// The provider type for the kubernetes package.
// Deprecated: Use `github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes` instead
type Provider struct {
pulumi.ProviderResourceState
}

// NewProvider registers a new resource with the given unique name, arguments, and options.
// Deprecated: Use `github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes` instead
func NewProvider(ctx *pulumi.Context,
name string, args *ProviderArgs, opts ...pulumi.ResourceOption) (*Provider, error) {
if args == nil {
args = &ProviderArgs{}
}

if args.EnableDryRun == nil {
args.EnableDryRun = pulumi.BoolPtr(getEnvOrDefault(false, parseEnvBool, "PULUMI_K8S_ENABLE_DRY_RUN").(bool))
}
if args.Kubeconfig == nil {
args.Kubeconfig = pulumi.StringPtr(getEnvOrDefault("", nil, "KUBECONFIG").(string))
}
if args.SuppressDeprecationWarnings == nil {
args.SuppressDeprecationWarnings = pulumi.BoolPtr(getEnvOrDefault(false, parseEnvBool, "PULUMI_K8S_SUPPRESS_DEPRECATION_WARNINGS").(bool))
}
if args.SuppressHelmHookWarnings == nil {
args.SuppressHelmHookWarnings = pulumi.BoolPtr(getEnvOrDefault(false, parseEnvBool, "PULUMI_K8S_SUPPRESS_HELM_HOOK_WARNINGS").(bool))
}
var resource Provider
err := ctx.RegisterResource("pulumi:providers:kubernetes", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}

// Deprecated: Use `github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes` instead
type providerArgs struct {
// If present, the name of the kubeconfig cluster to use.
Cluster *string `pulumi:"cluster"`
// If present, the name of the kubeconfig context to use.
Context *string `pulumi:"context"`
// 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"`
// The contents of a kubeconfig file or the path to a kubeconfig file.
Kubeconfig *string `pulumi:"kubeconfig"`
// If present, the default namespace to use. This flag is ignored for cluster-scoped resources.
//
// A namespace can be specified in multiple places, and the precedence is as follows:
// 1. `.metadata.namespace` set on the resource.
// 2. This `namespace` parameter.
// 3. `namespace` set for the active context in the kubeconfig.
Namespace *string `pulumi:"namespace"`
// BETA FEATURE - If present, render resource manifests to this directory. In this mode, resources will not
// be created on a Kubernetes cluster, but the rendered manifests will be kept in sync with changes
// to the Pulumi program. This feature is in developer preview, and is disabled by default.
//
// Note that some computed Outputs such as status fields will not be populated
// since the resources are not created on a Kubernetes cluster. These Output values will remain undefined,
// and may result in an error if they are referenced by other resources. Also note that any secret values
// used in these resources will be rendered in plaintext to the resulting YAML.
RenderYamlToDirectory *string `pulumi:"renderYamlToDirectory"`
// If present and set to true, suppress apiVersion deprecation warnings from the CLI.
SuppressDeprecationWarnings *bool `pulumi:"suppressDeprecationWarnings"`
// If present and set to true, suppress unsupported Helm hook warnings from the CLI.
SuppressHelmHookWarnings *bool `pulumi:"suppressHelmHookWarnings"`
}

// The set of arguments for constructing a Provider resource.
// Deprecated: Use `github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes` instead
type ProviderArgs struct {
// If present, the name of the kubeconfig cluster to use.
Cluster pulumi.StringPtrInput
// If present, the name of the kubeconfig context to use.
Context pulumi.StringPtrInput
// 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
// The contents of a kubeconfig file or the path to a kubeconfig file.
Kubeconfig pulumi.StringPtrInput
// If present, the default namespace to use. This flag is ignored for cluster-scoped resources.
//
// A namespace can be specified in multiple places, and the precedence is as follows:
// 1. `.metadata.namespace` set on the resource.
// 2. This `namespace` parameter.
// 3. `namespace` set for the active context in the kubeconfig.
Namespace pulumi.StringPtrInput
// BETA FEATURE - If present, render resource manifests to this directory. In this mode, resources will not
// be created on a Kubernetes cluster, but the rendered manifests will be kept in sync with changes
// to the Pulumi program. This feature is in developer preview, and is disabled by default.
//
// Note that some computed Outputs such as status fields will not be populated
// since the resources are not created on a Kubernetes cluster. These Output values will remain undefined,
// and may result in an error if they are referenced by other resources. Also note that any secret values
// used in these resources will be rendered in plaintext to the resulting YAML.
RenderYamlToDirectory pulumi.StringPtrInput
// If present and set to true, suppress apiVersion deprecation warnings from the CLI.
SuppressDeprecationWarnings pulumi.BoolPtrInput
// If present and set to true, suppress unsupported Helm hook warnings from the CLI.
SuppressHelmHookWarnings pulumi.BoolPtrInput
}

// Deprecated: Use `github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes` instead
func (ProviderArgs) ElementType() reflect.Type {
return reflect.TypeOf((*providerArgs)(nil)).Elem()
}

// Deprecated: Use `github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes` instead
type ProviderInput interface {
pulumi.Input

ToProviderOutput() ProviderOutput
ToProviderOutputWithContext(ctx context.Context) ProviderOutput
}

// Deprecated: Use `github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes` instead
func (*Provider) ElementType() reflect.Type {
return reflect.TypeOf((*Provider)(nil))
}

// Deprecated: Use `github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes` instead
func (i *Provider) ToProviderOutput() ProviderOutput {
return i.ToProviderOutputWithContext(context.Background())
}

// Deprecated: Use `github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes` instead
func (i *Provider) ToProviderOutputWithContext(ctx context.Context) ProviderOutput {
return pulumi.ToOutputWithContext(ctx, i).(ProviderOutput)
}

// Deprecated: Use `github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes` instead
func (i *Provider) ToProviderPtrOutput() ProviderPtrOutput {
return i.ToProviderPtrOutputWithContext(context.Background())
}

// Deprecated: Use `github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes` instead
func (i *Provider) ToProviderPtrOutputWithContext(ctx context.Context) ProviderPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(ProviderPtrOutput)
}

// Deprecated: Use `github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes` instead
type ProviderPtrInput interface {
pulumi.Input

ToProviderPtrOutput() ProviderPtrOutput
ToProviderPtrOutputWithContext(ctx context.Context) ProviderPtrOutput
}

// Deprecated: Use `github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes` instead
type providerPtrType ProviderArgs

// Deprecated: Use `github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes` instead
func (*providerPtrType) ElementType() reflect.Type {
return reflect.TypeOf((**Provider)(nil))
}

// Deprecated: Use `github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes` instead
func (i *providerPtrType) ToProviderPtrOutput() ProviderPtrOutput {
return i.ToProviderPtrOutputWithContext(context.Background())
}

// Deprecated: Use `github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes` instead
func (i *providerPtrType) ToProviderPtrOutputWithContext(ctx context.Context) ProviderPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(ProviderPtrOutput)
}

// Deprecated: Use `github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes` instead
type ProviderOutput struct {
*pulumi.OutputState
}

// Deprecated: Use `github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes` instead
func (ProviderOutput) ElementType() reflect.Type {
return reflect.TypeOf((*Provider)(nil))
}

// Deprecated: Use `github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes` instead
func (o ProviderOutput) ToProviderOutput() ProviderOutput {
return o
}

// Deprecated: Use `github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes` instead
func (o ProviderOutput) ToProviderOutputWithContext(ctx context.Context) ProviderOutput {
return o
}

// Deprecated: Use `github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes` instead
func (o ProviderOutput) ToProviderPtrOutput() ProviderPtrOutput {
return o.ToProviderPtrOutputWithContext(context.Background())
}

// Deprecated: Use `github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes` instead
func (o ProviderOutput) ToProviderPtrOutputWithContext(ctx context.Context) ProviderPtrOutput {
return o.ApplyT(func(v Provider) *Provider {
return &v
}).(ProviderPtrOutput)
}

// Deprecated: Use `github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes` instead
type ProviderPtrOutput struct {
*pulumi.OutputState
}

// Deprecated: Use `github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes` instead
func (ProviderPtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Provider)(nil))
}

// Deprecated: Use `github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes` instead
func (o ProviderPtrOutput) ToProviderPtrOutput() ProviderPtrOutput {
return o
}

// Deprecated: Use `github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes` instead
func (o ProviderPtrOutput) ToProviderPtrOutputWithContext(ctx context.Context) ProviderPtrOutput {
return o
}

// Deprecated: Use `github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes` instead
func init() {
pulumi.RegisterOutputType(ProviderOutput{})
pulumi.RegisterOutputType(ProviderPtrOutput{})
}
4 changes: 0 additions & 4 deletions sdk/nodejs/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,6 @@ export interface ProviderArgs {
suppressDeprecationWarnings?: pulumi.Input<boolean>;
/**
* If present and set to true, suppress unsupported Helm hook warnings from the CLI.
*
* This config can be specified in the following ways, using this precedence:
* 1. This `suppressHelmHookWarnings` parameter.
* 2. The `PULUMI_K8S_SUPPRESS_HELM_HOOK_WARNINGS` environment variable.
*/
suppressHelmHookWarnings?: pulumi.Input<boolean>;
}
12 changes: 0 additions & 12 deletions sdk/python/pulumi_kubernetes/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,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.
This config can be specified in the following ways, using this precedence:
1. This `suppressHelmHookWarnings` parameter.
2. The `PULUMI_K8S_SUPPRESS_HELM_HOOK_WARNINGS` environment variable.
"""
if cluster is not None:
pulumi.set(__self__, "cluster", cluster)
Expand Down Expand Up @@ -176,10 +172,6 @@ def suppress_deprecation_warnings(self, value: Optional[pulumi.Input[bool]]):
def suppress_helm_hook_warnings(self) -> Optional[pulumi.Input[bool]]:
"""
If present and set to true, suppress unsupported Helm hook warnings from the CLI.
This config can be specified in the following ways, using this precedence:
1. This `suppressHelmHookWarnings` parameter.
2. The `PULUMI_K8S_SUPPRESS_HELM_HOOK_WARNINGS` environment variable.
"""
return pulumi.get(self, "suppress_helm_hook_warnings")

Expand Down Expand Up @@ -228,10 +220,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.
This config can be specified in the following ways, using this precedence:
1. This `suppressHelmHookWarnings` parameter.
2. The `PULUMI_K8S_SUPPRESS_HELM_HOOK_WARNINGS` environment variable.
"""
...
@overload
Expand Down

0 comments on commit 79c8d5d

Please sign in to comment.