Skip to content

Commit

Permalink
Remove deprecated enableDryRun provider flag (#2400)
Browse files Browse the repository at this point in the history
  • Loading branch information
lblackstone committed May 17, 2023
1 parent 1f34e05 commit c2609ba
Show file tree
Hide file tree
Showing 13 changed files with 10 additions and 184 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
## Unreleased

Breaking changes:

- Enable Server-side Apply by default (https://github.com/pulumi/pulumi-kubernetes/pull/2398)
- Remove deprecated enableDryRun provider flag (https://github.com/pulumi/pulumi-kubernetes/pull/2400)

Additional changes:

- Handle resource change from static name to autoname under SSA (https://github.com/pulumi/pulumi-kubernetes/pull/2392)
- Remove deprecated helm/v2 SDK (https://github.com/pulumi/pulumi-kubernetes/pull/2396)

Expand Down
15 changes: 0 additions & 15 deletions provider/cmd/pulumi-resource-kubernetes/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -468,11 +468,6 @@
"type": "boolean",
"description": "BETA FEATURE - If present and set to true, allow ConfigMaps to be mutated.\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 `enableConfigMapMutable` parameter.\n2. The `PULUMI_K8S_ENABLE_CONFIGMAP_MUTABLE` environment variable."
},
"enableDryRun": {
"type": "boolean",
"description": "Deprecated. If present and set to true, enable server-side diff calculations.\n",
"deprecationMessage": "This option has been replaced by `enableServerSideApply`."
},
"enableReplaceCRD": {
"type": "boolean",
"description": "Obsolete. This option has no effect.",
Expand Down Expand Up @@ -63496,16 +63491,6 @@
]
}
},
"enableDryRun": {
"type": "boolean",
"description": "Deprecated. If present and set to true, enable server-side diff calculations.\n",
"defaultInfo": {
"environment": [
"PULUMI_K8S_ENABLE_DRY_RUN"
]
},
"deprecationMessage": "This option has been replaced by `enableServerSideApply`."
},
"enableReplaceCRD": {
"type": "boolean",
"description": "Obsolete. This option has no effect.",
Expand Down
15 changes: 0 additions & 15 deletions provider/pkg/gen/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,6 @@ func PulumiSchema(swagger map[string]interface{}) pschema.PackageSpec {
Description: "If present and set to true, the provider will delete resources associated with an unreachable Kubernetes cluster from Pulumi state",
TypeSpec: pschema.TypeSpec{Type: "boolean"},
},
"enableDryRun": {
Description: "Deprecated. If present and set to true, enable server-side diff calculations.\n",
TypeSpec: pschema.TypeSpec{Type: "boolean"},
DeprecationMessage: "This option has been replaced by `enableServerSideApply`.",
},
"enableServerSideApply": {
Description: "BETA FEATURE - If present and set to true, enable Server-Side Apply mode.\nSee https://github.com/pulumi/pulumi-kubernetes/issues/2011 for additional details.\nThis feature is in developer preview, and is disabled by default.",
TypeSpec: pschema.TypeSpec{Type: "boolean"},
Expand Down Expand Up @@ -141,16 +136,6 @@ func PulumiSchema(swagger map[string]interface{}) pschema.PackageSpec {
Description: "If present, the default namespace to use. This flag is ignored for cluster-scoped resources.\n\nA namespace can be specified in multiple places, and the precedence is as follows:\n1. `.metadata.namespace` set on the resource.\n2. This `namespace` parameter.\n3. `namespace` set for the active context in the kubeconfig.",
TypeSpec: pschema.TypeSpec{Type: "string"},
},
"enableDryRun": {
DefaultInfo: &pschema.DefaultSpec{
Environment: []string{
"PULUMI_K8S_ENABLE_DRY_RUN",
},
},
Description: "Deprecated. If present and set to true, enable server-side diff calculations.\n",
TypeSpec: pschema.TypeSpec{Type: "boolean"},
DeprecationMessage: "This option has been replaced by `enableServerSideApply`.",
},
"enableServerSideApply": {
DefaultInfo: &pschema.DefaultSpec{
Environment: []string{
Expand Down
22 changes: 2 additions & 20 deletions provider/pkg/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ type kubeProvider struct {
defaultNamespace string

deleteUnreachable bool
enableDryRun bool
enableConfigMapMutable bool
enableSecrets bool
suppressDeprecationWarnings bool
Expand Down Expand Up @@ -427,22 +426,6 @@ func (k *kubeProvider) Configure(_ context.Context, req *pulumirpc.ConfigureRequ
k.deleteUnreachable = true
}

enableDryRun := func() bool {
// If the provider flag is set, use that value to determine behavior. This will override the ENV var.
if enabled, exists := vars["kubernetes:config:enableDryRun"]; exists {
return enabled == trueStr
}
// If the provider flag is not set, fall back to the ENV var.
if enabled, exists := os.LookupEnv("PULUMI_K8S_ENABLE_DRY_RUN"); exists {
return enabled == trueStr
}
// Default to false.
return false
}
if enableDryRun() {
k.enableDryRun = true
}

enableServerSideApply := func() bool {
// If the provider flag is set, use that value to determine behavior. This will override the ENV var.
if enabled, exists := vars["kubernetes:config:enableServerSideApply"]; exists {
Expand All @@ -456,7 +439,6 @@ func (k *kubeProvider) Configure(_ context.Context, req *pulumirpc.ConfigureRequ
return false
}
if enableServerSideApply() {
k.enableDryRun = true
k.serverSideApplyMode = true
}

Expand Down Expand Up @@ -1838,7 +1820,7 @@ func (k *kubeProvider) Create(
failedPreview = true
}

if k.enableDryRun && errors.IsAlreadyExists(awaitErr) {
if k.serverSideApplyMode && errors.IsAlreadyExists(awaitErr) {
failedPreview = true
}

Expand Down Expand Up @@ -2735,7 +2717,7 @@ func (k *kubeProvider) inputPatch(

func (k *kubeProvider) supportsDryRun(gvk schema.GroupVersionKind) bool {
// Check to see if the configuration has explicitly disabled server-side dry run.
if !k.enableDryRun {
if !k.serverSideApplyMode {
logger.V(9).Infof("dry run is disabled")
return false
}
Expand Down
10 changes: 0 additions & 10 deletions sdk/dotnet/Config/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,6 @@ public void Set(T value)
set => _enableConfigMapMutable.Set(value);
}

private static readonly __Value<bool?> _enableDryRun = new __Value<bool?>(() => __config.GetBoolean("enableDryRun"));
/// <summary>
/// Deprecated. If present and set to true, enable server-side diff calculations.
/// </summary>
public static bool? EnableDryRun
{
get => _enableDryRun.Get();
set => _enableDryRun.Set(value);
}

private static readonly __Value<bool?> _enableReplaceCRD = new __Value<bool?>(() => __config.GetBoolean("enableReplaceCRD"));
/// <summary>
/// Obsolete. This option has no effect.
Expand Down
7 changes: 0 additions & 7 deletions sdk/dotnet/Provider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,6 @@ public sealed class ProviderArgs : global::Pulumi.ResourceArgs
[Input("enableConfigMapMutable", json: true)]
public Input<bool>? EnableConfigMapMutable { get; set; }

/// <summary>
/// Deprecated. If present and set to true, enable server-side diff calculations.
/// </summary>
[Input("enableDryRun", json: true)]
public Input<bool>? EnableDryRun { get; set; }

/// <summary>
/// Obsolete. This option has no effect.
/// </summary>
Expand Down Expand Up @@ -152,7 +146,6 @@ public sealed class ProviderArgs : global::Pulumi.ResourceArgs
public ProviderArgs()
{
EnableConfigMapMutable = Utilities.GetEnvBoolean("PULUMI_K8S_ENABLE_CONFIGMAP_MUTABLE");
EnableDryRun = Utilities.GetEnvBoolean("PULUMI_K8S_ENABLE_DRY_RUN");
EnableReplaceCRD = Utilities.GetEnvBoolean("PULUMI_K8S_ENABLE_REPLACE_CRD");
EnableServerSideApply = Utilities.GetEnvBoolean("PULUMI_K8S_ENABLE_SERVER_SIDE_APPLY");
KubeConfig = Utilities.GetEnv("KUBECONFIG");
Expand Down
7 changes: 0 additions & 7 deletions sdk/go/kubernetes/config/config.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 0 additions & 11 deletions sdk/go/kubernetes/provider.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 0 additions & 7 deletions sdk/java/src/main/java/com/pulumi/kubernetes/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,6 @@ public Optional<Boolean> deleteUnreachable() {
public Optional<Boolean> enableConfigMapMutable() {
return Codegen.booleanProp("enableConfigMapMutable").config(config).get();
}
/**
* Deprecated. If present and set to true, enable server-side diff calculations.
*
*/
public Optional<Boolean> enableDryRun() {
return Codegen.booleanProp("enableDryRun").config(config).get();
}
/**
* Obsolete. This option has no effect.
*
Expand Down
54 changes: 0 additions & 54 deletions sdk/java/src/main/java/com/pulumi/kubernetes/ProviderArgs.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,29 +89,6 @@ public Optional<Output<Boolean>> enableConfigMapMutable() {
return Optional.ofNullable(this.enableConfigMapMutable);
}

/**
* Deprecated. If present and set to true, enable server-side diff calculations.
*
* @deprecated
* This option has been replaced by `enableServerSideApply`.
*
*/
@Deprecated /* This option has been replaced by `enableServerSideApply`. */
@Import(name="enableDryRun", json=true)
private @Nullable Output<Boolean> enableDryRun;

/**
* @return Deprecated. If present and set to true, enable server-side diff calculations.
*
* @deprecated
* This option has been replaced by `enableServerSideApply`.
*
*/
@Deprecated /* This option has been replaced by `enableServerSideApply`. */
public Optional<Output<Boolean>> enableDryRun() {
return Optional.ofNullable(this.enableDryRun);
}

/**
* Obsolete. This option has no effect.
*
Expand Down Expand Up @@ -290,7 +267,6 @@ private ProviderArgs(ProviderArgs $) {
this.context = $.context;
this.deleteUnreachable = $.deleteUnreachable;
this.enableConfigMapMutable = $.enableConfigMapMutable;
this.enableDryRun = $.enableDryRun;
this.enableReplaceCRD = $.enableReplaceCRD;
this.enableServerSideApply = $.enableServerSideApply;
this.helmReleaseSettings = $.helmReleaseSettings;
Expand Down Expand Up @@ -414,35 +390,6 @@ public Builder enableConfigMapMutable(Boolean enableConfigMapMutable) {
return enableConfigMapMutable(Output.of(enableConfigMapMutable));
}

/**
* @param enableDryRun Deprecated. If present and set to true, enable server-side diff calculations.
*
* @return builder
*
* @deprecated
* This option has been replaced by `enableServerSideApply`.
*
*/
@Deprecated /* This option has been replaced by `enableServerSideApply`. */
public Builder enableDryRun(@Nullable Output<Boolean> enableDryRun) {
$.enableDryRun = enableDryRun;
return this;
}

/**
* @param enableDryRun Deprecated. If present and set to true, enable server-side diff calculations.
*
* @return builder
*
* @deprecated
* This option has been replaced by `enableServerSideApply`.
*
*/
@Deprecated /* This option has been replaced by `enableServerSideApply`. */
public Builder enableDryRun(Boolean enableDryRun) {
return enableDryRun(Output.of(enableDryRun));
}

/**
* @param enableReplaceCRD Obsolete. This option has no effect.
*
Expand Down Expand Up @@ -670,7 +617,6 @@ public Builder suppressHelmHookWarnings(Boolean suppressHelmHookWarnings) {

public ProviderArgs build() {
$.enableConfigMapMutable = Codegen.booleanProp("enableConfigMapMutable").output().arg($.enableConfigMapMutable).env("PULUMI_K8S_ENABLE_CONFIGMAP_MUTABLE").getNullable();
$.enableDryRun = Codegen.booleanProp("enableDryRun").output().arg($.enableDryRun).env("PULUMI_K8S_ENABLE_DRY_RUN").getNullable();
$.enableReplaceCRD = Codegen.booleanProp("enableReplaceCRD").output().arg($.enableReplaceCRD).env("PULUMI_K8S_ENABLE_REPLACE_CRD").getNullable();
$.enableServerSideApply = Codegen.booleanProp("enableServerSideApply").output().arg($.enableServerSideApply).env("PULUMI_K8S_ENABLE_SERVER_SIDE_APPLY").getNullable();
$.kubeconfig = Codegen.stringProp("kubeconfig").output().arg($.kubeconfig).env("KUBECONFIG").getNullable();
Expand Down
7 changes: 0 additions & 7 deletions sdk/nodejs/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export class Provider extends pulumi.ProviderResource {
resourceInputs["context"] = args ? args.context : undefined;
resourceInputs["deleteUnreachable"] = pulumi.output(args ? args.deleteUnreachable : undefined).apply(JSON.stringify);
resourceInputs["enableConfigMapMutable"] = pulumi.output((args ? args.enableConfigMapMutable : undefined) ?? utilities.getEnvBoolean("PULUMI_K8S_ENABLE_CONFIGMAP_MUTABLE")).apply(JSON.stringify);
resourceInputs["enableDryRun"] = pulumi.output((args ? args.enableDryRun : undefined) ?? utilities.getEnvBoolean("PULUMI_K8S_ENABLE_DRY_RUN")).apply(JSON.stringify);
resourceInputs["enableReplaceCRD"] = pulumi.output((args ? args.enableReplaceCRD : undefined) ?? utilities.getEnvBoolean("PULUMI_K8S_ENABLE_REPLACE_CRD")).apply(JSON.stringify);
resourceInputs["enableServerSideApply"] = pulumi.output((args ? args.enableServerSideApply : undefined) ?? utilities.getEnvBoolean("PULUMI_K8S_ENABLE_SERVER_SIDE_APPLY")).apply(JSON.stringify);
resourceInputs["helmReleaseSettings"] = pulumi.output(args ? (args.helmReleaseSettings ? pulumi.output(args.helmReleaseSettings).apply(inputs.helmReleaseSettingsProvideDefaults) : undefined) : undefined).apply(JSON.stringify);
Expand Down Expand Up @@ -82,12 +81,6 @@ export interface ProviderArgs {
* 2. The `PULUMI_K8S_ENABLE_CONFIGMAP_MUTABLE` environment variable.
*/
enableConfigMapMutable?: pulumi.Input<boolean>;
/**
* Deprecated. If present and set to true, enable server-side diff calculations.
*
* @deprecated This option has been replaced by `enableServerSideApply`.
*/
enableDryRun?: pulumi.Input<boolean>;
/**
* Obsolete. This option has no effect.
*
Expand Down
Loading

0 comments on commit c2609ba

Please sign in to comment.