Cross-posting from <#C84L4E3N1|general>, since I j...
# kubernetes
a
Cross-posting from #general, since I just realized this channel exists.
b
Are you passing the
Provider
instance in as the
provider
to all of the Kubernetes objects you're creating?
a
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
For debugging, I’ve set a garbage
KUBECONFIG
env var and watched for which resources fail.
a
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
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
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
np!