Skip to content

Commit

Permalink
Address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
lblackstone committed May 15, 2020
1 parent 97e1c53 commit fb2061b
Show file tree
Hide file tree
Showing 6 changed files with 379 additions and 17 deletions.
12 changes: 5 additions & 7 deletions provider/pkg/gen/go-templates/apiextensions/customResource.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ import (
// CustomResource represents a resource definition we'd use to create an instance of a
// Kubernetes CustomResourceDefinition (CRD). For example, the CoreOS Prometheus operator
// exposes a CRD `monitoring.coreos.com/ServiceMonitor`; to create a `ServiceMonitor`, we'd
// pass a `CustomResourceArgs` containing the `ServiceMonitor` definition to
// `apiextensions.CustomResource`.
//
// NOTE: This type is abstract. You need to inherit from it and define all the properties of
// a specific custom resource in the derived class.
// pass a `CustomResourceArgs` containing the `ServiceMonitor` definition to `apiextensions.CustomResource`.
type CustomResource struct {
pulumi.CustomResourceState

Expand All @@ -54,7 +50,10 @@ func NewCustomResource(ctx *pulumi.Context,
args = &CustomResourceArgs{}
}

untyped := args.OtherFields
untyped := kubernetes.UntypedArgs{}
for k, v := range args.OtherFields {
untyped[k] = v
}
untyped["apiVersion"] = args.ApiVersion
untyped["kind"] = args.Kind
untyped["metadata"] = args.Metadata
Expand Down Expand Up @@ -122,7 +121,6 @@ type CustomResourceArgs struct {
// Standard object metadata.
Metadata metav1.ObjectMetaPtrInput
// Untyped map that holds any user-defined fields.
// TODO: do we need to support Inputs in the map?
OtherFields kubernetes.UntypedArgs
}

Expand Down
12 changes: 5 additions & 7 deletions sdk/go/kubernetes/apiextensions/customResource.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ import (
// CustomResource represents a resource definition we'd use to create an instance of a
// Kubernetes CustomResourceDefinition (CRD). For example, the CoreOS Prometheus operator
// exposes a CRD `monitoring.coreos.com/ServiceMonitor`; to create a `ServiceMonitor`, we'd
// pass a `CustomResourceArgs` containing the `ServiceMonitor` definition to
// `apiextensions.CustomResource`.
//
// NOTE: This type is abstract. You need to inherit from it and define all the properties of
// a specific custom resource in the derived class.
// pass a `CustomResourceArgs` containing the `ServiceMonitor` definition to `apiextensions.CustomResource`.
type CustomResource struct {
pulumi.CustomResourceState

Expand All @@ -54,7 +50,10 @@ func NewCustomResource(ctx *pulumi.Context,
args = &CustomResourceArgs{}
}

untyped := args.OtherFields
untyped := kubernetes.UntypedArgs{}
for k, v := range args.OtherFields {
untyped[k] = v
}
untyped["apiVersion"] = args.ApiVersion
untyped["kind"] = args.Kind
untyped["metadata"] = args.Metadata
Expand Down Expand Up @@ -122,7 +121,6 @@ type CustomResourceArgs struct {
// Standard object metadata.
Metadata metav1.ObjectMetaPtrInput
// Untyped map that holds any user-defined fields.
// TODO: do we need to support Inputs in the map?
OtherFields kubernetes.UntypedArgs
}

Expand Down
10 changes: 10 additions & 0 deletions tests/integration/go/basic/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module github.com/pulumi/pulumi-kubernetes/tests/integration/go/basic

go 1.14

require (
github.com/pulumi/pulumi-kubernetes/sdk/v2 v2.0.0
github.com/pulumi/pulumi/sdk/v2 v2.2.2-0.20200514204320-e677c7d6dca3
)

replace github.com/pulumi/pulumi-kubernetes/sdk/v2 => ../github.com/pulumi/pulumi-kubernetes/sdk
Loading

0 comments on commit fb2061b

Please sign in to comment.