-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pulumi_kubernetes.yaml.ConfigFile with CRD raises TypeError #800
Comments
I'm getting comparable |
This happens if the CRD YAML is setting the Something along these lines should do the trick: # Remove the .status field from CRDs
def remove_status(obj, opts):
if obj["kind"] == "CustomResourceDefinition":
del obj["status"]
example = ConfigFile(
"example",
files=["cert-manager.yaml"],
transformations=[remove_status],
) |
Ah, that's a good workaround. I was able to deploy with the above transformation. Appreciate the suggestion! |
Similar issue #1226 |
For a Helm chart, you can use the same transformation function as shown above, and connect it in the
However, I applied it to the kube-prometheus-stack Helm chart and it makes a Edit: It seems to be related to (my?) MacOS, when I run it in Docker (for Mac) it is fast. |
so above it was stated:
it seems like status field is valid. Or is the suggestion that it is not valid as an input and only as output? |
Correct. It's an output-only field. |
Any updates? It has been a while |
I'm not sure if I have the same issue or not, but the workaround doesn't seem to work in my ConfigFile. Here's the traceback: error: Traceback (most recent call last):
File "/home/pasmon/.pulumi/bin/pulumi-language-python-exec", line 107, in <module>
loop.run_until_complete(coro)
File "/usr/lib/python3.10/asyncio/base_events.py", line 641, in run_until_complete
return future.result()
File "/home/pasmon/.local/share/virtualenvs/homelab/lib/python3.10/site-packages/pulumi/runtime/stack.py", line 126, in run_in_stack
await run_pulumi_func(lambda: Stack(func))
File "/home/pasmon/.local/share/virtualenvs/homelab/lib/python3.10/site-packages/pulumi/runtime/stack.py", line 51, in run_pulumi_func
await wait_for_rpcs()
File "/home/pasmon/.local/share/virtualenvs/homelab/lib/python3.10/site-packages/pulumi/runtime/stack.py", line 73, in wait_for_rpcs
await RPC_MANAGER.rpcs.pop()
File "/home/pasmon/.local/share/virtualenvs/homelab/lib/python3.10/site-packages/pulumi/runtime/rpc_manager.py", line 68, in rpc_wrapper
result = await rpc
File "/home/pasmon/.local/share/virtualenvs/homelab/lib/python3.10/site-packages/pulumi/runtime/resource.py", line 685, in do_register_resource_outputs
serialized_props = await rpc.serialize_properties(outputs, {})
File "/home/pasmon/.local/share/virtualenvs/homelab/lib/python3.10/site-packages/pulumi/runtime/rpc.py", line 172, in serialize_properties
result = await serialize_property(
File "/home/pasmon/.local/share/virtualenvs/homelab/lib/python3.10/site-packages/pulumi/runtime/rpc.py", line 343, in serialize_property
value = await serialize_property(
File "/home/pasmon/.local/share/virtualenvs/homelab/lib/python3.10/site-packages/pulumi/runtime/rpc.py", line 326, in serialize_property
future_return = await asyncio.ensure_future(awaitable)
File "/home/pasmon/.local/share/virtualenvs/homelab/lib/python3.10/site-packages/pulumi/output.py", line 123, in get_value
val = await self._future
File "/home/pasmon/.local/share/virtualenvs/homelab/lib/python3.10/site-packages/pulumi/output.py", line 169, in run
value = await self._future
File "/home/pasmon/.local/share/virtualenvs/homelab/lib/python3.10/site-packages/pulumi/output.py", line 447, in gather_futures
return await asyncio.gather(*value_futures_list)
File "/home/pasmon/.local/share/virtualenvs/homelab/lib/python3.10/site-packages/pulumi/output.py", line 123, in get_value
val = await self._future
File "/home/pasmon/.local/share/virtualenvs/homelab/lib/python3.10/site-packages/pulumi/output.py", line 169, in run
value = await self._future
File "/home/pasmon/.local/share/virtualenvs/homelab/lib/python3.10/site-packages/pulumi/output.py", line 194, in run
transformed: Input[U] = func(value)
File "/home/pasmon/.local/share/virtualenvs/homelab/lib/python3.10/site-packages/pulumi_kubernetes/yaml/yaml.py", line 543, in <lambda>
CustomResourceDefinition(f"{x}", opts, **obj)))]
File "/home/pasmon/.local/share/virtualenvs/homelab/lib/python3.10/site-packages/pulumi_kubernetes/apiextensions/v1/CustomResourceDefinition.py", line 126, in __init__
__self__._internal_init(resource_name, *args, **kwargs)
TypeError: CustomResourceDefinition._internal_init() got an unexpected keyword argument 'status'
error: an unhandled error occurred: Program exited with non-zero exit code: 1 The workaround in my case: # Remove the .status field from CRDs
def remove_status(obj, opts):
if obj["kind"] == "CustomResourceDefinition":
del obj["status"]
argocd = ConfigFile(
"argocd",
file="external/install.yaml",
transformations=[define_namespace, remove_status],
opts=pulumi.ResourceOptions(depends_on=[traefik_release,argocd_namespace])
) This is the outcome with the workaround: error: Traceback (most recent call last):
File "/home/pasmon/.pulumi/bin/pulumi-language-python-exec", line 107, in <module>
loop.run_until_complete(coro)
File "/usr/lib/python3.10/asyncio/base_events.py", line 641, in run_until_complete
return future.result()
File "/home/pasmon/.local/share/virtualenvs/homelab/lib/python3.10/site-packages/pulumi/runtime/stack.py", line 126, in run_in_stack
await run_pulumi_func(lambda: Stack(func))
File "/home/pasmon/.local/share/virtualenvs/homelab/lib/python3.10/site-packages/pulumi/runtime/stack.py", line 49, in run_pulumi_func
func()
File "/home/pasmon/.local/share/virtualenvs/homelab/lib/python3.10/site-packages/pulumi/runtime/stack.py", line 126, in <lambda>
await run_pulumi_func(lambda: Stack(func))
File "/home/pasmon/.local/share/virtualenvs/homelab/lib/python3.10/site-packages/pulumi/runtime/stack.py", line 149, in __init__
func()
File "/home/pasmon/.pulumi/bin/pulumi-language-python-exec", line 106, in <lambda>
coro = pulumi.runtime.run_in_stack(lambda: runpy.run_path(args.PROGRAM, run_name='__main__'))
File "/usr/lib/python3.10/runpy.py", line 286, in run_path
return _run_code(code, mod_globals, init_globals,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/home/pasmon/git/homelab-python/./__main__.py", line 369, in <module>
argocd = ConfigFile(
File "/home/pasmon/.local/share/virtualenvs/homelab/lib/python3.10/site-packages/pulumi_kubernetes/yaml/yaml.py", line 351, in __init__
self.resources = _parse_yaml_document(__ret__, opts, transformations, resource_prefix)
File "/home/pasmon/.local/share/virtualenvs/homelab/lib/python3.10/site-packages/pulumi_kubernetes/yaml/yaml.py", line 419, in _parse_yaml_document
file_objects = _parse_yaml_object(obj, opts, transformations, resource_prefix)
File "/home/pasmon/.local/share/virtualenvs/homelab/lib/python3.10/site-packages/pulumi_kubernetes/yaml/yaml.py", line 448, in _parse_yaml_object
t(obj, opts)
File "/home/pasmon/git/homelab-python/./__main__.py", line 367, in remove_status
del obj["status"]
KeyError: 'status'
error: an unhandled error occurred: Program exited with non-zero exit code: 1 |
This issue has been open for a few years now, is there any plan to fix it? While the workaround worked fine for me, it would be nice if it worked as expected out of the box. |
It would be nice if this were handled internally, I've hit a lot of OSS packages that fail on this, which is pretty bad ux, seems like a nominal thing to ignore |
+1 for a real fix to this issue
@pasmon I was getting the same issue, this happens when not all of the CRDs contain # Remove the .status field from CRDs
def remove_status(obj, opts):
if obj["kind"] == "CustomResourceDefinition" and "status" in obj:
del obj["status"]
example = ConfigFile(
"example",
files=["cert-manager.yaml"],
transformations=[remove_status],
) |
As far as I can tell, this issue only affects the Python SDK. I fixed the Python issue in #2183 and this change should be included in the next provider release. |
I've tried to apply the Elastic Cloud on Kubernetes (ECK) YAML using ConfigFile and got
TypeError: unexpected keyword argument 'status'
.Trackback:
I'm using Pulumi 1.1.0 and pulumi-kubernetes 1.0.1.
The text was updated successfully, but these errors were encountered: