https://pulumi.com logo
#general
Title
# general
b

brave-dawn-64711

10/07/2022, 11:22 AM
Hi everyone, has anyone seen this behaviour? any hints at a workaround very much appreciated. With the explicit kubernetes provider enforcement and ConfigGroup and a ComponentResource I'm getting this error:
Copy code
error: TypeError: Cannot convert undefined or null to object
        at Function.keys (<anonymous>)
        at Object.transferProperties (/Users/pprazak/repos/reflek/infrastructure-cloud/typesense/node_modules/@pulumi/runtime/rpc.ts:43:28)
        at /Users/pprazak/repos/reflek/infrastructure-cloud/typesense/node_modules/@pulumi/runtime/resource.ts:504:27
        at Generator.next (<anonymous>)
        at /Users/pprazak/repos/reflek/infrastructure-cloud/typesense/node_modules/@pulumi/pulumi/runtime/resource.js:21:71
        at new Promise (<anonymous>)
        at __awaiter (/Users/pprazak/repos/reflek/infrastructure-cloud/typesense/node_modules/@pulumi/pulumi/runtime/resource.js:17:12)
        at prepareResource (/Users/pprazak/repos/reflek/infrastructure-cloud/typesense/node_modules/@pulumi/pulumi/runtime/resource.js:340:12)
        at Object.registerResource (/Users/pprazak/repos/reflek/infrastructure-cloud/typesense/node_modules/@pulumi/runtime/resource.ts:286:24)
        at new Resource (/Users/pprazak/repos/reflek/infrastructure-cloud/typesense/node_modules/@pulumi/resource.ts:401:13)
    error: Error: Invoke: Default provider for 'kubernetes' disabled. 'kubernetes:yaml:decode' must use an explicit provider.
        at Object.callback (/Users/pprazak/repos/reflek/infrastructure-cloud/typesense/node_modules/@pulumi/runtime/invoke.ts:159:33)
        at Object.onReceiveStatus (/Users/pprazak/repos/reflek/infrastructure-cloud/typesense/node_modules/@grpc/grpc-js/src/client.ts:338:26)
        at Object.onReceiveStatus (/Users/pprazak/repos/reflek/infrastructure-cloud/typesense/node_modules/@grpc/grpc-js/src/client-interceptors.ts:426:34)
        at Object.onReceiveStatus (/Users/pprazak/repos/reflek/infrastructure-cloud/typesense/node_modules/@grpc/grpc-js/src/client-interceptors.ts:389:48)
        at /Users/pprazak/repos/reflek/infrastructure-cloud/typesense/node_modules/@grpc/grpc-js/src/call-stream.ts:276:24
        at processTicksAndRejections (node:internal/process/task_queues:77:11)
This is the relevant fragment of the component:
Copy code
const glbConfig = pulumi.all([args.namespace, this.internalHostname]).apply(
            ([ns, hs]) => new kubernetes.yaml.ConfigGroup(
                `${publicServiceName}-glb-config`,
                {
                    transformations: [args => {
                        return {
                            // failed attempt #1 at a workaround
                            opts: pulumi.mergeOptions(args.opts, {parent: this})
                        }
                    }],
                    yaml: [
                        `apiVersion: <http://cloud.google.com/v1|cloud.google.com/v1>
kind: BackendConfig
metadata:
  name: ${publicServiceName}
  namespace: ${ns}
spec:
  healthCheck:
    checkIntervalSec: 15
    timeoutSec: 15
    healthyThreshold: 1
    unhealthyThreshold: 2
    type: HTTP
    requestPath: /health
    port: ${args.apiPort || defaultApiPort}
`, `
apiVersion: <http://networking.gke.io/v1beta1|networking.gke.io/v1beta1>
kind: FrontendConfig
metadata:
  name: ${publicServiceName}
  namespace: ${ns}
spec:
  redirectToHttps:
    enabled: true
    responseCodeName: MOVED_PERMANENTLY_DEFAULT
`]
                }, {
                    parent: this,
                    transformations: [
                        (args: ResourceTransformationArgs) => {
                            return {
                                // failed attempt #2 at a workaround
                                opts: pulumi.mergeOptions(args.opts, {parent: this})
                            } as ResourceTransformationResult
                        }
                    ],
                }
            ));
I'm setting the provider explicitly on the component:
Copy code
providers: {
        kubernetes: k8sProvider, // make sure we use explicit Kubernetes provider, not the default
    },
Looks like the provider set on the component is not propagating to the Yaml.
other resources in the component do pick up the provider from parent, so either I'm missing something embarrassingly obvious or there may be a subtle bug in the parent provider propagation
CC: @enough-garden-22763
passing the provider explicitly to the component and then to the ConfigGroup works as expected, but I was expecting the parent providers to propagate like other resources do
I'm happy to file a bug report if this is not expected behaviour
e

enough-garden-22763

10/07/2022, 1:21 PM
Would really appreciate a bug report 🙏
👍 1
b

brave-dawn-64711

10/07/2022, 1:51 PM
ok, so this looks to you more like a bug, will file 🙂
26 Views