-
Notifications
You must be signed in to change notification settings - Fork 113
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
CustomResource in Python is missing #326
Comments
First cut is here: #327 Not entirely sure this is the right direction though. |
After talking with Alex, there isn't an obvious way to implement this so that it handles the required bidirectional I'm working on adding YAML support to the Python SDK, and that can be used as a workaround for CRDs while we work on a better native solution. |
ugh, no crd sux big time |
@4c74356b41 happy to hear suggestions about how to implement this. I see no way to make it work such that it's idiomatic in python. |
i've looked through cert-manager, istio, prometheus, grafana, efk, and several other charts that contain custom resources, i dont understand what you are saying. google also doesnt help me with screamingcase definition. |
@4c74356b41 The problem is that you have to know how to transform fields like This is doable for the Kubernetes spec because we can just look and make sure the transformation is right, but it seems impossible for CRDs, since we know nothing about those fields. |
So in other words, we need to generate such mappings automatically. I don't know any way to do this with any predictable fidelity. |
i dont think there is any way to convert from SOMETHINGLIKETHIS to something_like_this, but why do you need that? you dont know anything about crd, i dont think you should know (??), just convert dict passed to spec to json and thats it? |
That's not the way any of the other APIs work, though, and I think it runs a very high likelihood of confusing users. Besides, what Levi is working on is the ability to instantiate CRDs from JSON or YAML -- which is essentially what you're asking for. The specifics are TBD, but I can imagine that we have a few APIs for this, one of which takes a JSON literal or a JSON string and parses it. |
I honestly dont think your concern about the casing matters enough to push back this feature. using files is a poor replacement, tbh |
I'm not sure what you mean by "push back this feature." As I said before, I think we will probably end up supporting something like And yes, I do happen to think that this is going to be very confusing to users. :) |
The Initial implementation in #543 accepts a dict for the spec, which avoids casing issues since the underlying fields are unchecked. We will likely want to add some more strongly-typed inputs at some point, but this unblocks users wanting to manage CRDs/CRs in Python. (Validation will still occur server-side in k8s, but the IDE won't be much help in creating these.) YAML inputs are also supported. |
Kubernetes provides the ability to extend the core API in a way that looks native. Users do this by defining
CustomResourceDefinitions
.In the nodejs API, we allow users to define instances of CRDs using the class
apiextensions.CustomResource
. This is currently unimplemented in Python, and there are several subtleties:Python uses
snake_case
. Most CRDs use Go, which means they expectSCREAMINGCASE
. How/should we do this conversion?We don't know anything about the schema of these resources, other than the fact that they all contain
apiVersion
,kind
, andmetadata
. Does this mean we have to have a constructor like:This seems not amazing.
cc @lblackstone
The text was updated successfully, but these errors were encountered: