Skip to content

Commit

Permalink
Revert "Provider config should be available as outputs (#2598)" (#2627)
Browse files Browse the repository at this point in the history
This reverts #2598.

<!--Thanks for your contribution. See [CONTRIBUTING](CONTRIBUTING.md)
    for Pulumi's contribution guidelines.

    Help us merge your changes more quickly by adding more details such
    as labels, milestones, and reviewers.-->

### Proposed changes

<!--Give us a brief description of what you've done and what it solves.
-->
Mitigates #2626
### Related issues (optional)

Original issue: #2486
  • Loading branch information
EronWright committed Oct 24, 2023
1 parent 523ff36 commit aab02f9
Show file tree
Hide file tree
Showing 34 changed files with 236 additions and 1,093 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
## Unreleased
- Revert: Normalize provider inputs and make available as outputs (https://github.com/pulumi/pulumi-kubernetes/pull/2627)

## 4.5.0 (October 23, 2023)

- helm.v3.ChartOpts: Add KubeVersion field that can be passed to avoid asking the kubernetes API server for the version (https://github.com/pulumi/pulumi-kubernetes/pull/2593)
- Fix for Helm Import regression (https://github.com/pulumi/pulumi-kubernetes/pull/2605)
- Improved search functionality for Helm Import (https://github.com/pulumi/pulumi-kubernetes/pull/2610)
- Fix SSA dry-run previews when a Pulumi program uses Apply on the status subresource (https://github.com/pulumi/pulumi-kubernetes/pull/2615)
- Normalize provider inputs and make available as outputs (https://github.com/pulumi/pulumi-kubernetes/pull/2598)

## 4.4.0 (October 12, 2023)

- Fix normalizing fields with empty objects/slices (https://github.com/pulumi/pulumi-kubernetes/pull/2576)
- helm.v3.Release: Improved cancellation support (https://github.com/pulumi/pulumi-kubernetes/pull/2579)
- Update Kubernetes client library to v0.28.2 (https://github.com/pulumi/pulumi-kubernetes/pull/2585)
- Normalize provider inputs and make available as outputs (https://github.com/pulumi/pulumi-kubernetes/pull/2598)

## 4.3.0 (September 25, 2023)

Expand Down
2 changes: 1 addition & 1 deletion provider/cmd/pulumi-gen-kubernetes/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ func buildPulumiFieldsFromTerraform(path string, block *TerraformBlockSchema) ma
if path == "kubernetes_deployment.spec.template.spec.container" && blockName == "port" {
field["name"] = "ports"
}
// 3. kubernetes_service has a field "port" which is a list, but we call it "ports"
// 3. kubernetes_service has a field "port" wich is a list, but we call it "ports"
if path == "kubernetes_service.spec" && blockName == "port" {
field["name"] = "ports"
}
Expand Down
32 changes: 0 additions & 32 deletions provider/cmd/pulumi-resource-kubernetes/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -65021,38 +65021,6 @@
},
"provider": {
"description": "The provider type for the kubernetes package.",
"properties": {
"cluster": {
"type": "string",
"description": "If present, the name of the kubeconfig cluster to use."
},
"context": {
"type": "string",
"description": "If present, the name of the kubeconfig context to use."
},
"kubeconfig": {
"type": "string",
"description": "The contents of a kubeconfig file or the path to a kubeconfig file.",
"defaultInfo": {
"environment": [
"KUBECONFIG"
]
},
"language": {
"csharp": {
"name": "KubeConfig"
}
}
},
"namespace": {
"type": "string",
"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."
},
"renderYamlToDirectory": {
"type": "string",
"description": "BETA FEATURE - If present, render resource manifests to this directory. In this mode, resources will not\nbe created on a Kubernetes cluster, but the rendered manifests will be kept in sync with changes\nto the Pulumi program. This feature is in developer preview, and is disabled by default.\n\nNote that some computed Outputs such as status fields will not be populated\nsince the resources are not created on a Kubernetes cluster. These Output values will remain undefined,\nand may result in an error if they are referenced by other resources. Also note that any secret values\nused in these resources will be rendered in plaintext to the resulting YAML."
}
},
"type": "object",
"inputProperties": {
"cluster": {
Expand Down
9 changes: 0 additions & 9 deletions provider/pkg/gen/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ func PulumiSchema(swagger map[string]any) pschema.PackageSpec {
ObjectTypeSpec: pschema.ObjectTypeSpec{
Description: "The provider type for the kubernetes package.",
Type: "object",
Properties: map[string]pschema.PropertySpec{},
},
InputProperties: map[string]pschema.PropertySpec{
"kubeconfig": {
Expand Down Expand Up @@ -217,14 +216,6 @@ func PulumiSchema(swagger map[string]any) pschema.PackageSpec {
Language: map[string]pschema.RawMessage{},
}

for name, inputProp := range pkg.Provider.InputProperties {
// FIXME: provider outputs are limited to strings due to:
// https://github.com/pulumi/pulumi/issues/13435
if inputProp.TypeSpec.Type != "string" {
continue
}
pkg.Provider.Properties[name] = inputProp
}
goImportPath := "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes"

csharpNamespaces := map[string]string{
Expand Down
15 changes: 12 additions & 3 deletions provider/pkg/provider/helm_release.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,18 @@ func (r *helmReleaseProvider) getActionConfig(namespace string) (*action.Configu
// explicitly set the namespace (e.g. through namespace: {{ .Release.Namespace }}).
overrides.Context.Namespace = namespace

contract.Assertf(r.apiConfig != nil, "expected non-nil apiConfig")
contract.Assertf(r.restConfig != nil, "expected non-nil restConfig")
clientConfig := clientcmd.NewDefaultClientConfig(*r.apiConfig, &overrides)
var clientConfig clientcmd.ClientConfig
if r.apiConfig != nil {
clientConfig = clientcmd.NewDefaultClientConfig(*r.apiConfig, &overrides)
} else {
// Use client-go to resolve the final configuration values for the client. Typically these
// values would reside in the $KUBECONFIG file, but can also be altered in several
// places, including in env variables, client-go default values, and (if we allowed it) CLI
// flags.
loadingRules := clientcmd.NewDefaultClientConfigLoadingRules()
loadingRules.DefaultClientConfig = &clientcmd.DefaultClientConfig
clientConfig = clientcmd.NewNonInteractiveDeferredLoadingClientConfig(loadingRules, &overrides)
}
kc := NewKubeConfig(r.restConfig, clientConfig)

if err := conf.Init(kc, namespace, r.helmDriver, debug); err != nil {
Expand Down
Loading

0 comments on commit aab02f9

Please sign in to comment.