-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Labels
kind/bugSome behavior is incorrect or out of specSome behavior is incorrect or out of spec
Description
What happened?
Following the python example to create CRDs inside pulumi during the pulumi up command the following error is returned:
pulumi:pulumi:Stack (pulumi-k8s-pulumi-k8s):
error: Program failed with an unhandled exception:
Traceback (most recent call last):
File "/path/path/pulumi-k8s/./__main__.py", line 42, in <module>
import crontabs.pulumi_crds as crontabs
File "/path/path/pulumi-k8s/./crontabs/pulumi_crds/__init__.py", line 5, in <module>
from . import _utilities
File "/path/path/pulumi-k8s/./crontabs/pulumi_crds/_utilities.py", line 94, in <module>
_version = _get_semver_version()
File "/path/path/pulumi-k8s/./crontabs/pulumi_crds/_utilities.py", line 73, in _get_semver_version
pep440_version_string = pkg_resources.require(root_package)[0].version
File "/path/path/pulumi-k8s/.venv/lib/python3.10/site-packages/pkg_resources/__init__.py", line 909, in require
needed = self.resolve(parse_requirements(requirements))
File "/path/path/pulumi-k8s/.venv/lib/python3.10/site-packages/pkg_resources/__init__.py", line 795, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'crontabs' distribution was not found and is required by the application
Changing the import from import crontabs.pulumi_crds as crontabs to import crontabs as crontabs solve the pkg_resources error but the usage of the module is impacted.
import crontabs as crontabs
# Register the CronTab CRD.
crontab_definition = k8s.yaml.ConfigFile(
"my-crontab-definition", file="customresources.yaml"
)
# Instantiate a CronTab resource.
crontab_instance = crontabs.stable.v1.CronTab(
"my-new-cron-object",
metadata=k8s.meta.v1.ObjectMetaArgs(name="my-new-cron-object"),
spec=crontabs.stable.v1.CronTabSpecArgs(
cron_spec="* * * */5",
image="my-awesome-cron-image",
),
)the error returned is now:
error: Program failed with an unhandled exception:
Traceback (most recent call last):
File "/path/path/pulumi-k8s/./__main__.py", line 50, in <module>
crontab_instance = crontabs.stable.v1.CronTab(
AttributeError: module 'crontabs' has no attribute 'stable'
Expected Behavior
import of the module works and it's usable to create CRDs from python
Steps to reproduce
1- download the yaml for the CRDs for crontabs from the example
2- crd2pulumi --pythonPath ./crontabs customresources.yaml
3- use the module
Output of pulumi about
CLI
Version 3.53.1
Go Version go1.19.5
Go Compiler gc
Plugins
NAME VERSION
command 0.7.1-alpha.1674088865
crds 0.0.0
kubernetes 3.24.0-alpha.1675102241
kubernetes-cert-manager 0.0.5
python unknown
Host
OS ubuntu
Version 22.04
Arch x86_64
Additional context
No response
Contributing
Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).
Metadata
Metadata
Assignees
Labels
kind/bugSome behavior is incorrect or out of specSome behavior is incorrect or out of spec