Skip to content

Commit

Permalink
Pull in codegen fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lblackstone committed Jul 22, 2021
1 parent ec266d6 commit aaa7fb0
Show file tree
Hide file tree
Showing 14 changed files with 2,418 additions and 60 deletions.
2,340 changes: 2,317 additions & 23 deletions provider/cmd/pulumi-resource-kubernetes/schema.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion provider/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/onsi/ginkgo v1.12.0 // indirect
github.com/onsi/gomega v1.9.0 // indirect
github.com/pkg/errors v0.9.1
github.com/pulumi/pulumi/pkg/v3 v3.7.0
github.com/pulumi/pulumi/pkg/v3 v3.8.1-0.20210722201133-a4ee050afcc4
github.com/pulumi/pulumi/sdk/v3 v3.7.0
github.com/stretchr/testify v1.7.0
google.golang.org/grpc v1.37.0
Expand Down
4 changes: 2 additions & 2 deletions provider/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -985,8 +985,8 @@ github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4O
github.com/prometheus/procfs v0.2.0 h1:wH4vA7pcjKuZzjF7lM8awk4fnuJO6idemZXoKnULUx4=
github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
github.com/pulumi/pulumi/pkg/v3 v3.7.0 h1:++E0f1tiY8Goog/D0VrfaSa6Q71k02OjWTCU8QpdIeU=
github.com/pulumi/pulumi/pkg/v3 v3.7.0/go.mod h1:VgIJMIZxVwKg7qVz0smW2UuzOasgfh2997L9etiqkOw=
github.com/pulumi/pulumi/pkg/v3 v3.8.1-0.20210722201133-a4ee050afcc4 h1:pRueIMFTTbt5VFO0PU9oZQU/xY7SLoVVVdhXAaKoxzQ=
github.com/pulumi/pulumi/pkg/v3 v3.8.1-0.20210722201133-a4ee050afcc4/go.mod h1:2Y+Q5wUVGmJ2T3jyBxXEe1C0MjNwWn0dwG4blLB3om8=
github.com/pulumi/pulumi/sdk/v3 v3.3.1/go.mod h1:GBHyQ7awNQSRmiKp/p8kIKrGrMOZeA/k2czoM/GOqds=
github.com/pulumi/pulumi/sdk/v3 v3.7.0 h1:0Sm4k6QNLTm7QQmn9t31tVG7d9fuyvFOnogffgvbluE=
github.com/pulumi/pulumi/sdk/v3 v3.7.0/go.mod h1:GBHyQ7awNQSRmiKp/p8kIKrGrMOZeA/k2czoM/GOqds=
Expand Down
6 changes: 3 additions & 3 deletions provider/pkg/gen/nodejs-templates/yaml/yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -535,9 +535,9 @@ export interface ConfigOpts {
throw new Error(`YAML object does not have a .metadata.name: ${obj.apiVersion}/${obj.kind} ${JSON.stringify(obj.metadata)}`)
}

const meta = obj["metadata"];
let id: pulumi.Output<any> = pulumi.output(meta["name"]);
const namespace = meta["namespace"] || undefined;
const metadata = obj["metadata"];
let id: pulumi.Output<any> = pulumi.output(metadata["name"]);
const namespace = metadata["namespace"] || undefined;
if (namespace !== undefined) {
id = pulumi.concat(namespace, "/", id);
}
Expand Down
22 changes: 11 additions & 11 deletions provider/pkg/gen/schema.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2016-2020, Pulumi Corporation.
// Copyright 2016-2021, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -40,7 +40,7 @@ func PulumiSchema(swagger map[string]interface{}) pschema.PackageSpec {
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.",
TypeSpec: pschema.TypeSpec{Type: "string"},
Language: map[string]json.RawMessage{
Language: map[string]pschema.RawMessage{
"csharp": rawMessage(map[string]interface{}{
"name": "KubeConfig",
}),
Expand Down Expand Up @@ -86,8 +86,8 @@ func PulumiSchema(swagger map[string]interface{}) pschema.PackageSpec {
},
},
Description: "The contents of a kubeconfig file or the path to a kubeconfig file.",
TypeSpec: pschema.TypeSpec{Type: "string"},
Language: map[string]json.RawMessage{
TypeSpec: pschema.TypeSpec{Type: "string"},
Language: map[string]pschema.RawMessage{
"csharp": rawMessage(map[string]interface{}{
"name": "KubeConfig",
}),
Expand Down Expand Up @@ -133,7 +133,7 @@ func PulumiSchema(swagger map[string]interface{}) pschema.PackageSpec {
Types: map[string]pschema.ComplexTypeSpec{},
Resources: map[string]pschema.ResourceSpec{},
Functions: map[string]pschema.FunctionSpec{},
Language: map[string]json.RawMessage{},
Language: map[string]pschema.RawMessage{},
}

goImportPath := "github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes"
Expand Down Expand Up @@ -162,7 +162,7 @@ func PulumiSchema(swagger map[string]interface{}) pschema.PackageSpec {
Description: kind.Comment() + kind.PulumiComment(),
Type: "object",
Properties: map[string]pschema.PropertySpec{},
Language: map[string]json.RawMessage{},
Language: map[string]pschema.RawMessage{},
}

var propNames []string
Expand Down Expand Up @@ -250,8 +250,8 @@ func PulumiSchema(swagger map[string]interface{}) pschema.PackageSpec {

pkg.Language["csharp"] = rawMessage(map[string]interface{}{
"packageReferences": map[string]string{
"Glob": "1.1.5",
"Pulumi": "3.*",
"Glob": "1.1.5",
"Pulumi": "3.*",
},
"namespaces": csharpNamespaces,
"compatibility": kubernetes20,
Expand Down Expand Up @@ -357,7 +357,7 @@ func genPropertySpec(p Property, resourceGV string, resourceKind string) pschema
languageName := strings.ToUpper(p.name[:1]) + p.name[1:]
if languageName == resourceKind {
// .NET does not allow properties to be the same as the enclosing class - so special case these
propertySpec.Language = map[string]json.RawMessage{
propertySpec.Language = map[string]pschema.RawMessage{
"csharp": rawMessage(map[string]interface{}{
"name": languageName + "Value",
}),
Expand All @@ -366,7 +366,7 @@ func genPropertySpec(p Property, resourceGV string, resourceKind string) pschema
// JSONSchema type includes `$ref` and `$schema` properties, and $ is an invalid character in
// the generated names. Replace them with `Ref` and `Schema`.
if strings.HasPrefix(p.name, "$") {
propertySpec.Language = map[string]json.RawMessage{
propertySpec.Language = map[string]pschema.RawMessage{
"csharp": rawMessage(map[string]interface{}{
"name": strings.ToUpper(p.name[1:2]) + p.name[2:],
}),
Expand All @@ -381,7 +381,7 @@ func genPropertySpec(p Property, resourceGV string, resourceKind string) pschema
return propertySpec
}

func rawMessage(v interface{}) json.RawMessage {
func rawMessage(v interface{}) pschema.RawMessage {
bytes, err := json.Marshal(v)
contract.Assert(err == nil)
return bytes
Expand Down
2 changes: 1 addition & 1 deletion sdk/dotnet/ApiExtensions/V1/Inputs/JSONSchemaPropsArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public InputList<System.Text.Json.JsonElement> Enum
public Input<string>? Id { get; set; }

[Input("items")]
public InputUnion<Pulumi.Kubernetes.Types.Inputs.ApiExtensions.V1.JSONSchemaPropsArgs, ImmutableArray<InputJson>>? Items { get; set; }
public InputUnion<Pulumi.Kubernetes.Types.Inputs.ApiExtensions.V1.JSONSchemaPropsArgs, ImmutableArray<System.Text.Json.JsonElement>>? Items { get; set; }

[Input("maxItems")]
public Input<int>? MaxItems { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public InputList<System.Text.Json.JsonElement> Enum
public Input<string>? Id { get; set; }

[Input("items")]
public InputUnion<Pulumi.Kubernetes.Types.Inputs.ApiExtensions.V1Beta1.JSONSchemaPropsArgs, ImmutableArray<InputJson>>? Items { get; set; }
public InputUnion<Pulumi.Kubernetes.Types.Inputs.ApiExtensions.V1Beta1.JSONSchemaPropsArgs, ImmutableArray<System.Text.Json.JsonElement>>? Items { get; set; }

[Input("maxItems")]
public Input<int>? MaxItems { get; set; }
Expand Down
73 changes: 66 additions & 7 deletions sdk/dotnet/Config/Config.cs
Original file line number Diff line number Diff line change
@@ -1,23 +1,58 @@
// *** 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.Immutable;

namespace Pulumi.Kubernetes
{
public static class Config
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "IDE1006", Justification =
"Double underscore prefix used to avoid conflicts with variable names.")]
private sealed class __Value<T>
{
private readonly Func<T> _getter;
private T _value = default!;
private bool _set;

public __Value(Func<T> getter)
{
_getter = getter;
}

public T Get() => _set ? _value : _getter();

public void Set(T value)
{
_value = value;
_set = true;
}
}

private static readonly Pulumi.Config __config = new Pulumi.Config("kubernetes");

private static readonly __Value<string?> _cluster = new __Value<string?>(() => __config.Get("cluster"));
/// <summary>
/// If present, the name of the kubeconfig cluster to use.
/// </summary>
public static string? Cluster { get; set; } = __config.Get("cluster");
public static string? Cluster
{
get => _cluster.Get();
set => _cluster.Set(value);
}

private static readonly __Value<string?> _context = new __Value<string?>(() => __config.Get("context"));
/// <summary>
/// If present, the name of the kubeconfig context to use.
/// </summary>
public static string? Context { get; set; } = __config.Get("context");
public static string? Context
{
get => _context.Get();
set => _context.Set(value);
}

private static readonly __Value<bool?> _enableDryRun = new __Value<bool?>(() => __config.GetBoolean("enableDryRun"));
/// <summary>
/// BETA FEATURE - If present and set to true, enable server-side diff calculations.
/// This feature is in developer preview, and is disabled by default.
Expand All @@ -26,13 +61,23 @@ public static class Config
/// 1. This `enableDryRun` parameter.
/// 2. The `PULUMI_K8S_ENABLE_DRY_RUN` environment variable.
/// </summary>
public static bool? EnableDryRun { get; set; } = __config.GetBoolean("enableDryRun");
public static bool? EnableDryRun
{
get => _enableDryRun.Get();
set => _enableDryRun.Set(value);
}

private static readonly __Value<string?> _kubeconfig = new __Value<string?>(() => __config.Get("kubeconfig"));
/// <summary>
/// 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.
/// </summary>
public static string? KubeConfig { get; set; } = __config.Get("kubeconfig");
public static string? KubeConfig
{
get => _kubeconfig.Get();
set => _kubeconfig.Set(value);
}

private static readonly __Value<string?> _namespace = new __Value<string?>(() => __config.Get("namespace"));
/// <summary>
/// If present, the default namespace to use. This flag is ignored for cluster-scoped resources.
///
Expand All @@ -41,8 +86,13 @@ public static class Config
/// 2. This `namespace` parameter.
/// 3. `namespace` set for the active context in the kubeconfig.
/// </summary>
public static string? Namespace { get; set; } = __config.Get("namespace");
public static string? Namespace
{
get => _namespace.Get();
set => _namespace.Set(value);
}

private static readonly __Value<string?> _renderYamlToDirectory = new __Value<string?>(() => __config.Get("renderYamlToDirectory"));
/// <summary>
/// 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
Expand All @@ -53,16 +103,25 @@ public static class Config
/// 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.
/// </summary>
public static string? RenderYamlToDirectory { get; set; } = __config.Get("renderYamlToDirectory");
public static string? RenderYamlToDirectory
{
get => _renderYamlToDirectory.Get();
set => _renderYamlToDirectory.Set(value);
}

private static readonly __Value<bool?> _suppressDeprecationWarnings = new __Value<bool?>(() => __config.GetBoolean("suppressDeprecationWarnings"));
/// <summary>
/// If present and set to true, suppress apiVersion deprecation warnings from the CLI.
///
/// This config can be specified in the following ways, using this precedence:
/// 1. This `suppressDeprecationWarnings` parameter.
/// 2. The `PULUMI_K8S_SUPPRESS_DEPRECATION_WARNINGS` environment variable.
/// </summary>
public static bool? SuppressDeprecationWarnings { get; set; } = __config.GetBoolean("suppressDeprecationWarnings");
public static bool? SuppressDeprecationWarnings
{
get => _suppressDeprecationWarnings.Get();
set => _suppressDeprecationWarnings.Set(value);
}

}
}
1 change: 1 addition & 0 deletions sdk/dotnet/Pulumi.Kubernetes.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

<TargetFramework>netcoreapp3.1</TargetFramework>
<Nullable>enable</Nullable>
<UseSharedCompilation>false</UseSharedCompilation>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
3 changes: 2 additions & 1 deletion sdk/nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"devDependencies": {
"@types/mocha": "^5.2.5",
"@types/shell-quote": "^1.6.0",
"mocha": "^5.2.0"
"mocha": "^5.2.0",
"typescript": "^4.3.5"
},
"pulumi": {
"resource": true
Expand Down
6 changes: 3 additions & 3 deletions sdk/nodejs/yaml/yaml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3090,9 +3090,9 @@ export interface ConfigOpts {
throw new Error(`YAML object does not have a .metadata.name: ${obj.apiVersion}/${obj.kind} ${JSON.stringify(obj.metadata)}`)
}

const meta = obj["metadata"];
let id: pulumi.Output<any> = pulumi.output(meta["name"]);
const namespace = meta["namespace"] || undefined;
const metadata = obj["metadata"];
let id: pulumi.Output<any> = pulumi.output(metadata["name"]);
const namespace = metadata["namespace"] || undefined;
if (namespace !== undefined) {
id = pulumi.concat(namespace, "/", id);
}
Expand Down
11 changes: 7 additions & 4 deletions sdk/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,22 @@
from subprocess import check_call


VERSION = "0.0.0"
PLUGIN_VERSION = "0.0.0"

class InstallPluginCommand(install):
def run(self):
install.run(self)
try:
check_call(['pulumi', 'plugin', 'install', 'resource', 'kubernetes', '${PLUGIN_VERSION}'])
check_call(['pulumi', 'plugin', 'install', 'resource', 'kubernetes', PLUGIN_VERSION])
except OSError as error:
if error.errno == errno.ENOENT:
print("""
print(f"""
There was an error installing the kubernetes resource provider plugin.
It looks like `pulumi` is not installed on your system.
Please visit https://pulumi.com/ to install the Pulumi CLI.
You may try manually installing the plugin by running
`pulumi plugin install resource kubernetes ${PLUGIN_VERSION}`
`pulumi plugin install resource kubernetes {PLUGIN_VERSION}`
""")
else:
raise
Expand All @@ -35,7 +38,7 @@ def readme():


setup(name='pulumi_kubernetes',
version='${VERSION}',
version=VERSION,
description="A Pulumi package for creating and managing Kubernetes resources.",
long_description=readme(),
long_description_content_type='text/markdown',
Expand Down
2 changes: 1 addition & 1 deletion tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ replace (
require (
github.com/pulumi/pulumi-kubernetes/provider/v3 v3.0.0-rc.1
github.com/pulumi/pulumi-kubernetes/sdk/v3 v3.0.0-rc.1
github.com/pulumi/pulumi/pkg/v3 v3.7.0
github.com/pulumi/pulumi/pkg/v3 v3.8.1-0.20210722201133-a4ee050afcc4
github.com/pulumi/pulumi/sdk/v3 v3.7.0
github.com/stretchr/testify v1.7.0
)
4 changes: 2 additions & 2 deletions tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -946,8 +946,8 @@ github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+Gx
github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
github.com/pulumi/pulumi/pkg/v3 v3.7.0 h1:++E0f1tiY8Goog/D0VrfaSa6Q71k02OjWTCU8QpdIeU=
github.com/pulumi/pulumi/pkg/v3 v3.7.0/go.mod h1:VgIJMIZxVwKg7qVz0smW2UuzOasgfh2997L9etiqkOw=
github.com/pulumi/pulumi/pkg/v3 v3.8.1-0.20210722201133-a4ee050afcc4 h1:pRueIMFTTbt5VFO0PU9oZQU/xY7SLoVVVdhXAaKoxzQ=
github.com/pulumi/pulumi/pkg/v3 v3.8.1-0.20210722201133-a4ee050afcc4/go.mod h1:2Y+Q5wUVGmJ2T3jyBxXEe1C0MjNwWn0dwG4blLB3om8=
github.com/pulumi/pulumi/sdk/v3 v3.3.1/go.mod h1:GBHyQ7awNQSRmiKp/p8kIKrGrMOZeA/k2czoM/GOqds=
github.com/pulumi/pulumi/sdk/v3 v3.7.0 h1:0Sm4k6QNLTm7QQmn9t31tVG7d9fuyvFOnogffgvbluE=
github.com/pulumi/pulumi/sdk/v3 v3.7.0/go.mod h1:GBHyQ7awNQSRmiKp/p8kIKrGrMOZeA/k2czoM/GOqds=
Expand Down

0 comments on commit aaa7fb0

Please sign in to comment.