-
Notifications
You must be signed in to change notification settings - Fork 6
Adds conversion for Overlay from k8s CRD #1119
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
Conversation
11b877a to
5b2fe37
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds conversion logic to transform Kubernetes Custom Resource Definitions (CRDs) into internal overlay configuration entities. It introduces conversion implementations for VPCs, VPC peerings, and expose configurations, along with supporting test infrastructure using the bolero fuzzing library.
Key Changes:
- Implemented conversion logic from
GatewayAgentSpec(K8s CRD) to internalOverlayconfiguration - Added
FromStrimplementation forPrefixtype to support string parsing - Created comprehensive fuzzing test generators for VPCs, peerings, and expose configurations
Reviewed changes
Copilot reviewed 16 out of 18 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| lpm/src/prefix/mod.rs | Added FromStr implementation for Prefix to enable string parsing |
| k8s-intf/src/bolero/*.rs | Added fuzzing test generators for VPC, peering, expose, and spec configurations |
| k8s-intf/build.rs | Extended type fixups for CRD code generation (VNI, idle_timeout) |
| k8s-intf/Cargo.toml | Added dependencies for lpm and serde-duration-ext |
| config/src/converters/k8s/*.rs | Implemented K8s CRD to internal config conversions for overlay entities |
| Cargo.toml | Added serde-duration-ext workspace dependency |
5b2fe37 to
b9c8285
Compare
|
This is failing due to the pem file issue that will be resolved by #1117. |
b9c8285 to
4a8a0be
Compare
Move from using if c.is_empty() { None } else { Some(c) }
which falls across multiple lines and results in uglier
construction of objects.
This commit uses Some(c).filter(|c| !c.is_empty()) instead
as this is a one liner and formats nicely, even though it
may be a bit slower because Some(c) is constructed.
In the case of this commit, Some(c.normalize()) is called
which is even more inefficient, but for the purposes of the
modified test code, the better formatting is preferable to
the slightly enhanced performance.
Signed-off-by: Manish Vachharajani <[email protected]>
As with prior commits, openapi v3 does not have notation for unsigned types, just a format hint with a generic integer. As a result kopium converts go uint32 via CRD to i32. This commit fixes up the type for vni. Signed-off-by: Manish Vachharajani <[email protected]>
Signed-off-by: Manish Vachharajani <[email protected]>
Signed-off-by: Manish Vachharajani <[email protected]>
Use std::time::Duration for idle_timeout since the default kopium type of String isn't very helpful semantically. Signed-off-by: Manish Vachharajani <[email protected]>
This allows things like "123.1.0.0/16".parse::<Prefix>() to work as expected. Signed-off-by: Manish Vachharajani <[email protected]>
Signed-off-by: Manish Vachharajani <[email protected]>
Signed-off-by: Manish Vachharajani <[email protected]>
Adds ValueGenerators for legal values of the peering types. Also adds SubnetMap to clean up typing. Signed-off-by: Manish Vachharajani <[email protected]>
Also adds SubnetMap type for cleanup. Signed-off-by: Manish Vachharajani <[email protected]>
Signed-off-by: Manish Vachharajani <[email protected]>
Signed-off-by: Manish Vachharajani <[email protected]>
4a8a0be to
ab40d93
Compare
daniel-noland
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have any meaningful issue with this PR.
I doodled up some thoughts on trivial improvements while I was reviewing it in #1123 but you can feel free to take or ditch any and all of that. It makes the Some(whatever).filter pattern a little cleaner and trims a few trivial memory allocations, but nothing worth a delay.
I think I am going to leave things as is, but having a NoneIsEmpty trait that is auto implemented does make the |
Next up is the Device section and then code to actually communicate with k8s.
This PR just adds the conversion for the Overlay external config entity.