-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
Type name generation for complex spec is broken #21
Comments
Hm. That's weird. I am testing it on fairly large crds, but I guess there must be something in these particular ones that we don't handle. Maybe something about references to foreign crds being inlined in the schema (i haven't handled anything like that so far at least)? Any chance of adding a link to the full schema / collapsible comment with it inlined? (There's also a point in here about camelCase -> snake_case not being done, raising that separately - #22) |
clusters.cluster.x-k8s.io schema
|
Ok, that does actually look pretty normal (apart from the multiple versions in there making it effectively 4 times the size). I'll try to play around and debug the analyzer later to see why it's spitting out that. |
It is slightly better now with the fix in 0.6.0 (#28) generated from your crd: #[derive(CustomResource, Serialize, Deserialize, Clone, Debug)]
#[kube(group = "cluster.x-k8s.io", version = "v1beta1", kind = "Cluster", plural = "clusters")]
#[kube(namespaced)]
#[kube(schema = "disabled")]
pub struct ClusterSpec {
pub clusterNetwork: Option<ClusterClusterNetwork>,
pub controlPlaneEndpoint: Option<ClusterControlPlaneEndpoint>,
pub controlPlaneRef: Option<ClusterControlPlaneRef>,
pub infrastructureRef: Option<ClusterInfrastructureRef>,
pub paused: Option<bool>,
pub topology: Option<ClusterTopology>,
} and those second level structs exist |
however it is failing at failureDomains:
additionalProperties:
description: FailureDomainSpec is the Schema for Cluster API failure
domains. It allows controllers to understand how many failure
domains a cluster can optionally span across.
properties:
attributes:
additionalProperties:
type: string
description: Attributes is a free form map of attributes an
infrastructure provider might use or require.
type: object
controlPlane:
description: ControlPlane determines if this failure domain
is suitable for use by control plane machines.
type: boolean
type: object
description: FailureDomains is a slice of failure domain objects synced
from the infrastructure provider. generates this member: #[derive(Serialize, Deserialize, Clone, Debug)]
pub struct ClusterStatus {
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub conditions: Vec<ClusterStatusConditions>,
pub controlPlaneReady: Option<bool>,
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
pub failureDomains: BTreeMap<String, Object>,
pub failureMessage: Option<String>,
pub failureReason: Option<String>,
pub infrastructureReady: Option<bool>,
pub observedGeneration: Option<i64>,
pub phase: Option<String>,
} |
ok, i have identified one logic error inside Lines 30 to 36 in c74379d
we end up in that case for
and that's because it has its |
Several fixes has gone in since this was opened. The CRD case herein now at least builds - but i don't have a crd instance to fully test it. Please re-open if this is seen again. Definitely areas in the analyzer that i'm not sure about. |
I am running
kopium
against cluster-api CRDs and generated structs appear incorrectHere is what Rust code for top-level object
clusters.cluster.x-k8s.io
This is definitely not correct as the struct cannot reference itself
Here is what I think it should be producing (ignore field names, types are important)
The text was updated successfully, but these errors were encountered: