github.com/pulumi/pulumi-kubernetes/sdk/v3@v3.30.2/go/kubernetes/provider.go (about)

     1  // Code generated by pulumigen DO NOT EDIT.
     2  // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
     3  
     4  package kubernetes
     5  
     6  import (
     7  	"context"
     8  	"reflect"
     9  
    10  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    11  )
    12  
    13  // The provider type for the kubernetes package.
    14  type Provider struct {
    15  	pulumi.ProviderResourceState
    16  }
    17  
    18  // NewProvider registers a new resource with the given unique name, arguments, and options.
    19  func NewProvider(ctx *pulumi.Context,
    20  	name string, args *ProviderArgs, opts ...pulumi.ResourceOption) (*Provider, error) {
    21  	if args == nil {
    22  		args = &ProviderArgs{}
    23  	}
    24  
    25  	if args.DeleteUnreachable == nil {
    26  		if d := getEnvOrDefault(nil, parseEnvBool, "PULUMI_K8S_DELETE_UNREACHABLE"); d != nil {
    27  			args.DeleteUnreachable = pulumi.BoolPtr(d.(bool))
    28  		}
    29  	}
    30  	if args.EnableConfigMapMutable == nil {
    31  		if d := getEnvOrDefault(nil, parseEnvBool, "PULUMI_K8S_ENABLE_CONFIGMAP_MUTABLE"); d != nil {
    32  			args.EnableConfigMapMutable = pulumi.BoolPtr(d.(bool))
    33  		}
    34  	}
    35  	if args.EnableDryRun == nil {
    36  		if d := getEnvOrDefault(nil, parseEnvBool, "PULUMI_K8S_ENABLE_DRY_RUN"); d != nil {
    37  			args.EnableDryRun = pulumi.BoolPtr(d.(bool))
    38  		}
    39  	}
    40  	if args.EnableReplaceCRD == nil {
    41  		if d := getEnvOrDefault(nil, parseEnvBool, "PULUMI_K8S_ENABLE_REPLACE_CRD"); d != nil {
    42  			args.EnableReplaceCRD = pulumi.BoolPtr(d.(bool))
    43  		}
    44  	}
    45  	if args.EnableServerSideApply == nil {
    46  		if d := getEnvOrDefault(nil, parseEnvBool, "PULUMI_K8S_ENABLE_SERVER_SIDE_APPLY"); d != nil {
    47  			args.EnableServerSideApply = pulumi.BoolPtr(d.(bool))
    48  		}
    49  	}
    50  	if args.HelmReleaseSettings != nil {
    51  		args.HelmReleaseSettings = args.HelmReleaseSettings.ToHelmReleaseSettingsPtrOutput().ApplyT(func(v *HelmReleaseSettings) *HelmReleaseSettings { return v.Defaults() }).(HelmReleaseSettingsPtrOutput)
    52  	}
    53  	if args.KubeClientSettings != nil {
    54  		args.KubeClientSettings = args.KubeClientSettings.ToKubeClientSettingsPtrOutput().ApplyT(func(v *KubeClientSettings) *KubeClientSettings { return v.Defaults() }).(KubeClientSettingsPtrOutput)
    55  	}
    56  	if args.Kubeconfig == nil {
    57  		if d := getEnvOrDefault(nil, nil, "KUBECONFIG"); d != nil {
    58  			args.Kubeconfig = pulumi.StringPtr(d.(string))
    59  		}
    60  	}
    61  	if args.SuppressDeprecationWarnings == nil {
    62  		if d := getEnvOrDefault(nil, parseEnvBool, "PULUMI_K8S_SUPPRESS_DEPRECATION_WARNINGS"); d != nil {
    63  			args.SuppressDeprecationWarnings = pulumi.BoolPtr(d.(bool))
    64  		}
    65  	}
    66  	if args.SuppressHelmHookWarnings == nil {
    67  		if d := getEnvOrDefault(nil, parseEnvBool, "PULUMI_K8S_SUPPRESS_HELM_HOOK_WARNINGS"); d != nil {
    68  			args.SuppressHelmHookWarnings = pulumi.BoolPtr(d.(bool))
    69  		}
    70  	}
    71  	var resource Provider
    72  	err := ctx.RegisterResource("pulumi:providers:kubernetes", name, args, &resource, opts...)
    73  	if err != nil {
    74  		return nil, err
    75  	}
    76  	return &resource, nil
    77  }
    78  
    79  type providerArgs struct {
    80  	// If present, the name of the kubeconfig cluster to use.
    81  	Cluster *string `pulumi:"cluster"`
    82  	// If present, the name of the kubeconfig context to use.
    83  	Context *string `pulumi:"context"`
    84  	// If present and set to true, the provider will delete resources associated with an unreachable Kubernetes cluster from Pulumi state
    85  	DeleteUnreachable *bool `pulumi:"deleteUnreachable"`
    86  	// BETA FEATURE - If present and set to true, allow ConfigMaps to be mutated.
    87  	// This feature is in developer preview, and is disabled by default.
    88  	//
    89  	// This config can be specified in the following ways using this precedence:
    90  	// 1. This `enableConfigMapMutable` parameter.
    91  	// 2. The `PULUMI_K8S_ENABLE_CONFIGMAP_MUTABLE` environment variable.
    92  	EnableConfigMapMutable *bool `pulumi:"enableConfigMapMutable"`
    93  	// Deprecated. If present and set to true, enable server-side diff calculations.
    94  	//
    95  	// Deprecated: This option has been replaced by `enableServerSideApply`.
    96  	EnableDryRun *bool `pulumi:"enableDryRun"`
    97  	// Obsolete. This option has no effect.
    98  	//
    99  	// Deprecated: This option is deprecated, and will be removed in a future release.
   100  	EnableReplaceCRD *bool `pulumi:"enableReplaceCRD"`
   101  	// BETA FEATURE - If present and set to true, enable Server-Side Apply mode.
   102  	// See https://github.com/pulumi/pulumi-kubernetes/issues/2011 for additional details.
   103  	// This feature is in developer preview, and is disabled by default.
   104  	EnableServerSideApply *bool `pulumi:"enableServerSideApply"`
   105  	// Options to configure the Helm Release resource.
   106  	HelmReleaseSettings *HelmReleaseSettings `pulumi:"helmReleaseSettings"`
   107  	// Options for tuning the Kubernetes client used by a Provider.
   108  	KubeClientSettings *KubeClientSettings `pulumi:"kubeClientSettings"`
   109  	// The contents of a kubeconfig file or the path to a kubeconfig file.
   110  	Kubeconfig *string `pulumi:"kubeconfig"`
   111  	// If present, the default namespace to use. This flag is ignored for cluster-scoped resources.
   112  	//
   113  	// A namespace can be specified in multiple places, and the precedence is as follows:
   114  	// 1. `.metadata.namespace` set on the resource.
   115  	// 2. This `namespace` parameter.
   116  	// 3. `namespace` set for the active context in the kubeconfig.
   117  	Namespace *string `pulumi:"namespace"`
   118  	// BETA FEATURE - If present, render resource manifests to this directory. In this mode, resources will not
   119  	// be created on a Kubernetes cluster, but the rendered manifests will be kept in sync with changes
   120  	// to the Pulumi program. This feature is in developer preview, and is disabled by default.
   121  	//
   122  	// Note that some computed Outputs such as status fields will not be populated
   123  	// since the resources are not created on a Kubernetes cluster. These Output values will remain undefined,
   124  	// and may result in an error if they are referenced by other resources. Also note that any secret values
   125  	// used in these resources will be rendered in plaintext to the resulting YAML.
   126  	RenderYamlToDirectory *string `pulumi:"renderYamlToDirectory"`
   127  	// If present and set to true, suppress apiVersion deprecation warnings from the CLI.
   128  	SuppressDeprecationWarnings *bool `pulumi:"suppressDeprecationWarnings"`
   129  	// If present and set to true, suppress unsupported Helm hook warnings from the CLI.
   130  	SuppressHelmHookWarnings *bool `pulumi:"suppressHelmHookWarnings"`
   131  }
   132  
   133  // The set of arguments for constructing a Provider resource.
   134  type ProviderArgs struct {
   135  	// If present, the name of the kubeconfig cluster to use.
   136  	Cluster pulumi.StringPtrInput
   137  	// If present, the name of the kubeconfig context to use.
   138  	Context pulumi.StringPtrInput
   139  	// If present and set to true, the provider will delete resources associated with an unreachable Kubernetes cluster from Pulumi state
   140  	DeleteUnreachable pulumi.BoolPtrInput
   141  	// BETA FEATURE - If present and set to true, allow ConfigMaps to be mutated.
   142  	// This feature is in developer preview, and is disabled by default.
   143  	//
   144  	// This config can be specified in the following ways using this precedence:
   145  	// 1. This `enableConfigMapMutable` parameter.
   146  	// 2. The `PULUMI_K8S_ENABLE_CONFIGMAP_MUTABLE` environment variable.
   147  	EnableConfigMapMutable pulumi.BoolPtrInput
   148  	// Deprecated. If present and set to true, enable server-side diff calculations.
   149  	//
   150  	// Deprecated: This option has been replaced by `enableServerSideApply`.
   151  	EnableDryRun pulumi.BoolPtrInput
   152  	// Obsolete. This option has no effect.
   153  	//
   154  	// Deprecated: This option is deprecated, and will be removed in a future release.
   155  	EnableReplaceCRD pulumi.BoolPtrInput
   156  	// BETA FEATURE - If present and set to true, enable Server-Side Apply mode.
   157  	// See https://github.com/pulumi/pulumi-kubernetes/issues/2011 for additional details.
   158  	// This feature is in developer preview, and is disabled by default.
   159  	EnableServerSideApply pulumi.BoolPtrInput
   160  	// Options to configure the Helm Release resource.
   161  	HelmReleaseSettings HelmReleaseSettingsPtrInput
   162  	// Options for tuning the Kubernetes client used by a Provider.
   163  	KubeClientSettings KubeClientSettingsPtrInput
   164  	// The contents of a kubeconfig file or the path to a kubeconfig file.
   165  	Kubeconfig pulumi.StringPtrInput
   166  	// If present, the default namespace to use. This flag is ignored for cluster-scoped resources.
   167  	//
   168  	// A namespace can be specified in multiple places, and the precedence is as follows:
   169  	// 1. `.metadata.namespace` set on the resource.
   170  	// 2. This `namespace` parameter.
   171  	// 3. `namespace` set for the active context in the kubeconfig.
   172  	Namespace pulumi.StringPtrInput
   173  	// BETA FEATURE - If present, render resource manifests to this directory. In this mode, resources will not
   174  	// be created on a Kubernetes cluster, but the rendered manifests will be kept in sync with changes
   175  	// to the Pulumi program. This feature is in developer preview, and is disabled by default.
   176  	//
   177  	// Note that some computed Outputs such as status fields will not be populated
   178  	// since the resources are not created on a Kubernetes cluster. These Output values will remain undefined,
   179  	// and may result in an error if they are referenced by other resources. Also note that any secret values
   180  	// used in these resources will be rendered in plaintext to the resulting YAML.
   181  	RenderYamlToDirectory pulumi.StringPtrInput
   182  	// If present and set to true, suppress apiVersion deprecation warnings from the CLI.
   183  	SuppressDeprecationWarnings pulumi.BoolPtrInput
   184  	// If present and set to true, suppress unsupported Helm hook warnings from the CLI.
   185  	SuppressHelmHookWarnings pulumi.BoolPtrInput
   186  }
   187  
   188  func (ProviderArgs) ElementType() reflect.Type {
   189  	return reflect.TypeOf((*providerArgs)(nil)).Elem()
   190  }
   191  
   192  type ProviderInput interface {
   193  	pulumi.Input
   194  
   195  	ToProviderOutput() ProviderOutput
   196  	ToProviderOutputWithContext(ctx context.Context) ProviderOutput
   197  }
   198  
   199  func (*Provider) ElementType() reflect.Type {
   200  	return reflect.TypeOf((**Provider)(nil)).Elem()
   201  }
   202  
   203  func (i *Provider) ToProviderOutput() ProviderOutput {
   204  	return i.ToProviderOutputWithContext(context.Background())
   205  }
   206  
   207  func (i *Provider) ToProviderOutputWithContext(ctx context.Context) ProviderOutput {
   208  	return pulumi.ToOutputWithContext(ctx, i).(ProviderOutput)
   209  }
   210  
   211  type ProviderOutput struct{ *pulumi.OutputState }
   212  
   213  func (ProviderOutput) ElementType() reflect.Type {
   214  	return reflect.TypeOf((**Provider)(nil)).Elem()
   215  }
   216  
   217  func (o ProviderOutput) ToProviderOutput() ProviderOutput {
   218  	return o
   219  }
   220  
   221  func (o ProviderOutput) ToProviderOutputWithContext(ctx context.Context) ProviderOutput {
   222  	return o
   223  }
   224  
   225  func init() {
   226  	pulumi.RegisterInputType(reflect.TypeOf((*ProviderInput)(nil)).Elem(), &Provider{})
   227  	pulumi.RegisterOutputType(ProviderOutput{})
   228  }