https://pulumi.com logo
#kubernetes
Title
# kubernetes
a

able-doctor-68496

09/14/2021, 8:49 PM
Cross-posting from #general, since I just realized this channel exists.
b

brave-ambulance-98491

09/14/2021, 8:52 PM
Are you passing the
Provider
instance in as the
provider
to all of the Kubernetes objects you're creating?
a

able-doctor-68496

09/14/2021, 8:54 PM
Yes, at least I’ve triple-checked that I am. Is there a good general way to debug this kind of problem? Like a way to view the providers for all of the resources that I’m creating?
e

echoing-motherboard-16358

09/14/2021, 8:58 PM
For debugging, I’ve set a garbage
KUBECONFIG
env var and watched for which resources fail.
a

able-doctor-68496

09/14/2021, 9:04 PM
Yeah, that’s the state I’m in right now pretty much, except I think I’m passing in the correct provider rather than a garbage one. This is what I have in the
__init__
of my `ComponentResource`:
Copy code
provider = pulumi_kubernetes.Provider('kubernetes-provider', kubeconfig=args.kubeconfig)
        self._opts = opts.merge(pulumi.ResourceOptions(provider=provider)).merge(pulumi.ResourceOptions(parent=self))
And this is the code that is creating the object that is failing:
Copy code
self._configmap_license = pulumi_kubernetes.core.v1.ConfigMap(
                f'{self._name}-license',
                metadata=meta_v1.ObjectMetaArgs(
                    name=f'{self._name}-license',
                    namespace=self._args.namespace_name
                ),
                data={
                    'seeq_server_license': license_file.read()
                },
                opts=self._opts
            )
b

brave-ambulance-98491

09/14/2021, 9:10 PM
Could it be that
merge
is retaining a bad provider somehow? It looks like providers can be a list or collection, and
merge
is documented as retaining all items in all collections.
I've always set
provider
directly in the resource options constructor, and have never used
merge
.
a

able-doctor-68496

09/14/2021, 9:12 PM
That’s an interesting thought. That might be exactly what’s happening.
That actually revealed another bug in my code, as well - I was merging with the
opts
passed into the parent component and
self._opts
is supposed to be passed into the child components - so that was wrong - and I wasn’t passing the parent component’s
opts
to
super().__init__
That was the issue! creating a fresh
ResourceOptions
fixed it! Thanks for the help, @brave-ambulance-98491
b

brave-ambulance-98491

09/14/2021, 9:22 PM
np!
5 Views