It looks like we don't export sub-module names for the Kubernetes provider in Python like we do all other resource providers.
That means this style isn't supported:
import pulumi_kubernetes as k8s
pull_secret = k8s.core.v1.Secret(...)
This leads to an error: AttributeError: module 'pulumi_kubernetes' has no attribute 'core'.
This inconsistency is unfortunate and, personally, I prefer to use this style when mixing lots of different resource providers (like AWS) since otherwise you end up with pull_secret = Secret(...) or things like pull_secret = v1.Secret(...), which doesn't tell you contextually what's happening.
The other resource packages do this:
for pkg in __all__:
if pkg != 'config':
importlib.import_module(f'{__name__}.{pkg}')
to re-export module names. I realize that dynamic export doesn't work well with MyPy (see https://github.com/pulumi/pulumi/issues/4416) but -- unless this was done intentionally in the Kubernetes package -- I'd vote for just doing it until we have a better story there, so we're consistent across all of our providers.
I believe this will get fixed as part of https://github.com/pulumi/pulumi-kubernetes/issues/1085.
Most helpful comment
I believe this will get fixed as part of https://github.com/pulumi/pulumi-kubernetes/issues/1085.